[llvm] 2114947 - MCObjectStreamer: Remove an unneeded getBackendPtr test

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 23:03:48 PDT 2024


Author: Fangrui Song
Date: 2024-07-22T23:03:43-07:00
New Revision: 211494705b55ca8e1eaaaf74ba93d94a4d450a64

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

LOG: MCObjectStreamer: Remove an unneeded getBackendPtr test

All of `MCAsmBackend`, `MCCodeEmitter`, and `MCObjectWriter` must be
non-null.

Added: 
    

Modified: 
    llvm/lib/MC/MCObjectStreamer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 1863756b8fe31..9dc3974fd8f0d 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -32,8 +32,8 @@ MCObjectStreamer::MCObjectStreamer(MCContext &Context,
       Assembler(std::make_unique<MCAssembler>(
           Context, std::move(TAB), std::move(Emitter), std::move(OW))),
       EmitEHFrame(true), EmitDebugFrame(false) {
-  if (Assembler->getBackendPtr())
-    setAllowAutoPadding(Assembler->getBackend().allowAutoPadding());
+  assert(Assembler->getBackendPtr() && Assembler->getEmitterPtr());
+  setAllowAutoPadding(Assembler->getBackend().allowAutoPadding());
   if (Context.getTargetOptions() && Context.getTargetOptions()->MCRelaxAll)
     Assembler->setRelaxAll(true);
 }


        


More information about the llvm-commits mailing list