[llvm] [MC] Maintain MCRelaxAll after reset() (PR #94945)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 02:31:03 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mc

Author: None (aengelke)

<details>
<summary>Changes</summary>

RelaxAll was set in the constructor, but cleared after reset().


---
Full diff: https://github.com/llvm/llvm-project/pull/94945.diff


1 Files Affected:

- (modified) llvm/lib/MC/MCObjectStreamer.cpp (+4-1) 


``````````diff
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 0ccade91677a4..8d3873bed9efd 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -175,8 +175,11 @@ void MCObjectStreamer::emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi,
 }
 
 void MCObjectStreamer::reset() {
-  if (Assembler)
+  if (Assembler) {
     Assembler->reset();
+    if (getContext().getTargetOptions())
+      Assembler->setRelaxAll(getContext().getTargetOptions()->MCRelaxAll);
+  }
   CurInsertionPoint = MCSection::iterator();
   EmitEHFrame = true;
   EmitDebugFrame = false;

``````````

</details>


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


More information about the llvm-commits mailing list