[llvm] bb4ee27 - [MC] Remove the last MCFragment::getPrevNode use. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 9 23:14:19 PDT 2024


Author: Fangrui Song
Date: 2024-06-09T23:14:15-07:00
New Revision: bb4ee27a31695bb06bfe56d442b30b25ac88d7cd

URL: https://github.com/llvm/llvm-project/commit/bb4ee27a31695bb06bfe56d442b30b25ac88d7cd
DIFF: https://github.com/llvm/llvm-project/commit/bb4ee27a31695bb06bfe56d442b30b25ac88d7cd.diff

LOG: [MC] Remove the last MCFragment::getPrevNode use. NFC

Added: 
    

Modified: 
    llvm/lib/MC/MCAssembler.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index c56d28bb70e73..a7157e7a37b43 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -1094,9 +1094,11 @@ bool MCAssembler::relaxBoundaryAlign(MCAsmLayout &Layout,
 
   uint64_t AlignedOffset = Layout.getFragmentOffset(&BF);
   uint64_t AlignedSize = 0;
-  for (const MCFragment *F = BF.getLastFragment(); F != &BF;
-       F = F->getPrevNode())
+  for (const MCFragment *F = BF.getNextNode();; F = F->getNextNode()) {
     AlignedSize += computeFragmentSize(Layout, *F);
+    if (F == BF.getLastFragment())
+      break;
+  }
 
   Align BoundaryAlignment = BF.getAlignment();
   uint64_t NewSize = needPadding(AlignedOffset, AlignedSize, BoundaryAlignment)


        


More information about the llvm-commits mailing list