[llvm] b6688a0 - [MC] flushPendingLabels: revert setAtom change

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 14:06:24 PDT 2024


Author: Fangrui Song
Date: 2024-06-13T14:06:20-07:00
New Revision: b6688a0b17361e1f4164f52e8d3b17defd7d432d

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

LOG: [MC] flushPendingLabels: revert setAtom change

The setAtom call introduced by e17bc023f4e5b79f08bfc7f624f8ff0f0cf17ce4
was due to my misunderstanding of flushPendingLabels
(see https://discourse.llvm.org/t/mc-removing-aligned-bundling-support/79518).

When evaluating `.quad x-y`,
MCExpr.cpp:AttemptToFoldSymbolOffsetDifference gives different results
at parse time and layout time because the `if (FA->getAtom() ==
FB.getAtom())` condition in isSymbolRefDifferenceFullyResolvedImpl only
works when `setAtom` with a non-null pointer has been called. Calling
setAtom in flushPendingLabels does not help anything.

Added: 
    

Modified: 
    llvm/lib/MC/MCSection.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp
index 1d9fe2cafd617..59fdfd76f444a 100644
--- a/llvm/lib/MC/MCSection.cpp
+++ b/llvm/lib/MC/MCSection.cpp
@@ -102,12 +102,9 @@ void MCSection::flushPendingLabels() {
   while (!PendingLabels.empty()) {
     PendingLabel& Label = PendingLabels[0];
     switchSubsection(Label.Subsection);
-    const MCSymbol *Atom =
-        CurFragList->Tail ? CurFragList->Tail->getAtom() : nullptr;
     MCFragment *F = new MCDataFragment();
     addFragment(*F);
     F->setParent(this);
-    F->setAtom(Atom);
     flushPendingLabels(F, 0, Label.Subsection);
   }
 }


        


More information about the llvm-commits mailing list