llvm-project/llvm/lib/Transforms/Scalar
Roman Lebedev 371fcb720e
[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
2022-02-17 12:13:55 +03:00
..
ADCE.cpp [ADCE][NFC] Batch DT updates together 2022-01-05 14:05:20 -08:00
AlignmentFromAssumptions.cpp [AlignFromAssume] Bailout w/non-constant alignments (pr51680) 2021-08-31 09:20:52 -07:00
AnnotationRemarks.cpp
BDCE.cpp [APInt] Stop using soft-deprecated constructors and methods in llvm. NFC. 2021-10-04 08:57:44 +01:00
CMakeLists.txt Add jump-threading optimization for deterministic finite automata 2021-07-27 14:34:04 -04:00
CallSiteSplitting.cpp [llvm] Use llvm::reverse (NFC) 2021-11-06 19:31:18 -07:00
ConstantHoisting.cpp [ConstantHoist] Remove check for notional overindexing 2022-01-19 11:32:10 +01:00
ConstraintElimination.cpp [ConstraintElimination] Support add with precondition. 2022-02-11 20:26:25 +00:00
CorrelatedValuePropagation.cpp [CVP] Extract helper from phi processing (NFC) 2022-02-14 10:51:34 +01:00
DCE.cpp
DFAJumpThreading.cpp [DFAJumpThreading] make update order deterministic 2022-02-01 11:02:58 -05:00
DeadStoreElimination.cpp [DSE] Fall back to CFG scan for unreachable terminators. 2022-02-16 14:06:40 +00:00
DivRemPairs.cpp [DivRemPairs] make sure we have a valid CFG for hoisting division 2021-07-28 11:09:12 -04:00
EarlyCSE.cpp [EarlyCSE] Support opaque pointers 2022-01-06 17:08:50 +01:00
FlattenCFGPass.cpp [NewPM] Port FlattenCFGPass to NPM 2021-12-09 07:55:02 +00:00
Float2Int.cpp [Transforms] Use {DenseSet,SetVector,SmallPtrSet}::contains (NFC) 2021-10-31 07:57:32 -07:00
GVN.cpp [GVN] Store source element type for GEP expressions 2022-02-11 13:03:30 +01:00
GVNHoist.cpp [NFC] Rename GVN -> GVNPass and SROA -> SROAPass 2021-11-09 10:35:58 -08:00
GVNSink.cpp
GuardWidening.cpp [ConstantRange] Add exact union/intersect (NFC) 2021-11-07 21:46:06 +01:00
IVUsersPrinter.cpp
IndVarSimplify.cpp [llvm] Remove unused forward declarations (NFC) 2022-01-07 20:00:34 -08:00
InductiveRangeCheckElimination.cpp
InferAddressSpaces.cpp [InferAddressSpaces] Fix assert on invalid cast ordering 2022-02-11 10:02:30 -08:00
InstSimplifyPass.cpp
JumpThreading.cpp [JumpThreading] Change asserts for WantInteger into actual checks 2022-01-14 11:15:14 -08:00
LICM.cpp [LICM] Generalize unwinding check during scalar promotion 2022-01-26 11:15:03 +01:00
LoopAccessAnalysisPrinter.cpp
LoopBoundSplit.cpp [Transforms] Use default member initialization in ConditionInfo (NFC) 2022-02-13 10:34:00 -08:00
LoopDataPrefetch.cpp [Transforms] Use default member initialization in Prefetch (NFC) 2022-02-13 10:34:02 -08:00
LoopDeletion.cpp [LoopDeletion] Add back statistic update lost in 523573e 2022-01-17 12:20:51 -08:00
LoopDistribute.cpp [PSE] Remove assumption that top level predicate is union from public interface [NFC*] 2022-02-10 16:14:52 -08:00
LoopFlatten.cpp [LoopFlatten] Address FIXME about getTripCountFromExitCount. NFC. 2022-01-24 13:46:19 +00:00
LoopFuse.cpp [LoopFuse] Change DT to reference in FusionCandidate struct. NFC 2022-02-02 14:55:37 -05:00
LoopIdiomRecognize.cpp [Transforms] Use default member initialization in MemmoveVerifier (NFC) 2022-02-13 10:34:03 -08:00
LoopInstSimplify.cpp [Scalar] Use make_early_inc_range (NFC) 2021-09-12 08:17:18 -07:00
LoopInterchange.cpp [LoopInterchange] Support loop interchange with floating point reductions 2022-02-06 17:04:47 -05:00
LoopLoadElimination.cpp [PSE] Remove assumption that top level predicate is union from public interface [NFC*] 2022-02-10 16:14:52 -08:00
LoopPassManager.cpp [NPM] Fix LoopNestPasses in -print-pipeline-passes 2021-12-01 07:57:17 +01:00
LoopPredication.cpp [llvm] Use = default (NFC) 2022-02-06 22:18:35 -08:00
LoopRerollPass.cpp LoopReroll::isLoopControlIV - use cast<> instead of dyn_cast<> to avoid dereference of nullptr 2022-02-11 10:19:25 +00:00
LoopRotation.cpp [MemorySSA] Remove -enable-mssa-loop-dependency option 2021-08-16 20:59:37 +02:00
LoopSimplifyCFG.cpp [BasicBlockUtils] Fix typo in API name (NFC) 2022-01-28 16:32:13 +01:00
LoopSink.cpp [Transforms] Use make_early_inc_range (NFC) 2021-11-02 18:13:23 -07:00
LoopStrengthReduce.cpp Reduce dependencies on llvm/BinaryFormat/Dwarf.h 2022-02-04 11:44:03 +01:00
LoopUnrollAndJamPass.cpp [BasicTTIImpl][LoopUnroll] getUnrollingPreferences(): emit ORE remark when advising against unrolling due to a call in a loop 2021-08-03 00:57:26 +03:00
LoopUnrollPass.cpp [LoopPeel] Use reference instead of pointer for DT argument 2022-02-01 17:00:08 -05:00
LoopUnswitch.cpp [Analysis, Target, Transforms] Construct SmallVector with iterator ranges (NFC) 2021-09-07 09:19:33 -07:00
LoopVersioningLICM.cpp
LowerAtomic.cpp
LowerConstantIntrinsics.cpp [LowerConstantIntrinsics] Fix heap-use-after-free bug in worklist 2021-09-21 11:33:07 +02:00
LowerExpectIntrinsic.cpp [LowerExpectIntrinsic] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr. NFC 2022-01-10 15:34:37 +00:00
LowerGuardIntrinsic.cpp
LowerMatrixIntrinsics.cpp [MatrixBuilder] Remove unnecessary IRBuilder template (NFC) 2022-02-07 16:42:38 +01:00
LowerWidenableCondition.cpp
MakeGuardsExplicit.cpp
MemCpyOptimizer.cpp [MemCpyOpt] Use helper for unwind check 2022-01-26 12:43:31 +01:00
MergeICmps.cpp [MergeICmps] Remove unused NumMerged variable 2021-09-21 21:43:25 +02:00
MergedLoadStoreMotion.cpp [NPM] Added -print-pipeline-passes print params for a few passes. 2021-09-15 08:34:04 +02:00
NaryReassociate.cpp [NARY-REASSOCIATE][NFC] Simplify min/max handling 2021-10-21 15:45:53 +07:00
NewGVN.cpp [NewGVN] do phi(undef, x) -> x only if x is not poison 2022-01-29 21:43:57 +00:00
PartiallyInlineLibCalls.cpp [PartiallyInlineLibCalls] Don't crash when there's a writeonly attribute on the call 2022-01-05 12:16:26 +01:00
PlaceSafepoints.cpp
Reassociate.cpp [llvm] Use range-based for loops (NFC) 2021-11-28 18:14:49 -08:00
Reg2Mem.cpp
RewriteStatepointsForGC.cpp [IRBuilder][RS4GC] Require FunctionCallee when creating statepoint 2022-02-04 09:47:32 +01:00
SCCP.cpp Introduce the AttributeMask class 2022-01-04 15:37:46 +01:00
SROA.cpp Simplify mask creation with llvm::seq. NFCI. 2022-02-05 23:35:41 +01:00
Scalar.cpp [NewPM] Port FlattenCFGPass to NPM 2021-12-09 07:55:02 +00:00
ScalarizeMaskedMemIntrin.cpp [LoopVectorize] Pass a vector type to isLegalMaskedGather/Scatter 2022-01-12 13:34:12 +00:00
Scalarizer.cpp [NFC] Remove uses of PointerType::getElementType() 2022-01-25 09:44:52 +01:00
SeparateConstOffsetFromGEP.cpp [llvm] Use llvm::reverse (NFC) 2021-12-13 21:54:51 -08:00
SimpleLoopUnswitch.cpp [SimpleLoopUnswitch] Remove duplicate include. 2021-11-02 15:22:41 +01:00
SimplifyCFGPass.cpp [SimplifyCFG][PhaseOrdering] Defer lowering switch into an integer range comparison and branch until after at least the IPSCCP 2022-02-17 12:13:55 +03:00
Sink.cpp
SpeculativeExecution.cpp [Transforms] Use {DenseSet,SetVector,SmallPtrSet}::contains (NFC) 2021-10-31 07:57:32 -07:00
StraightLineStrengthReduce.cpp [ADT] Add APInt::isNegatedPowerOf2() helper 2021-10-19 14:38:21 +01:00
StructurizeCFG.cpp [StructurizeCFG] Clean up some boolean not instructions 2022-02-01 09:35:37 +00:00
TailRecursionElimination.cpp [IR] Define "ptrauth" operand bundle. 2022-02-14 11:27:35 -08:00
WarnMissedTransforms.cpp