[llvm] r336869 - IR: Skip -print-*-all after -print-*

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 13 11:08:35 PDT 2018


On Wed, Jul 11, 2018 at 4:35 PM Duncan P. N. Exon Smith via
llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> Author: dexonsmith
> Date: Wed Jul 11 16:30:25 2018
> New Revision: 336869
>
> URL: http://llvm.org/viewvc/llvm-project?rev=336869&view=rev
> Log:
> IR: Skip -print-*-all after -print-*
>
> This changes `-print-*` from transformation passes to analysis passes so
> that `-print-after-all` and `-print-before-all` don't trigger.  This
> avoids some redundant output.
>
> Patch by Son Tuan Vu!
>
> Added:
>     llvm/trunk/test/Other/printer.ll
> Modified:
>     llvm/trunk/lib/IR/IRPrintingPasses.cpp
>
> Modified: llvm/trunk/lib/IR/IRPrintingPasses.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/IRPrintingPasses.cpp?rev=336869&r1=336868&r2=336869&view=diff
> ==============================================================================
> --- llvm/trunk/lib/IR/IRPrintingPasses.cpp (original)
> +++ llvm/trunk/lib/IR/IRPrintingPasses.cpp Wed Jul 11 16:30:25 2018
> @@ -127,13 +127,13 @@ public:
>
>  char PrintModulePassWrapper::ID = 0;
>  INITIALIZE_PASS(PrintModulePassWrapper, "print-module",
> -                "Print module to stderr", false, false)
> +                "Print module to stderr", false, true)
>  char PrintFunctionPassWrapper::ID = 0;
>  INITIALIZE_PASS(PrintFunctionPassWrapper, "print-function",
> -                "Print function to stderr", false, false)
> +                "Print function to stderr", false, true)
>  char PrintBasicBlockPass::ID = 0;
>  INITIALIZE_PASS(PrintBasicBlockPass, "print-bb", "Print BB to stderr", false,
> -                false)
> +                true)
>
>  ModulePass *llvm::createPrintModulePass(llvm::raw_ostream &OS,
>                                          const std::string &Banner,
>
> Added: llvm/trunk/test/Other/printer.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/printer.ll?rev=336869&view=auto
> ==============================================================================
> --- llvm/trunk/test/Other/printer.ll (added)
> +++ llvm/trunk/test/Other/printer.ll Wed Jul 11 16:30:25 2018
> @@ -0,0 +1,13 @@
> +; RUN: opt -mem2reg -instcombine -print-after-all -S < %s 2>&1 | FileCheck %s
> +define void @tester(){
> +  ret void
> +}
> +
> +define void @foo(){
> +  ret void
> +}
> +
> +;CHECK: IR Dump After Promote Memory to Register
> +;CHECK: IR Dump After Combine redundant instructions
> +;CHECK: IR Dump After Module Verifier
> +;CHECK-NOT: IR Dump After Print Module IR
>

I'm afraid this will break, as CHECK-NOT(s) are really fragile. Is there
a better way we can test this? probably `CHECK-NEXT` & adding a "end
of pipeline" message?

--
Davide


More information about the llvm-commits mailing list