1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/Transforms/IndVarSimplify
Florian Hahn df7e45dd98 [SCEV] By more careful when traversing phis in isImpliedViaMerge.
I think currently isImpliedViaMerge can incorrectly return true for phis
in a loop/cycle, if the found condition involves the previous value of

Consider the case in exit_cond_depends_on_inner_loop.

At some point, we call (modulo simplifications)
isImpliedViaMerge(<=, %x.lcssa, -1, %call, -1).

The existing code tries to prove IncV <= -1 for all incoming values
InvV using the found condition (%call <= -1). At the moment this succeeds,
but only because it does not compare the same runtime value. The found
condition checks the value of the last iteration, but the incoming value
is from the *previous* iteration.

Hence we incorrectly determine that the *previous* value was <= -1,
which may not be true.

I think we need to be more careful when looking at the incoming values
here. In particular, we need to rule out that a found condition refers to
any value that may refer to one of the previous iterations. I'm not sure
there's a reliable way to do so (that also works of irreducible control
flow).

So for now this patch adds an additional requirement that the incoming
value must properly dominate the phi block. This should ensure the
values do not change in a cycle. I am not entirely sure if will catch
all cases and I appreciate a through second look in that regard.

Alternatively we could also unconditionally bail out in this case,
instead of checking the incoming values

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D101829
2021-05-07 19:52:29 +01:00
..
AMDGPU Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
ARM [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03:00
NVPTX Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
X86 [PassManager] Run additional LICM before LoopRotate 2021-04-02 11:11:42 +03: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-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 [SCEV] Add false->any implication 2021-03-19 11:29:48 +07:00
2011-11-01-lftrptr.ll Reland [SCEV] Improve modelling for (null) pointer constants 2021-03-13 16:05:34 +03: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 [NewPM][LoopUnswitch] Pin loop-unswitch to legacy PM or use simple-loop-unswitch 2020-08-06 10:56:00 -07:00
2020-12-15-trunc-bug-expensive-range-inference.ll [SCEV] Add missing type check into getRangeForAffineNoSelfWrappingAR 2020-12-15 14:50:32 +07:00
ada-loops.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
addrec_no_exec_on_every_iteration.ll Return "[SCEV] Prove implicaitons via AddRec start" 2020-10-08 11:15:35 +07:00
ashr-expansion.ll Revert "[SCEV] Model ashr exact x, C as (abs(x) EXACT/u (1<<C)) * signum(x)" 2021-04-18 16:26:45 +03: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 [Test] Auto-generated checks for some IndVarSimplify tests 2020-09-08 11:15:40 +07:00
casted-argument.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
checks_against_min_value.ll [IndVars] Provide eliminateIVComparison with context 2021-03-19 12:28:22 +07:00
const_phi.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
constant-fold.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 "[SCEV] rewriteLoopExitValues(): even if have hard uses, still rewrite if cheap (PR44668)" 2020-04-03 20:15:04 +03:00
drop-exact.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
elim-extend.ll [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03:00
eliminate-comparison.ll [IndVars] Sharpen context in eliminateIVComparison 2021-03-22 11:55:57 +07:00
eliminate-exit-no-dl.ll [IndVars] Fix a subtle bug in optimizeLoopExits 2019-07-23 17:45:11 +00:00
eliminate-exit.ll [SCEV] By more careful when traversing phis in isImpliedViaMerge. 2021-05-07 19:52:29 +01:00
eliminate-max.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
eliminate-overflow-modified.ll [IndVarSimplify] Fix Modified status for removal of overflow intrinsics 2020-09-29 13:20:59 +02: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
exit_value_test2.ll [LoopDeletion] Break backedge of outermost loops when known not taken 2021-01-10 16:02:33 -08: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 [SimplifyCFG] MergeBlockIntoPredecessor() already knows how to preserve DomTree 2020-12-17 01:03:49 +03:00
floating-point-iv.ll [SCEV] Drop cached ranges of AddRecs after flag update 2020-11-10 12:37:12 +07:00
full_widening.ll [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03:00
indirectbr.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
infer-poison-flags.ll [Test] Auto-update for some tests 2020-10-14 17:03:33 +07:00
interesting-invoke-use.ll OpaquePtr: Update more tests to use typed sret 2020-11-20 20:08:43 -05: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 [IndVarSimplify] Extend previous special case for load use instruction to any narrow type loop variant to avoid extra trunc instruction 2020-03-05 16:27:59 -05:00
iv-zext.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
lcssa-preservation.ll [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03:00
lftr_disabled.ll [IndVarSimplify] Generate full checks for some LFTR tests; NFC 2019-04-20 12:05:53 +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 [Test] Auto-update for some tests 2020-10-14 17:03:33 +07:00
lftr-multi-exit.ll [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03:00
lftr-pr20680.ll [LoopPred] Selectively disable to preserve test cases 2019-11-06 15:41:57 -08:00
lftr-pr31181.ll [Test] Auto-update for some tests 2020-10-14 17:03:33 +07: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 [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03:00
lftr.ll [IndVars] avoid crash in LFTR when assuming an add recurrence 2021-04-27 08:26:02 -04: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 OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05: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] Teach FoldTwoEntryPHINode() to preserve DomTree 2020-12-20 00:18:33 +03:00
loop_evaluate_2.ll [SimplifyCFG] Teach FoldTwoEntryPHINode() to preserve DomTree 2020-12-20 00:18:33 +03: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
loop-predication.ll [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03:00
lrev-existing-umin.ll Revert "[SCEV] rewriteLoopExitValues(): even if have hard uses, still rewrite if cheap (PR44668)" 2020-04-03 20:15:04 +03:00
masked-iv.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
monotonic_checks.ll Return "[IndVars] Remove monotonic checks with unknown exit count" 2020-10-28 18:51:40 +07:00
no-iv-rewrite.ll [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03:00
phi-uses-value-multiple-times.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 [Test] Auto-generated checks for some IndVarSimplify tests 2020-09-08 11:15:40 +07:00
pr22222.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
pr24952.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
pr25578.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
pr28705.ll Revert "[SCEV] rewriteLoopExitValues(): even if have hard uses, still rewrite if cheap (PR44668)" 2020-04-03 20:15:04 +03:00
pr32045.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr38674.ll [LoopPred] Selectively disable to preserve test cases 2019-11-06 15:41:57 -08:00
pr38855.ll [FunctionAttrs] Rename functionattrs -> function-attrs 2020-07-28 09:09:13 -07:00
pr39673.ll Revert "[SCEV] rewriteLoopExitValues(): even if have hard uses, still rewrite if cheap (PR44668)" 2020-04-03 20:15:04 +03:00
pr40454.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr45835.ll [IndVarSimplify][LoopUtils] Avoid TOCTOU/ordering issues (PR45835) 2020-05-21 13:05:55 +03:00
predicated_ranges.ll [IndVars] Use isLoopBackedgeGuardedByCond for last iteration check 2020-11-26 12:37:21 +07:00
preserve-memoryssa.ll [IndVarSimplify] Fix for MemorySSA preserve. 2020-01-23 11:06:16 -08: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 [IndVarSimplify] Add additional tests using isImpliedViaMerge. 2021-05-04 13:11:47 +01:00
replace-loop-exit-folds.ll [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03: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
rewrite-loop-exit-values-phi.ll [IndVarSimplify] Fix Modified status when handling dead PHI nodes 2020-11-26 14:28:21 +01:00
rlev-add-me.ll [IndVars] Fix a bug noticed by inspection 2019-08-23 04:03:23 +00:00
scev-expander-preserve-lcssa.ll [test] Fix scev-expander-preserve-lcssa.ll under NPM 2020-12-10 09:46:08 -08:00
scevexpander-phi-base-case.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
sentinel.ll [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03:00
shared-exit-between-nested-loop.ll [IndVarSimplify] Notify top most loop to drop cached exit counts 2020-11-19 15:37:54 +08:00
sharpen-range.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
shrunk-constant.ll [test] Fix shrunk-constant.ll under NPM 2020-10-21 21:21:24 -07:00
signed-trip-count.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
simplify-pointer-arithmetic.ll [IndVars] Add test cases inspired by PR48965. 2021-02-25 15:54:18 +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 [LoopPred] Selectively disable to preserve test cases 2019-11-06 15:41:57 -08: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 [NFCI][SimplifyCFG] Mark all the SimplifyCFG tests that already don't invalidate DomTree as such 2020-12-17 01:03:49 +03:00
trivial-checks.ll [Test] Add tests showing that IndVars cannot prove (X + 1 > X) 2020-09-17 22:37:43 +07:00
trivial-guard.ll [SCEV] Add false->any implication 2021-03-19 11:29:48 +07: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
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
widen-i32-i8ptr.ll Reland [SCEV] Improve modelling for (null) pointer constants 2021-03-13 16:05:34 +03:00
widen-loop-comp.ll [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03:00
zext-nuw.ll [IndVars] Regenerate test checks (NFC) 2020-11-02 22:31:11 +01:00