[llvm] 481e2dd - [CSKY] AsmBackend: Wrap Inst.dump() in LLVM_DEBUG

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 23:27:15 PDT 2022


Author: Kees Cook
Date: 2022-03-31T23:27:10-07:00
New Revision: 481e2ddef452a261a202ec60b02ab8b31f022c7f

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

LOG: [CSKY] AsmBackend: Wrap Inst.dump() in LLVM_DEBUG

-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=CSKY -DLLVM_ENABLE_ASSERTIONS=OFF
builds will fail to link due to undefined `llvm::MCInst::dump() const`

```
ld.lld: error: undefined symbol: llvm::MCInst::dump() const
>>> referenced by CSKYAsmBackend.cpp
>>>               /home/kees/src/built-compilers/llvm/stage2-prof-gen/lto.cache/llvmcache-0656FC38C728A7FE0F767D10CD84C7F820114C46:(llvm::CSKYAsmBackend::relaxInstruction(llvm::MCInst&, llvm::MCSubtargetInfo const&) const)
```

Wrap it in LLVM_DEBUG().

Fixes https://github.com/llvm/llvm-project/issues/54684

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D122854

Added: 
    

Modified: 
    llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp
index 41da382df3e00..b5dfdfa0b42b0 100644
--- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp
+++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp
@@ -295,7 +295,7 @@ void CSKYAsmBackend::relaxInstruction(MCInst &Inst,
 
   switch (Inst.getOpcode()) {
   default:
-    Inst.dump();
+    LLVM_DEBUG(Inst.dump());
     llvm_unreachable("Opcode not expected!");
   case CSKY::LRW16:
     Res.setOpcode(CSKY::LRW32);


        


More information about the llvm-commits mailing list