Skip to content

Commit bb4ee27

Browse files
committed
[MC] Remove the last MCFragment::getPrevNode use. NFC
1 parent 13896b6 commit bb4ee27

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/MC/MCAssembler.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,9 +1094,11 @@ bool MCAssembler::relaxBoundaryAlign(MCAsmLayout &Layout,
10941094

10951095
uint64_t AlignedOffset = Layout.getFragmentOffset(&BF);
10961096
uint64_t AlignedSize = 0;
1097-
for (const MCFragment *F = BF.getLastFragment(); F != &BF;
1098-
F = F->getPrevNode())
1097+
for (const MCFragment *F = BF.getNextNode();; F = F->getNextNode()) {
10991098
AlignedSize += computeFragmentSize(Layout, *F);
1099+
if (F == BF.getLastFragment())
1100+
break;
1101+
}
11001102

11011103
Align BoundaryAlignment = BF.getAlignment();
11021104
uint64_t NewSize = needPadding(AlignedOffset, AlignedSize, BoundaryAlignment)

0 commit comments

Comments
 (0)