1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

37 Commits

Author SHA1 Message Date
Dan Gohman
4e8fc41d48 Implement "superhero" strength reduction, or full strength
reduction of address calculations down to basic pointer arithmetic.
This is currently off by default, as it needs a few other features
before it becomes generally useful. And even when enabled, full
strength reduction is only performed when it doesn't increase
register pressure, and when several other conditions are true.

This also factors out a bunch of exisiting LSR code out of
StrengthReduceStridedIVUsers into separate functions, and tidies
up IV insertion. This actually decreases register pressure even
in non-superhero mode. The change in iv-users-in-other-loops.ll
is an example of this; there are two more adds because there are
two fewer leas, and there is less spilling.

llvm-svn: 65108
2009-02-20 04:17:46 +00:00
Evan Cheng
9a8e419015 Strengthen the "non-constant stride must dominate loop preheader" check.
llvm-svn: 64703
2009-02-17 00:13:06 +00:00
Evan Cheng
02d9156a8d Fix pr3571: If stride is a value defined by an instruction, make sure it dominates the loop preheader. When IV users are strength reduced, the stride is inserted into the preheader. It could create a use before def situation.
llvm-svn: 64579
2009-02-15 06:06:15 +00:00
Dale Johannesen
ef9b8f0d4c Fix PR 3471, and some cleanups.
llvm-svn: 64177
2009-02-09 22:14:15 +00:00
Dale Johannesen
816f9bc81d 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.

llvm-svn: 62212
2009-01-14 02:35:31 +00:00
Devang Patel
ed0ea8049f Remove.
llvm-svn: 56018
2008-09-09 21:41:34 +00:00
Devang Patel
36ad68421e fix overflow check.
llvm-svn: 56011
2008-09-09 20:54:34 +00:00
Devang Patel
c60c8e35eb xfail
llvm-svn: 55914
2008-09-08 16:24:30 +00:00
Devang Patel
4dfecae8fe Check iteration count.
llvm-svn: 55680
2008-09-03 00:10:56 +00:00
Devang Patel
a1e2066b1d If all IV uses are extending integer IV then change the type of IV itself, if possible.
llvm-svn: 55674
2008-09-02 22:18:08 +00:00
Devang Patel
211c05f7a3 If IV is used in a int-to-float cast inside the loop then try to eliminate the cast operation.
llvm-svn: 55374
2008-08-26 17:57:54 +00:00
Bill Wendling
98fb8113e8 XFAIL this test for now.
llvm-svn: 54929
2008-08-18 18:29:54 +00:00
Evan Cheng
5ebbd688ec Didn't mean to change this.
llvm-svn: 54904
2008-08-17 19:25:28 +00:00
Evan Cheng
6534c78383 Fix a (u)comiss intrinsic lowering bug. It was using anyext which can return junk in higher bits. Patch by Nate Begeman.
llvm-svn: 54903
2008-08-17 19:22:34 +00:00
Devang Patel
a8e9ee0529 Reapply 54786. Add overflow and number of mantissa bits checks.
llvm-svn: 54821
2008-08-15 21:21:34 +00:00
Evan Cheng
b2e1459e48 Revert 54786. It's not checking for overflows, etc.
llvm-svn: 54813
2008-08-15 08:12:11 +00:00
Devang Patel
67f9b08a91 If IV is used in a int-to-float cast inside the loop then try to eliminate the cast opeation.
llvm-svn: 54786
2008-08-14 20:58:31 +00:00
Devang Patel
a82e51a430 Check sign to detect overflow before changing compare stride.
llvm-svn: 54710
2008-08-13 02:05:14 +00:00
Evan Cheng
cbb33fb6e8 PR2535, not PR2355.
llvm-svn: 54416
2008-08-06 18:06:48 +00:00
Evan Cheng
c5cc2cb4aa Fix PR2355: bug in ChangeCompareStride. When the loop termination compare is the only use of its iv stride, the stride can be eliminated by moving it to another stride. If the scale is negative, swap the predicate instead of using a inverse predicate.
llvm-svn: 54415
2008-08-06 18:04:43 +00:00
Dan Gohman
693339b859 Add the PR number to the test.
llvm-svn: 53880
2008-07-21 21:50:25 +00:00
Dan Gohman
8f7b6c8113 Fix a bug in LSR's dead-PHI cleanup. If a PHI has a def-use chain that
leads into a cycle involving a different PHI, LSR got stuck running
around that cycle looking for the original PHI. To avoid this, keep
track of visited PHIs and stop searching if we see one more than once.
This fixes PR2570.

llvm-svn: 53879
2008-07-21 21:45:02 +00:00
Dan Gohman
62d8bc0480 Improve LSR's dead-phi detection to handle use-def cycles
with more than two nodes.

llvm-svn: 52617
2008-06-22 20:44:02 +00:00
Dan Gohman
c1fd5f170b Refine the change in r52258 for avoiding use-before-def conditions
when changing the stride of a comparison so that it's slightly
more precise, by having it scan the instruction list to determine
if there is a use of the condition after the point where the
condition will be inserted.

llvm-svn: 52371
2008-06-16 22:34:15 +00:00
Dan Gohman
7f1fcc4339 Protect ChangeCompareStride from situations in which it is possible
for it to generate use-before-def IR, such as in this testcase.

llvm-svn: 52258
2008-06-13 21:43:41 +00:00
Gabor Greif
807c2df887 sabre brings to my attention that the 'tr' suffix is also obsolete
llvm-svn: 51349
2008-05-20 21:00:03 +00:00
Gabor Greif
d8a4dbb5da Rename the last test with .llx extension to .ll, resolve duplicate test by renaming to isnan2. Now that no test has llx ending there is no need to search for them from dg.exp too.
llvm-svn: 51328
2008-05-20 19:52:04 +00:00
Dan Gohman
04e2b94842 Update old-style syntax in some "not grep" tests.
llvm-svn: 50560
2008-05-01 23:50:07 +00:00
Tanya Lattner
52e5896b3f Upgrade tests.
llvm-svn: 48538
2008-03-19 07:28:33 +00:00
Dan Gohman
794fa1f8f7 Convert tests using "| wc -l | grep ..." to use the count script.
llvm-svn: 41097
2007-08-15 13:36:28 +00:00
John Criswell
57e5ed4b5a Convert .cvsignore files
llvm-svn: 37801
2007-06-29 16:35:07 +00:00
Devang Patel
c3edd08cbe New test.
llvm-svn: 36379
2007-04-23 22:39:53 +00:00
Reid Spencer
df17fa8ef9 For PR1319:
Remove && from the end of the lines to prevent tests from throwing run
lines into the background. Also, clean up places where the same command
is run multiple times by using a temporary file.

llvm-svn: 36142
2007-04-16 17:36:08 +00:00
Reid Spencer
43899915e9 For PR1319:
Fix syntax of tests to ensure grep pattern is properly quoted.

llvm-svn: 36134
2007-04-16 15:31:49 +00:00
Reid Spencer
d1d4897d3f For PR1319:
Upgrade to use new Tcl exec based test harness.

llvm-svn: 36062
2007-04-15 08:30:33 +00:00
Reid Spencer
56b310ae49 Make the llvm-runtest function much more amenable by eliminating all the
global variables that needed to be passed in. This makes it possible to
add new global variables with only a couple changes (Makefile and llvm-dg.exp)
instead of touching every single dg.exp file.

llvm-svn: 35918
2007-04-11 19:56:59 +00:00
Reid Spencer
4572ce85b0 Regression is gone, don't try to find it on clean target.
llvm-svn: 33296
2007-01-17 07:59:14 +00:00