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

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 02:52:09 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()) {
----------------
aengelke wrote:

```suggestion
      if (F->getKind() == MCFragment::FT_Data && F->isLinkerRelaxable()) {
```

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


More information about the llvm-commits mailing list