[PATCH] D89476: [llc] Use -filetype=null to disable MIR printing

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 01:34:10 PDT 2020


foad updated this revision to Diff 298565.
foad added a comment.

Address feedback.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89476/new/

https://reviews.llvm.org/D89476

Files:
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/test/tools/llc/filetype-null-stop-after.ll


Index: llvm/test/tools/llc/filetype-null-stop-after.ll
===================================================================
--- /dev/null
+++ llvm/test/tools/llc/filetype-null-stop-after.ll
@@ -0,0 +1,3 @@
+; -stop-after would normally dump MIR, but with -filetype=null as well check
+; there's no output at all.
+; RUN: llc -filetype=null -stop-after=finalize-isel -o - %s | count 0
Index: llvm/lib/CodeGen/LLVMTargetMachine.cpp
===================================================================
--- llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -196,11 +196,14 @@
   if (!PassConfig)
     return true;
 
-  if (!TargetPassConfig::willCompleteCodeGenPipeline())
-    PM.add(createPrintMIRPass(Out));
-  else if (addAsmPrinter(PM, Out, DwoOut, FileType,
-                           MMIWP->getMMI().getContext()))
-    return true;
+  if (TargetPassConfig::willCompleteCodeGenPipeline()) {
+    if (addAsmPrinter(PM, Out, DwoOut, FileType, MMIWP->getMMI().getContext()))
+      return true;
+  } else {
+    // MIR printing is redundant with -filetype=null.
+    if (FileType != CGFT_Null)
+      PM.add(createPrintMIRPass(Out));
+  }
 
   PM.add(createFreeMachineFunctionPass());
   return false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89476.298565.patch
Type: text/x-patch
Size: 1236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201016/02810f86/attachment.bin>


More information about the llvm-commits mailing list