[llvm] MC: Restructure MCFragment as a fixed part and a variable tail (PR #148544)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 09:49:14 PDT 2025


================
@@ -352,7 +352,7 @@ static void attemptToFoldSymbolOffsetDifference(const MCAssembler *Asm,
     // the linker.
     bool BBeforeRelax = false, AAfterRelax = false;
     for (auto F = FB; F; F = F->getNext()) {
-      auto DF = dyn_cast<MCDataFragment>(F);
+      auto DF = F->getKind() == MCFragment::FT_Data ? F : nullptr;
       if (DF && DF->isLinkerRelaxable()) {
----------------
MaskRay wrote:

On line 374 there is another reference of `DF`, so I am inclined to keep this `DF` variable...

https://github.com/llvm/llvm-project/pull/148544


More information about the llvm-commits mailing list