[all-commits] [llvm/llvm-project] e24bb6: [NewPM] Handle passes with params in -print-before...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Fri Jul 9 00:59:27 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e24bb698bb445ee785ad25f53aa76b1242aec217
      https://github.com/llvm/llvm-project/commit/e24bb698bb445ee785ad25f53aa76b1242aec217
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2021-07-09 (Fri, 09 Jul 2021)

  Changed paths:
    M llvm/lib/IR/PassInstrumentation.cpp
    M llvm/lib/Passes/PassBuilder.cpp
    M llvm/lib/Passes/PassRegistry.def
    M llvm/test/Other/print-before-after.ll

  Log Message:
  -----------
  [NewPM] Handle passes with params in -print-before/-print-after

To support options like -print-before=<pass> and -print-after=<pass>
the PassBuilder will register PassInstrumentation callbacks as well
as a mapping between internal pass class names and the pass names
used in those options (and other cmd line interfaces). But for
some reason all the passes that takes options where missing in those
maps, so for example "-print-after=loop-vectorize" didn't work.

This patch will add the missing entries by also taking care of
function and loop passes with params when setting up the class to
pass name maps.

One might notice that even with this patch it might be tricky to
know what pass name to use in options such as -print-after. This
because there only is a single mapping from class name to pass name,
while the PassRegistry currently is a bit messy as it sometimes
reuses the same class for different pass names (without using the
"pass with params" scheme, or the pass-name<variant> syntax).

It gets extra messy in some situations. For example the
MemorySanitizerPass can run like this (with debug and print-after)
  opt -passes='kmsan' -print-after=msan-module -debug-only=msan
The 'kmsan' alias for 'msan<kernel>' is just confusing as one might
think that 'kmsan' is a separate pass (but the DEBUG_TYPE is still
just 'msan'). And since the module pass version of the pass adds
a mapping from 'MemorySanitizerPass' to 'msan-module' one need to
use 'msan-module' in the print-before and print-after options.

Reviewed By: ychen

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


  Commit: 472462c4723978db5a09c0058ddec025e6a6a94b
      https://github.com/llvm/llvm-project/commit/472462c4723978db5a09c0058ddec025e6a6a94b
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2021-07-09 (Fri, 09 Jul 2021)

  Changed paths:
    M llvm/lib/Analysis/InlineCost.cpp
    M llvm/lib/FuzzMutate/FuzzerCLI.cpp
    M llvm/lib/Passes/PassBuilder.cpp
    M llvm/lib/Passes/PassRegistry.def
    M llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
    M llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
    M llvm/test/Analysis/MemorySSA/update-remove-dead-blocks.ll
    M llvm/test/Other/cgscc-disconnected-invalidation.ll
    M llvm/test/Other/cgscc-iterate-function-mutation.ll
    M llvm/test/Other/pass-pipelines.ll
    M llvm/test/Other/print-module-scope.ll
    M llvm/test/Transforms/Coroutines/ArgAddr.ll
    M llvm/test/Transforms/Coroutines/coro-alloc-with-param-O0.ll
    M llvm/test/Transforms/Coroutines/coro-alloc-with-param-O2.ll
    M llvm/test/Transforms/Coroutines/coro-alloca-01.ll
    M llvm/test/Transforms/Coroutines/coro-alloca-02.ll
    M llvm/test/Transforms/Coroutines/coro-alloca-03.ll
    M llvm/test/Transforms/Coroutines/coro-alloca-04.ll
    M llvm/test/Transforms/Coroutines/coro-alloca-05.ll
    M llvm/test/Transforms/Coroutines/coro-alloca-06.ll
    M llvm/test/Transforms/Coroutines/coro-alloca-07.ll
    M llvm/test/Transforms/Coroutines/coro-alloca-08.ll
    M llvm/test/Transforms/Coroutines/coro-byval-param.ll
    M llvm/test/Transforms/Coroutines/coro-catchswitch-cleanuppad.ll
    M llvm/test/Transforms/Coroutines/coro-catchswitch.ll
    M llvm/test/Transforms/Coroutines/coro-debug.ll
    M llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-00.ll
    M llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-01.ll
    M llvm/test/Transforms/Coroutines/coro-eh-aware-edge-split-02.ll
    M llvm/test/Transforms/Coroutines/coro-frame-arrayalloca.ll
    M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-00.ll
    M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-01.ll
    M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-02.ll
    M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-03.ll
    M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-04.ll
    M llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-05.ll
    M llvm/test/Transforms/Coroutines/coro-frame-unreachable.ll
    M llvm/test/Transforms/Coroutines/coro-frame.ll
    M llvm/test/Transforms/Coroutines/coro-heap-elide.ll
    M llvm/test/Transforms/Coroutines/coro-materialize.ll
    M llvm/test/Transforms/Coroutines/coro-padding.ll
    M llvm/test/Transforms/Coroutines/coro-param-copy.ll
    M llvm/test/Transforms/Coroutines/coro-retcon-frame.ll
    M llvm/test/Transforms/Coroutines/coro-retcon-once-value2.ll
    M llvm/test/Transforms/Coroutines/coro-retcon-resume-values2.ll
    M llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
    M llvm/test/Transforms/Coroutines/coro-spill-after-phi.ll
    M llvm/test/Transforms/Coroutines/coro-spill-corobegin.ll
    M llvm/test/Transforms/Coroutines/coro-spill-defs-before-corobegin.ll
    M llvm/test/Transforms/Coroutines/coro-spill-promise.ll
    M llvm/test/Transforms/Coroutines/coro-split-00.ll
    M llvm/test/Transforms/Coroutines/coro-split-02.ll
    M llvm/test/Transforms/Coroutines/coro-split-alloc.ll
    M llvm/test/Transforms/Coroutines/coro-split-dbg.ll
    M llvm/test/Transforms/Coroutines/coro-split-eh-00.ll
    M llvm/test/Transforms/Coroutines/coro-split-eh-01.ll
    M llvm/test/Transforms/Coroutines/coro-split-hidden.ll
    M llvm/test/Transforms/Coroutines/coro-split-musttail.ll
    M llvm/test/Transforms/Coroutines/coro-split-musttail1.ll
    M llvm/test/Transforms/Coroutines/coro-split-musttail2.ll
    M llvm/test/Transforms/Coroutines/coro-split-musttail3.ll
    M llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-01.ll
    M llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-02.ll
    M llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-03.ll
    M llvm/test/Transforms/Coroutines/coro-split-sink-lifetime-04.ll
    M llvm/test/Transforms/Coroutines/coro-zero-alloca.ll
    M llvm/test/Transforms/Coroutines/no-suspend.ll
    M llvm/test/Transforms/Inline/monster_scc.ll
    M llvm/test/Transforms/InstCombine/assume-align.ll
    M llvm/test/Transforms/LoopUnroll/peel-loop-inner.ll
    M llvm/test/Transforms/LoopUnroll/peel-loop.ll
    M llvm/test/Transforms/PGOProfile/chr.ll
    M llvm/test/Transforms/PruneEH/2008-06-02-Weak.ll
    M llvm/test/Transforms/PruneEH/ipo-nounwind.ll
    M llvm/test/Transforms/PruneEH/looptest.ll
    M llvm/test/Transforms/PruneEH/musttail.ll
    M llvm/test/Transforms/PruneEH/operand-bundles.ll
    M llvm/test/Transforms/PruneEH/pr23971.ll
    M llvm/test/Transforms/PruneEH/pr26263.ll
    M llvm/test/Transforms/PruneEH/recursivetest.ll
    M llvm/test/Transforms/PruneEH/seh-nounwind.ll
    M llvm/test/Transforms/PruneEH/simpletest.ll
    M llvm/test/Transforms/SimplifyCFG/1elt-ptr-vec-alignment-crash.ll
    M llvm/test/Transforms/SimplifyCFG/ARM/switch-to-lookup-table.ll
    M llvm/test/Transforms/SimplifyCFG/ForwardSwitchConditionToPHI.ll
    M llvm/test/Transforms/SimplifyCFG/X86/CoveredLookupTable.ll
    M llvm/test/Transforms/SimplifyCFG/X86/disable-lookup-table.ll
    M llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll
    M llvm/test/Transforms/SimplifyCFG/X86/switch-covered-bug.ll
    M llvm/test/Transforms/SimplifyCFG/X86/switch-table-bug.ll
    M llvm/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll
    M llvm/test/Transforms/SimplifyCFG/basictest.ll
    M llvm/test/Transforms/SimplifyCFG/branch-fold-threshold.ll
    M llvm/test/Transforms/SimplifyCFG/convergent.ll
    M llvm/test/Transforms/SimplifyCFG/multiple-phis.ll
    M llvm/test/Transforms/SimplifyCFG/no-md-sink.ll
    M llvm/test/Transforms/SimplifyCFG/preserve-llvm-loop-metadata.ll
    M llvm/test/Transforms/SimplifyCFG/rangereduce.ll
    M llvm/test/Transforms/SimplifyCFG/switch-dead-default.ll
    M llvm/test/Transforms/SimplifyCFG/switch_undef.ll
    M llvm/test/Transforms/SimplifyCFG/unprofitable-pr.ll
    M llvm/test/Transforms/SimplifyCFG/wc-widen-block.ll
    M llvm/tools/bugpoint/CrashDebugger.cpp

  Log Message:
  -----------
  [NewPM] Consistently use 'simplifycfg' rather than 'simplify-cfg'

There was an alias between 'simplifycfg' and 'simplify-cfg' in the
PassRegistry. That was the original reason for this patch, which
effectively removes the alias.

This patch also replaces all occurrances of 'simplify-cfg'
by 'simplifycfg'. Reason for choosing that form for the name is
that it matches the DEBUG_TYPE for the pass, and the legacy PM name
and also how it is spelled out in other passes such as
'loop-simplifycfg', and in other options such as
'simplifycfg-merge-cond-stores'.

I for some reason the name should be changed to 'simplify-cfg' in
the future, then I think such a renaming should be more widely done
and not only impacting the PassRegistry.

Reviewed By: aeubanks

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


  Commit: 1db2551cc1a356a67c0967f424d6158e2ea127e3
      https://github.com/llvm/llvm-project/commit/1db2551cc1a356a67c0967f424d6158e2ea127e3
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2021-07-09 (Fri, 09 Jul 2021)

  Changed paths:
    M llvm/lib/Passes/PassRegistry.def
    M llvm/test/Analysis/MemorySSA/update-remove-dead-blocks.ll
    M llvm/test/Other/print-before-after.ll
    M llvm/test/Other/print-passes.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/basictest-profmd.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/basictest.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/dead-blocks-uses-in-unreachablel-blocks.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/delete-dead-blocks.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/endless-unswitch.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested2.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch2.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/exponential-switch-unswitch.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/guards.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/implicit-null-checks.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/msan.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-cost.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-redundant-switch.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/not-safe-to-clone.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/partial-unswitch-mssa-threshold.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/partial-unswitch-update-memoryssa.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/partial-unswitch.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-iteration.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-profmd.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/update-scev.ll

  Log Message:
  -----------
  [NewPM] Rename 'unswitch' to 'simple-loop-unswitch' in PassRegistry

It is confusing to have two ways of specifying the same pass
('simple-loop-unswitch' and 'unswitch'). This patch replaces
'unswitch' by 'simple-loop-unswitch' to get a unique identifier.

Using 'simple-loop-unswitch' instead of 'unswitch' also has the
advantage of matching how the pass is named in DEBUG_TYPE etc. So
this makes it a bit more consistent how we refer to the pass in
options such as -passes, -print-after and -debug-only.

Reviewed By: aeubanks

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


Compare: https://github.com/llvm/llvm-project/compare/88326bbce38c...1db2551cc1a3


More information about the All-commits mailing list