llvm-project/llvm/test/Transforms/LoopStrengthReduce
Wei Mi 493fb266ed [LSR] Prevent formula with SCEVAddRecExpr type of Reg from Sibling loops
In rL294814, we allow formula with SCEVAddRecExpr type of Reg from loops
other than current loop. This is good for the case when induction variable
of outerloop being used in expr in innerloop. But it is very bad to allow
such Reg from sibling loop because we may need to add lsr.iv in other sibling
loops when scev expanding those SCEVAddRecExpr type exprs. For the testcase
below, one loop can be inserted with a bunch of lsr.iv because of LSR for
other loops. 

// The induction variable j from a loop in the middle will have initial
// value generated from previous sibling loop and exit value used by its
// next sibling loop.
void goo(long i, long j); 
long cond; 

void foo(long N) { 
long i = 0; 
long j = 0; 
i = 0; do { goo(i, j); i++; j++; } while (cond); 
i = 0; do { goo(i, j); i++; j++; } while (cond); 
i = 0; do { goo(i, j); i++; j++; } while (cond); 
i = 0; do { goo(i, j); i++; j++; } while (cond); 
i = 0; do { goo(i, j); i++; j++; } while (cond); 
i = 0; do { goo(i, j); i++; j++; } while (cond); 
} 

The fix is to only allow formula with SCEVAddRecExpr type of Reg from current
loop or its parents.

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

llvm-svn: 295378
2017-02-16 21:27:31 +00:00
..
AArch64 Reapply [LSR] Create fewer redundant instructions. 2016-06-06 19:10:46 +00:00
AMDGPU [LSR] Pointers with different address spaces are considered incompatible. 2017-02-14 06:37:42 +00:00
ARM [ARM] Loop Strength Reduction crashes when targeting ARM or Thumb. 2016-11-09 08:53:07 +00:00
NVPTX [NVPTX] truncating 64-bit to 32-bit is free 2015-08-20 20:59:02 +00:00
X86 [LSR] Prevent formula with SCEVAddRecExpr type of Reg from Sibling loops 2017-02-16 21:27:31 +00:00
2005-08-15-AddRecIV.ll
2005-08-17-OutOfLoopVariant.ll
2005-09-12-UsesOutOutsideOfLoop.ll
2007-04-23-UseIterator.ll
2008-08-13-CmpStride.ll [opaque pointer type] Add textual IR support for explicit type parameter to the call instruction 2015-04-16 23:24:18 +00:00
2008-09-09-Overflow.ll [opaque pointer type] Add textual IR support for explicit type parameter to the call instruction 2015-04-16 23:24:18 +00:00
2009-01-13-nonconstant-stride-outside-loop.ll [opaque pointer type] Add textual IR support for explicit type parameter to the call instruction 2015-04-16 23:24:18 +00:00
2009-04-28-no-reduce-mul.ll
2011-07-19-CritEdgeBreakCrash.ll
2011-10-03-CritEdgeMerge.ll
2011-10-06-ReusePhi.ll [LSR] canonicalize Prod*(1<<C) to Prod<<C 2015-06-24 19:28:40 +00:00
2011-10-13-SCEVChain.ll
2011-10-14-IntPtr.ll
2011-12-19-PostincQuadratic.ll
2012-01-02-nopreheader.ll
2012-01-16-nopreheader.ll
2012-03-15-nopreheader.ll
2012-03-26-constexpr.ll
2012-07-13-ExpandUDiv.ll
2012-07-18-LimitReassociate.ll [opaque pointer type] Add textual IR support for explicit type parameter to the call instruction 2015-04-16 23:24:18 +00:00
2013-01-05-IndBr.ll
2013-01-14-ReuseCast.ll
addrec-gep-address-space.ll
addrec-gep.ll
address-space-loop.ll
count-to-zero.ll
dead-phi.ll
different-type-ivs.ll [opaque pointer type] Add textual IR support for explicit type parameter to the call instruction 2015-04-16 23:24:18 +00:00
dominate-assert.ll Move the personality function from LandingPadInst to Function 2015-06-17 20:52:32 +00:00
dont-hoist-simple-loop-constants.ll
dont_insert_redundant_ops.ll
dont_reduce_bytes.ll
dont_reverse.ll
ephemeral.ll [LSR] don't attempt to promote ephemeral values to indvars 2015-07-13 03:28:53 +00:00
exit_compare_live_range.ll
funclet.ll [LoopStrengthReduce] Don't rewrite PHIs with incoming values from CatchSwitches 2016-02-03 21:30:34 +00:00
hoist-parent-preheader.ll
invariant_value_first.ll
invariant_value_first_arg.ll
ivchain.ll [PM] Convert Loop Strength Reduce pass to new PM 2016-07-18 21:41:50 +00:00
lsr-expand-quadratic.ll
negative-scale.ll [NoTTI] reject negative scale in addressing mode 2015-05-08 18:07:24 +00:00
nested-reduce.ll
nonlinear-postinc.ll
ops_after_indvar.ll
phi_node_update_multiple_preds.ll
post-inc-icmpzero.ll [SCEV] Try to reuse existing value during SCEV expansion 2016-02-04 01:27:38 +00:00
post-inc-optsize.ll [LSR] Don't try and create post-inc expressions on non-rotated loops 2016-08-15 07:53:03 +00:00
pr2537.ll
pr2570.ll
pr3086.ll
pr3399.ll
pr3571.ll
pr12018.ll DI: Require subprogram definitions to be distinct 2015-08-28 20:26:49 +00:00
pr12048.ll
pr12691.ll
pr18165.ll [opaque pointer type] Add textual IR support for explicit type parameter to the call instruction 2015-04-16 23:24:18 +00:00
pr25541.ll [IR] Reformulate LLVM's EH funclet IR 2015-12-12 05:38:55 +00:00
pr27056.ll [LoopStrengthReduce] Don't hoist into a catchswitch 2016-03-24 21:40:22 +00:00
pr31627.ll [LoopStrengthReduce] Don't bother rewriting PHIs in catchswitch blocks 2017-01-13 22:24:27 +00:00
preserve-gep-loop-variant.ll
related_indvars.ll
remove_indvar.ll
scaling_factor_cost_crash.ll
scev-insertpt-bug.ll Reapply [LSR] Create fewer redundant instructions. 2016-06-06 19:10:46 +00:00
sext-ind-var.ll [SCEV] Apply NSW and NUW flags via poison value analysis for sub, mul and shl 2015-08-14 22:45:26 +00:00
share_code_in_preheader.ll
share_ivs.ll
shl.ll [LSR] canonicalize Prod*(1<<C) to Prod<<C 2015-06-24 19:28:40 +00:00
uglygep-address-space.ll
uglygep.ll
use_postinc_value_outside_loop.ll
var_stride_used_by_compare.ll
variable_stride.ll