[all-commits] [llvm/llvm-project] 371fcb: [SimplifyCFG][PhaseOrdering] Defer lowering switch...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Thu Feb 17 01:14:22 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 371fcb720e15906e8c63600253afcb806b9b10d0
      https://github.com/llvm/llvm-project/commit/371fcb720e15906e8c63600253afcb806b9b10d0
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2022-02-17 (Thu, 17 Feb 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/SimplifyCFGOptions.h
    M llvm/lib/Passes/PassBuilder.cpp
    M llvm/lib/Passes/PassBuilderPipelines.cpp
    M llvm/lib/Passes/PassRegistry.def
    M llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
    M llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
    M llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
    M llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Other/new-pm-print-pipeline.ll
    M llvm/test/Transforms/Coroutines/coro-catchswitch-cleanuppad.ll
    M llvm/test/Transforms/LoopUnroll/ARM/upperbound.ll
    M llvm/test/Transforms/PhaseOrdering/simplifycfg-switch-lowering-vs-correlatedpropagation.ll
    M llvm/test/Transforms/SimplifyCFG/DeadSetCC.ll
    M llvm/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll
    M llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-no-new-successors.ll
    M llvm/test/Transforms/SimplifyCFG/ForwardSwitchConditionToPHI.ll
    M llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll
    M llvm/test/Transforms/SimplifyCFG/switch-dead-default.ll
    M llvm/test/Transforms/SimplifyCFG/switch-range-to-icmp.ll
    M llvm/test/Transforms/SimplifyCFG/switch-to-icmp.ll
    M llvm/test/Transforms/SimplifyCFG/switch_create-custom-dl.ll
    M llvm/test/Transforms/SimplifyCFG/switch_create.ll

  Log Message:
  -----------
  [SimplifyCFG][PhaseOrdering] Defer lowering switch into an integer range comparison and branch until after at least the IPSCCP

That transformation is lossy, as discussed in
https://github.com/llvm/llvm-project/issues/53853
and https://github.com/rust-lang/rust/issues/85133#issuecomment-904185574

This is an alternative to D119839,
which would add a limited IPSCCP into SimplifyCFG.

Unlike lowering switch to lookup, we still want this transformation
to happen relatively early, but after giving a chance for the things
like CVP to do their thing. It seems like deferring it just until
the IPSCCP is enough for the tests at hand, but perhaps we need to
be more aggressive and disable it until CVP.

Fixes https://github.com/llvm/llvm-project/issues/53853
Refs. https://github.com/rust-lang/rust/issues/85133

Reviewed By: nikic

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




More information about the All-commits mailing list