llvm-project/llvm/test/Transforms/IndVarSimplify
Philip Reames 8cbcd2f484 [IndVars] Eliminate loop exits with equivalent exit counts
We can end up with two loop exits whose exit counts are equivalent, but whose textual representation is different and non-obvious. For the sub-case where we have a series of exits which dominate one another (common), eliminate any exits which would iterate *after* a previous exit on the exiting iteration.

As noted in the TODO being removed, I'd always thought this was a good idea, but I've now seen this in a real workload as well.

Interestingly, in review, Nikita pointed out there's let another oppurtunity to leverage SCEV's reasoning.  If we kept track of the min of dominanting exits so far, we could discharge exits with EC >= MDE.  This is less powerful than the existing transform (since later exits aren't considered), but potentially more powerful for any case where SCEV can prove a >= b, but neither a == b or a > b.  I don't have an example to illustrate that oppurtunity, but won't be suprised if we find one and return to handle that case as well.  

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

llvm-svn: 375379
2019-10-20 23:38:02 +00:00
..
AMDGPU Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
NVPTX Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2002-09-09-PointerIndVar.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2003-04-16-ExprAnalysis.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2003-09-23-NotAtTop.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2003-12-10-RemoveInstrCrash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2003-12-15-Crash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2004-03-10-PHIInsertionBug.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2004-04-05-InvokeCastCrash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2004-04-07-ScalarEvolutionCrash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2005-02-11-InvokeCrash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2005-02-17-TruncateExprCrash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2005-02-26-ExitValueCompute.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2005-06-15-InstMoveCrash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2005-11-18-Crash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2006-03-31-NegativeStride.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2006-06-16-Indvar-LCSSA-Crash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2006-09-20-LFTR-Crash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2006-12-10-BitCast.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2007-01-06-TripCount.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2007-06-06-DeleteDanglesPtr.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2007-11-23-BitcastCrash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2008-06-15-SCEVExpanderBug.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2008-09-02-IVType.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2008-10-03-CouldNotCompute.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2008-11-25-APFloatAssert.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2009-04-14-shorten_iv_vars.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2009-04-15-shorten-iv-vars-2.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2009-04-22-IndvarCrash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2009-04-27-Floating.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2009-05-24-useafterfree.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2011-09-10-widen-nsw.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2011-09-19-vectoriv.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2011-09-27-hoistsext.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2011-10-27-lftrnull.ll Fix a bug w/inbounds invalidation in LFTR (recommit) 2019-06-17 20:32:22 +00:00
2011-11-01-lftrptr.ll [LFTR] Use SCEVExpander for the pointer limit case instead of manual IR gen 2019-07-03 20:03:46 +00:00
2011-11-15-multiexit.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2011-11-17-selfphi.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2012-10-19-congruent-constant.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2014-06-21-congruent-constant.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
ada-loops.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
ashr-tripcount.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
avoid-i0.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
backedge-on-min-max.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
bec-cmp.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
canonicalize-cmp.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
casted-argument.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
const_phi.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
constant-fold.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
constant_result.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
crash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
dangling-use.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
divide-pointer.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
dont-recompute.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
drop-exact.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
elim-extend.ll [LFTR] Hoist extend expressions outside of loops w/o waiting for LICM 2019-07-03 18:18:36 +00:00
eliminate-comparison.ll [IndVars] Remove dead instructions after folding trivial loop exit 2019-06-23 17:06:57 +00:00
eliminate-exit-no-dl.ll [IndVars] Fix a subtle bug in optimizeLoopExits 2019-07-23 17:45:11 +00:00
eliminate-exit.ll [IndVars] Eliminate loop exits with equivalent exit counts 2019-10-20 23:38:02 +00:00
eliminate-max.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
eliminate-rem.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
eliminate-sat.ll [SimplifyIndVar] Simplify non-overflowing saturating add/sub 2019-06-15 08:48:52 +00:00
eliminate-trunc.ll [IndVars] Remove dead instructions after folding trivial loop exit 2019-06-23 17:06:57 +00:00
exit_value_test2.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
exit_value_test3.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
exit_value_tests.ll Teach getSCEVAtScope how to handle loop phis w/invariant operands in loops w/taken backedges 2019-06-17 21:06:17 +00:00
floating-point-iv.ll [Tests] Add a few more tests for idioms with FP induction variables 2019-10-14 19:10:39 +00:00
full_widening.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
huge_muls.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
indirectbr.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
indvar-debug-value.ll [Debuginfo] dbg.value points to undef value after Induction Variable Simplification. 2019-09-24 08:47:03 +00:00
indvar-debug-value2.ll [Debuginfo] dbg.value points to undef value after Induction Variable Simplification. 2019-09-24 08:47:03 +00:00
infer-poison-flags.ll [Tests] Add poison inference tests for indvars showing both existing transforms, and some room for improvement 2019-06-05 18:00:59 +00:00
inner-loop-by-latch-cond.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
inner-loop.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
interesting-invoke-use.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
iterationCount_zext_or_trunc.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
iv-fold.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
iv-sext.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
iv-widen-elim-ext.ll [LFTR] Hoist extend expressions outside of loops w/o waiting for LICM 2019-07-03 18:18:36 +00:00
iv-widen.ll [LFTR] Hoist extend expressions outside of loops w/o waiting for LICM 2019-07-03 18:18:36 +00:00
iv-zext.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
lcssa-preservation.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
lftr-address-space-pointers.ll [LFTR] Use SCEVExpander for the pointer limit case instead of manual IR gen 2019-07-03 20:03:46 +00:00
lftr-dead-ivs.ll [LFTR] Use SCEVExpander for the pointer limit case instead of manual IR gen 2019-07-03 20:03:46 +00:00
lftr-multi-exit.ll [Tests] Add a tricky LFTR case for documentation purposes 2019-06-20 17:16:53 +00:00
lftr-pr20680.ll [IndVars, RLEV] Support rewriting exit values in loops without known exits (prep work) 2019-07-31 21:15:21 +00:00
lftr-pr31181.ll [IndVarSimplify] Fixup nowrap flags during LFTR (PR31181) 2019-06-01 09:40:18 +00:00
lftr-pr41998.ll [LFTR] Use SCEVExpander for the pointer limit case instead of manual IR gen 2019-07-03 20:03:46 +00:00
lftr-promote.ll [IndVarSimplify] Generate full checks for some LFTR tests; NFC 2019-04-20 12:05:53 +00:00
lftr-reuse.ll [LFTR] Use SCEVExpander for the pointer limit case instead of manual IR gen 2019-07-03 20:03:46 +00:00
lftr.ll [LFTR] Hoist extend expressions outside of loops w/o waiting for LICM 2019-07-03 18:18:36 +00:00
lftr_disabled.ll [IndVarSimplify] Generate full checks for some LFTR tests; NFC 2019-04-20 12:05:53 +00:00
loop-invariant-conditions.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
loop-predication.ll [IndVars] Eliminate loop exits with equivalent exit counts 2019-10-20 23:38:02 +00:00
loop_evaluate7.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
loop_evaluate8.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
loop_evaluate9.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
loop_evaluate10.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
loop_evaluate11.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
loop_evaluate_1.ll [SimplifyCFG] FoldTwoEntryPHINode(): consider *total* speculation cost, not per-BB cost 2019-09-16 16:18:24 +00:00
loop_evaluate_2.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
loop_evaluate_3.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
loop_evaluate_4.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
loop_evaluate_5.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
loop_evaluate_6.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
lrev-existing-umin.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
masked-iv.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
no-iv-rewrite.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
overflow-intrinsics.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
phi-uses-value-multiple-times.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
polynomial-expand.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
post-inc-range.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr18223.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr22222.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr24356.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr24783.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr24804.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr24952.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr24956.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr25047.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr25051.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr25060.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr25360.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr25421.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr25576.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr25578.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr26973.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr26974.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr27133.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr28935.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr32045.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr35406.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr38674.ll [IndVars] Eliminate loop exits with equivalent exit counts 2019-10-20 23:38:02 +00:00
pr38855.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr39673.ll Teach getSCEVAtScope how to handle loop phis w/invariant operands in loops w/taken backedges 2019-06-17 21:06:17 +00:00
pr40454.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
preserve-signed-wrap.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
promote-iv-to-eliminate-casts.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
replace-iv-with-loop-invariant.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
replace-loop-exit-folds.ll [SCEV] Add explicit representations of umin/smin 2019-05-07 15:28:47 +00:00
replace-sdiv-by-udiv.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
replace-srem-by-urem.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
rewrite-loop-exit-value.ll [IndVars] Extend reasoning about loop invariant exits to non-header blocks 2019-05-14 17:20:10 +00:00
rlev-add-me.ll [IndVars] Fix a bug noticed by inspection 2019-08-23 04:03:23 +00:00
scev-phi-debug-info.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
scevexpander-phi-base-case.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
sharpen-range.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
shrunk-constant.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
signed-trip-count.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
single-element-range.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
sink-alloca.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
sink-from-preheader.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
sink-trapping.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
strengthen-overflow.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
tripcount_compute.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
tripcount_infinite.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
udiv-invariant-but-traps.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
udiv.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
uglygep.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
ult-sub-to-eq.ll [LFTR] Hoist extend expressions outside of loops w/o waiting for LICM 2019-07-03 18:18:36 +00:00
use-range-metadata.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
variable-stride-ivs-0.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
variable-stride-ivs-1.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
verify-scev.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
widen-loop-comp.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
widen-nsw.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
zext-nuw.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00