[PATCH] D122854: [CSKY] AsmBackend: Make Inst.dump() debug-only

Kees Cook via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 16:04:15 PDT 2022


kees created this revision.
kees added reviewers: nickdesaulniers, nathanchance, zixuan-wu.
Herald added a subscriber: hiraditya.
Herald added a project: All.
kees requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Production builds of CSKY will fail to link with an bare call to
Inst.dump(), which was introduced in commit 582836faafcb <https://reviews.llvm.org/rG582836faafcb458161947a72df27752fe5f76171>:

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122854

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


Index: llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp
===================================================================
--- llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp
+++ llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp
@@ -295,7 +295,7 @@
 
   switch (Inst.getOpcode()) {
   default:
-    Inst.dump();
+    LLVM_DEBUG(Inst.dump());
     llvm_unreachable("Opcode not expected!");
   case CSKY::LRW16:
     Res.setOpcode(CSKY::LRW32);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122854.419583.patch
Type: text/x-patch
Size: 456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220331/6b8d21e1/attachment.bin>


More information about the llvm-commits mailing list