llvm-6502/lib/Transforms/Scalar
Dale Johannesen e6ec25543f Fix the time regression I introduced in 464.h264ref with
my last 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.

I owe some testcases for this, want to get it in for nightly runs.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61362 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 02:12:52 +00:00
..
ADCE.cpp
BasicBlockPlacement.cpp
CMakeLists.txt
CodeGenPrepare.cpp - CodeGenPrepare does not split loop back edges but it only knows about back edges of single block loops. It now does a DFS walk to find loop back edges. 2008-12-19 18:03:11 +00:00
CondPropagate.cpp Factor some code into a new FoldSingleEntryPHINodes method. 2008-12-03 19:44:02 +00:00
ConstantProp.cpp
DCE.cpp simplify this logic. 2008-11-27 22:46:09 +00:00
DeadStoreElimination.cpp don't bother touching volatile stores, they will just return clobber on 2008-12-07 00:25:15 +00:00
GVN.cpp Don't forget to remove phi nodes from the value numbering table after we collapse them. 2008-12-23 00:49:51 +00:00
GVNPRE.cpp
IndVarSimplify.cpp Revert r60042. IndVarSimplify should check if APFloat is PPCDoubleDouble first before trying to convert it to an integer. 2008-11-26 01:11:57 +00:00
InstructionCombining.cpp Remove redundant test for vector-nature. Scan the vector first to see whether 2008-12-20 16:48:00 +00:00
JumpThreading.cpp remove DebugIterations option. Despite the accusations, 2008-12-08 22:44:07 +00:00
LICM.cpp
LoopDeletion.cpp
LoopIndexSplit.cpp Fix spelling. 2008-12-08 17:07:24 +00:00
LoopRotation.cpp
LoopStrengthReduce.cpp Fix the time regression I introduced in 464.h264ref with 2008-12-23 02:12:52 +00:00
LoopUnroll.cpp
LoopUnswitch.cpp Undo previous patch. 2008-12-08 17:02:37 +00:00
Makefile
MemCpyOptimizer.cpp Make a few major changes to memdep and its clients: 2008-12-05 21:04:20 +00:00
PredicateSimplifier.cpp
Reassociate.cpp
Reg2Mem.cpp
Scalar.cpp
ScalarReplAggregates.cpp
SCCP.cpp
SimplifyCFGPass.cpp
SimplifyHalfPowrLibCalls.cpp eliminate warning when asserts disabled. 2008-12-14 21:36:23 +00:00
SimplifyLibCalls.cpp Turn strcmp into memcmp, such as strcmp(P, "x") --> memcmp(P, "x", 2). 2008-12-21 00:19:21 +00:00
TailDuplication.cpp simplify code. 2008-11-27 22:56:14 +00:00
TailRecursionElimination.cpp