llvm-project/llvm/test/Transforms/SimplifyCFG
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
..
AArch64
AMDGPU
ARM
Hexagon
Mips
PowerPC
RISCV
SPARC
X86 [SimplifyCFG] 'merge compatible invokes': fully support indirect invokes 2022-02-08 21:29:38 +03:00
1elt-ptr-vec-alignment-crash.ll
2002-05-21-PHIElimination.ll
2002-09-24-PHIAssertion.ll
2003-03-07-DominateProblem.ll
2003-08-05-InvokeCrash.ll
2003-08-17-BranchFold.ll
2003-08-17-BranchFoldOrdering.ll
2003-08-17-FoldSwitch-dbg.ll
2003-08-17-FoldSwitch.ll
2004-12-10-SimplifyCFGCrash.ll
2005-06-16-PHICrash.ll
2005-08-01-PHIUpdateFail.ll
2005-10-02-InvokeSimplify.ll
2005-12-03-IncorrectPHIFold.ll
2006-02-17-InfiniteUnroll.ll
2006-06-12-InfLoop.ll
2006-08-03-Crash.ll
2006-10-19-UncondDiv.ll
2006-12-08-Ptr-ICmp-Branch.ll
2007-11-22-InvokeNoUnwind.ll
2007-12-21-Crash.ll
2008-01-02-hoist-fp-add.ll
2008-05-16-PHIBlockMerge.ll
2008-07-13-InfLoopMiscompile.ll
2008-09-08-MultiplePred.ll
2008-09-17-SpeculativeHoist.ll
2008-10-03-SpeculativelyExecuteBeforePHI.ll
2008-12-06-SingleEntryPhi.ll
2008-12-16-DCECond.ll
2009-01-18-PHIPropCrash.ll
2009-05-12-externweak.ll
2011-03-08-UnreachableUse.ll
2011-09-05-TrivialLPad.ll
BrUnwind.ll
ConditionalTrappingConstantExpr.ll
DeadSetCC.ll [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
EmptyBlockMerge.ll
EqualPHIEdgeBlockMerge.ll [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
FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase-2.ll
FoldValueComparisonIntoPredecessors-domtree-preservation-edgecase.ll
FoldValueComparisonIntoPredecessors-no-new-successors.ll [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
ForwardSwitchConditionToPHI.ll [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
HoistCode.ll
InfLoop.ll
PHINode.ll
PR9946.ll
PR16069.ll
PR17073.ll
PR25267.ll
PR27615-simplify-cond-br.ll
PhiBlockMerge.ll
PhiBlockMerge2.ll
PhiEliminate.ll
PhiEliminate2.ll
PhiEliminate3.ll
PhiNoEliminate.ll
SimplifyEqualityComparisonWithOnlyPredecessor-domtree-preservation-edgecase.ll
SimplifyTerminatorOnSelect-domtree-preservation-edgecase.ll
UncondBranchToHeader.ll
UncondBranchToReturn.ll
UnreachableEliminate.ll Revert "[SimplifyCFG] Start redesigning `FoldTwoEntryPHINode()`." 2022-02-03 12:32:50 +03:00
annotations.ll
assume.ll
attr-convergent.ll
attr-noduplicate.ll
basictest.ll
bbi-23595.ll Revert "[SimplifyCFG] Start redesigning `FoldTwoEntryPHINode()`." 2022-02-03 12:32:50 +03:00
branch-cond-merge.ll
branch-cond-prop.ll
branch-fold-dbg.ll [Test] Regenerate checks using auto-update script 2021-10-28 15:13:43 +07:00
branch-fold-test.ll
branch-fold-three.ll
branch-fold-threshold.ll
branch-fold.ll
branch-phi-thread.ll
callbr-destinations.ll [llvm][test] rewrite callbr to use i rather than X constraint NFC 2022-01-11 11:31:08 -08:00
change-to-unreachable-matching-successor.ll
clamp.ll
cleanup-phis.ll
common-code-hoisting.ll
common-dest-folding.ll
commondest-loopid.ll
constantexprs.ll
convergent.ll
dbginfo.ll
dce-cond-after-folding-terminator.ll
debug-info-thread-phi.ll
div-rem-pairs.ll
drop-debug-loc-when-speculating.ll
duplicate-landingpad.ll
duplicate-phis.ll
empty-catchpad.ll
extract-cost.ll
fold-branch-to-common-dest-free-cost.ll [SimplifyCFG] Ignore free instructions when computing cost for folding branch to common dest 2021-09-22 09:52:37 -07:00
fold-branch-to-common-dest-two-preds-cost.ll
fold-branch-to-common-dest.ll [SimplifyCFG] performBranchToCommonDestFolding(): require block-closed SSA form for bonus instructions (PR51125) 2021-09-09 12:28:09 +03:00
fold-debug-info.ll
fold-debug-location.ll
fold-two-entry-phi-node-with-one-block-profmd.ll
fold-two-entry-phi-node-with-two-blocks-profmd.ll
gepcost.ll
guards.ll
hoist-common-code.ll
hoist-dbgvalue-inlined.ll
hoist-dbgvalue.ll
hoist-from-addresstaken-block.ll
hoist-with-range.ll
implied-and-or.ll
implied-cond-matching-false-dest.ll
implied-cond-matching-imm.ll
implied-cond-matching.ll
implied-cond.ll
indirectbr.ll
inline-asm-sink.ll
invoke.ll Reland [SimplifyCFG] `markAliveBlocks()`: recognize that normal dest of `invoke`d `noreturn` function is `unreachable` 2022-02-05 02:58:19 +03:00
invoke_unwind.ll
invoke_unwind_lifetime.ll
iterative-simplify.ll
lifetime-landingpad.ll
lifetime.ll
merge-cond-stores-2.ll Revert "[SimplifyCFG] Start redesigning `FoldTwoEntryPHINode()`." 2022-02-03 12:32:50 +03:00
merge-cond-stores.ll
merge-default.ll
merge-deopt-bundle-constants.ll [Test] Add test demonstating how deopt bundle constants may be merged into instruction 2022-02-15 20:28:41 +07:00
merge-duplicate-conditional-ret-val.ll
merge-empty-return-blocks.ll
multiple-phis.ll
no-md-sink.ll Revert "[SimplifyCFG] Start redesigning `FoldTwoEntryPHINode()`." 2022-02-03 12:32:50 +03:00
no_speculative_loads_with_asan.ll
no_speculative_loads_with_tsan.ll
nomerge.ll
noreturn-call.ll
opaque-ptr.ll [IR] Check GEP source type when comparing instructions 2022-02-11 12:32:04 +01:00
opt-for-fuzzing.ll
phi-to-select-constexpr-icmp.ll
phi-undef-loadstore.ll
poison-merge.ll
pr33605.ll
pr34131.ll
pr35774.ll
pr39807.ll
pr46638.ll
pr48641.ll [NFC] Added testcase for PR48641 2021-09-04 10:44:39 +02:00
pr48778-sdiv-speculation.ll
pr50060-constantfold-loopid.ll
pr52290.ll [Test] Add test for PR52290 2021-10-25 18:25:59 +07:00
preserve-branchweights-partial.ll
preserve-branchweights-switch-create.ll
preserve-branchweights.ll [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
preserve-llvm-loop-metadata.ll
preserve-load-metadata-2.ll
preserve-load-metadata-3.ll
preserve-load-metadata.ll
preserve-make-implicit-on-switch-to-br.ll
preserve-store-alignment.ll Revert "[SimplifyCFG] Start redesigning `FoldTwoEntryPHINode()`." 2022-02-03 12:32:50 +03:00
rangereduce.ll
return-merge.ll
safe-abs.ll
seh-nounwind.ll
select-gep.ll
signbit-like-value-extension.ll
simplifyUnreachable-degenerate-conditional-branch-with-matching-destinations.ll
sink-inf-loop.ll
speculate-call.ll
speculate-dbgvalue.ll
speculate-math.ll
speculate-store-opaque-pointer.ll [OpaquePtr] Forbid mixing typed and opaque pointers 2021-09-10 15:18:23 +02:00
speculate-store.ll [OpaquePtr] Forbid mixing typed and opaque pointers 2021-09-10 15:18:23 +02:00
speculate-vector-ops-inseltpoison.ll
speculate-vector-ops.ll
speculate-with-offset.ll
speculatively-execute-block-profmd.ll
statepoint-invoke-unwind.ll [Statepoint] Update gc.statepoint calls in tests with elementtype (NFC) 2022-02-04 14:15:41 +01:00
suppress-zero-branch-weights.ll
switch-dead-default.ll [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
switch-masked-bits.ll
switch-on-const-select.ll
switch-profmd.ll
switch-range-to-icmp.ll [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
switch-simplify-crash.ll
switch-to-br.ll
switch-to-icmp.ll [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
switch-to-select-multiple-edge-per-block-phi.ll
switch-to-select-two-case.ll
switchToSelect-domtree-preservation-edgecase.ll
switch_create-custom-dl.ll [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
switch_create.ll [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
switch_msan.ll
switch_switch_fold.ll
switch_thread.ll
switch_ub.ll [SimplifyCFG] Redirect switch cases that lead to UB into an unreachable block 2021-09-21 10:45:19 +07:00
switch_undef.ll
tail-merge-assert.ll
tail-merge-noreturn.ll
tail-merge-resume.ll
tautological-conditional-branch.ll [SimplifyCFG] Preserve knowledge about guarding condition by adding assume 2021-09-08 14:05:17 +07:00
trap-debugloc.ll
trap-no-null-opt-debugloc.ll
trapping-load-unreachable.ll
two-entry-phi-fold-crash.ll
two-entry-phi-node.ll
two-entry-phi-return.ll
undef_phi.ll [Test] Add test showing missing simplifycfg opportunity for Phi with undef inputs 2021-10-28 11:23:07 +07:00
unprofitable-pr.ll [CodeMetrics] Don't require speculatability for ephemeral values 2021-10-21 20:30:01 +02:00
unreachable-cleanuppad.ll
unreachable-matching-successor.ll
unreachable-selfloop.ll
unreachable_assume.ll
unsigned-multiplication-will-overflow.ll
volatile-phioper.ll
wc-widen-block.ll
wineh-unreachable.ll