llvm-6502/test/Transforms/LoopStrengthReduce
Dale Johannesen 2f46bb8178 Fix the time regression I introduced in 464.h264ref with
my earlier patch to this file.

The issue there was that all uses of an IV inside a loop
are actually references to Base[IV*2], and there was one
use outside that was the same but LSR didn't see the base
or the scaling because it didn't recurse into uses outside
the loop; thus, it used base+IV*scale mode inside the loop
instead of pulling base out of the loop.  This was extra bad
because register pressure later forced both base and IV into
memory.  Doing that recursion, at least enough
to figure out addressing modes, is a good idea in general;
the change in AddUsersIfInteresting does this.  However,
there were side effects....

It is also possible for recursing outside the loop to
introduce another IV where there was only 1 before (if
the refs inside are not scaled and the ref outside is).
I don't think this is a common case, but it's in the testsuite.
It is right to be very aggressive about getting rid of
such introduced IVs (CheckForIVReuse and the handling of
nonzero RewriteFactor in StrengthReduceStridedIVUsers).
In the testcase in question the new IV produced this way
has both a nonconstant stride and a nonzero base, neither
of which was handled before.  And when inserting 
new code that feeds into a PHI, it's right to put such 
code at the original location rather than in the PHI's 
immediate predecessor(s) when the original location is outside 
the loop (a case that couldn't happen before)
(RewriteInstructionToUseNewBase); better to avoid making
multiple copies of it in this case.

Also, the mechanism for keeping SCEV's corresponding to GEP's
no longer works, as the GEP might change after its SCEV
is remembered, invalidating the SCEV, and we might get a bad
SCEV value when looking up the GEP again for a later loop.  
This also couldn't happen before, as we weren't recursing
into GEP's outside the loop.

Also, when we build an expression that involves a (possibly
non-affine) IV from a different loop as well as an IV from
the one we're interested in (containsAddRecFromDifferentLoop),
don't recurse into that.  We can't do much with it and will
get in trouble if we try to create new non-affine IVs or something.

More testcases are coming.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62212 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-14 02:35: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-06-CmpStride.ll PR2535, not PR2355. 2008-08-06 18:06:48 +00:00
2008-08-13-CmpStride.ll Check sign to detect overflow before changing compare stride. 2008-08-13 02:05:14 +00:00
2008-08-14-ShadowIV.ll If IV is used in a int-to-float cast inside the loop then try to eliminate the cast operation. 2008-08-26 17:57:54 +00:00
2008-09-09-Overflow.ll fix overflow check. 2008-09-09 20:54:34 +00:00
2009-01-13-nonconstant-stride-outside-loop.ll Fix the time regression I introduced in 464.h264ref with 2009-01-14 02:35:31 +00:00
change-compare-stride-trickiness-0.ll Refine the change in r52258 for avoiding use-before-def conditions 2008-06-16 22:34:15 +00:00
change-compare-stride-trickiness-1.ll Refine the change in r52258 for avoiding use-before-def conditions 2008-06-16 22:34:15 +00:00
dead-phi.ll Improve LSR's dead-phi detection to handle use-def cycles 2008-06-22 20:44:02 +00:00
dg.exp sabre brings to my attention that the 'tr' suffix is also obsolete 2008-05-20 21:00:03 +00:00
different-type-ivs.ll
dont_insert_redundant_ops.ll
dont_reduce_bytes.ll
dont-hoist-simple-loop-constants.ll
exit_compare_live_range.ll
invariant_value_first_arg.ll
invariant_value_first.ll
nested-reduce.ll
ops_after_indvar.ll
phi_node_update_multiple_preds.ll
pr2570.ll Add the PR number to the test. 2008-07-21 21:50:25 +00:00
related_indvars.ll
remove_indvar.ll
share_code_in_preheader.ll
share_ivs.ll
use_postinc_value_outside_loop.ll
var_stride_used_by_compare.ll
variable_stride.ll