[PATCH] D153096: [MC] Fold A-B when A's fragment precedes B's fragment

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 20 13:58:57 PDT 2023


nickdesaulniers added inline comments.


================
Comment at: llvm/lib/MC/MCExpr.cpp:665-670
+      for (auto FI = FA->getIterator(), FE = SecA.end(); ++FI != FE;) {
+        if (&*FI == FB) {
+          Reverse = true;
+          break;
+        }
+      }
----------------
is there a more concise way to express this with `std::find`?


================
Comment at: llvm/lib/MC/MCExpr.cpp:695
     }
-    // If FA is found or if FA is a dummy fragment not in the fragment list,
-    // (which means SA is a pending label (see flushPendingLabels)), we can
-    // resolve the difference.
-    if (Found || isa<MCDummyFragment>(FA)) {
-      Addend += Displacement;
-      FinalizeFolding();
-    }
+    // If the previous loop does not find FA, FA must be a dummay not in the
+    // fragment list (which means SA is a pending label (see
----------------
typo: s/dummay/dummy/


================
Comment at: llvm/test/MC/AArch64/arm64-small-data-fixups.s:5
   .long 0
+.p2align 2
 bar:
----------------
let's keep the indentation of assembler directives consistent


================
Comment at: llvm/test/MC/ARM/directive-if-subtraction.s:23
+// OBJ-NOT:[[@LINE-1]]:5: error: expected absolute expression
+// ASM:[[@LINE-2]]:5: error: expected absolute expression
+// DISASM: orr	r1, r1, #2
----------------
I thought the whole point of this patch is to allow `9997b - . == 0` to fold? Then why is this testing for that to emit an error?


================
Comment at: llvm/test/MC/MachO/reloc-diff.s:4
 _local_def:
+.p2align 2
         .globl _external_def
----------------
indent


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153096/new/

https://reviews.llvm.org/D153096



More information about the llvm-commits mailing list