Matthijs Kooijman
5ec5e264e4
Make GlobalOpt preserve address spaces when scalar replacing aggregate globals.
...
llvm-svn: 53716
2008-07-17 11:59:53 +00:00
Chris Lattner
eccd57d118
Fix PR2553
...
llvm-svn: 53715
2008-07-17 06:07:20 +00:00
Matthijs Kooijman
c05651e3ce
Add a few cases to instcombine's extractvalue testcase.
...
llvm-svn: 53675
2008-07-16 12:57:25 +00:00
Matthijs Kooijman
0625e0fda6
Un-XFAIL multdeadretval, since instcombine now properly handles the mess deadargelim leaves behind :-)
...
llvm-svn: 53674
2008-07-16 12:56:52 +00:00
Evan Cheng
7218339189
Fix PR2296. Do not transform x86_sse2_storel_dq into a full-width store.
...
llvm-svn: 53666
2008-07-16 07:28:14 +00:00
Matthijs Kooijman
45140a0497
XFAIL the multdeadretval test for now, I will be fixing instcombine to make it work again tomorrow.
...
llvm-svn: 53614
2008-07-15 16:05:09 +00:00
Matthijs Kooijman
48fd953b49
Remove a few tests which no longer hold for deadargelim (since it is now
...
allowed to canonicalize return values).
Add a test that checks if return value and function attributes are not removed.
llvm-svn: 53612
2008-07-15 14:57:01 +00:00
Matthijs Kooijman
21162f1db9
Add a testcase for the canonicalizations now performed by deadargelim.
...
llvm-svn: 53611
2008-07-15 14:42:58 +00:00
Matthijs Kooijman
f940585c1c
Make deadargelim a bit less smart, so it doesn't choke on nested structs as
...
return values that are still (partially) live. Instead of updating all uses of
a call instruction after removing some elements, it now just rebuilds the
original struct (With undef gaps where the unused values were) and leaves it to
instcombine to clean this up.
The added testcase still fails currently, but this is due to instcombine which
isn't good enough yet. I will fix that part next.
llvm-svn: 53608
2008-07-15 14:03:10 +00:00
Matthijs Kooijman
02ffbaf305
Fix typo.
...
llvm-svn: 53605
2008-07-15 13:15:10 +00:00
Chris Lattner
14faada3a3
Fix PR2506 by being a bit more careful about reverse fact propagation when
...
disproving a condition. This actually compiles the existing testcase
(udiv_select_to_select_shift) to:
define i64 @test(i64 %X, i1 %Cond) {
entry:
%divisor1.t = lshr i64 %X, 3 ; <i64> [#uses=1]
%quotient2 = lshr i64 %X, 3 ; <i64> [#uses=1]
%sum = add i64 %divisor1.t, %quotient2 ; <i64> [#uses=1]
ret i64 %sum
}
instead of:
define i64 @test(i64 %X, i1 %Cond) {
entry:
%quotient1.v = select i1 %Cond, i64 3, i64 4 ; <i64> [#uses=1]
%quotient1 = lshr i64 %X, %quotient1.v ; <i64> [#uses=1]
%quotient2 = lshr i64 %X, 3 ; <i64> [#uses=1]
%sum = add i64 %quotient1, %quotient2 ; <i64> [#uses=1]
ret i64 %sum
}
llvm-svn: 53534
2008-07-14 00:15:52 +00:00
Chris Lattner
3444f4d4c4
Fix mishandling of the infinite loop case when merging two blocks. This
...
fixes PR2540.
llvm-svn: 53533
2008-07-13 22:23:11 +00:00
Nick Lewycky
3fb5816774
Enhance analysis of srem.
...
Remove dead code analyzing urem. 'urem' of power-of-2 is canonicalized to an
'and' instruction.
llvm-svn: 53506
2008-07-12 05:04:38 +00:00
Nick Lewycky
8cd0f2058e
Add another optimization from PR2330. Also catch some missing cases that are
...
similar.
llvm-svn: 53451
2008-07-11 07:20:53 +00:00
Chris Lattner
16b8ae98c1
Fix folding of icmp's of i1 where the comparison is signed. The code
...
was using the algorithm for folding unsigned comparisons which is
completely wrong. This has been broken since the signless types change.
llvm-svn: 53444
2008-07-11 04:20:58 +00:00
Chris Lattner
f3f6b6d7af
Fix a bogus optimization: folding (slt (zext i1 A to i32), 1) -> (slt i1 A, true)
...
This cause a regression in InstCombine/JavaCompare, which was doing the right
thing on accident. To handle the missed case, generalize the comparisons based
on masked bits a little bit to handle comparisons against the max value. For
example, we can now xform (slt i32 (and X, 4), 4) -> (setne i32 (and X, 4), 4)
llvm-svn: 53443
2008-07-11 04:09:09 +00:00
Chris Lattner
43a2b1b16d
make this condition more precise.
...
llvm-svn: 53442
2008-07-11 03:54:57 +00:00
Matthijs Kooijman
ca5124a630
Restructure dead argument elimination, try #3 :-)
...
Rewrite the DeadArgumentElimination pass, to use a more explicit tracking of
dependencies between return values and/or arguments. Also make the handling of
arguments and return values the same.
The pass now looks properly inside returned structs, but only at the first
level (ie, not inside nested structs).
This version fixed a few more bugs and was cleaned up a bit. It now passes all
of LLVM's testing, and should still pass SPEC2006. There is still a minor bug
with regard to returning nested structs. Since there is currently nothing that
emits such IR, I will fix that in a seperate commit (partly because it requires
a non-trivial fix).
llvm-svn: 53400
2008-07-10 10:24:08 +00:00
Nick Lewycky
26ccb8e9a8
Fix overzealous optimization. Thanks to Duncan Sands for pointing out my error!
...
llvm-svn: 53393
2008-07-10 05:51:40 +00:00
Chris Lattner
563d2c9fac
Fix a case where vector comparison constant folding would cause an
...
infinite recursion. part of PR2529
llvm-svn: 53383
2008-07-10 00:29:28 +00:00
Chris Lattner
4fbada0bef
elementwise comparison of vector constants was completely wrong. Fix
...
it for PR2529
llvm-svn: 53380
2008-07-10 00:08:17 +00:00
Nick Lewycky
6341c5a7ec
Fold (a < 8) && (b < 8) into (a|b) < 8 for unsigned less or greater than.
...
llvm-svn: 53282
2008-07-09 07:29:11 +00:00
Nick Lewycky
38fa84fa12
Fold ((1 << a) & 1) to (a == 0).
...
llvm-svn: 53276
2008-07-09 05:20:13 +00:00
Chris Lattner
1a2c55201e
Fix a broken test. Neither load is eliminable without changing the CFG.
...
llvm-svn: 53273
2008-07-09 05:01:02 +00:00
Nick Lewycky
2a6469c9a5
Reduce x - y to -y when we know the 'x' part will get masked off anyways.
...
llvm-svn: 53271
2008-07-09 04:32:37 +00:00
Devang Patel
2b56d5281d
If loop induction variable's start value is less then its exit value then do not split the loop.
...
llvm-svn: 53265
2008-07-09 00:12:01 +00:00
Chris Lattner
12ebc344e1
'Optimize' test
...
llvm-svn: 53242
2008-07-08 18:33:33 +00:00
Chris Lattner
7f0adf0b34
new testcase for PR2496
...
llvm-svn: 53239
2008-07-08 17:18:05 +00:00
Chris Lattner
d4bcc9011b
Fix three bugs:
...
1) evaluate [v]fcmp true/false with undefs to true or false instead
of undef.
2) fix vector comparisons with undef to return a vector result instead
of i1
3) fix vector comparisons with evaluatable results to return vector
true/false instead of i1 true/false (PR2529)
llvm-svn: 53220
2008-07-08 05:46:34 +00:00
Nick Lewycky
94f9c5a42e
Fix missed optimization opportunity when analyzing cast of mul and select.
...
llvm-svn: 53151
2008-07-05 21:19:34 +00:00
Owen Anderson
1acfb69ad7
Remove the ability for ADCE to remove unreachable blocks in loop nests, because, as Eli pointed out, SimplifyCFG already does this.
...
llvm-svn: 53104
2008-07-03 17:21:41 +00:00
Owen Anderson
e20158affb
Add support to ADCE for pruning unreachable blocks. This addresses the final
...
part of PR2509.
llvm-svn: 53038
2008-07-02 18:05:19 +00:00
Owen Anderson
5747d627e0
A better fix for PR2503 that doesn't pessimize GVN in the presence of unreachable blocks.
...
llvm-svn: 53032
2008-07-02 17:20:16 +00:00
Evan Cheng
407d3b820b
XFAIL for now.
...
llvm-svn: 52795
2008-06-26 22:09:29 +00:00
Owen Anderson
a9fd2b7e53
Use the -enable-pre flag so this test doesn't fail.
...
llvm-svn: 52784
2008-06-26 17:03:28 +00:00
Chris Lattner
73b52018e9
Fix PR2488, a case where we deleted stack restores too aggressively.
...
llvm-svn: 52702
2008-06-25 05:59:28 +00:00
Dan Gohman
b9384c5e87
Revert 52645, the loop unroller changes. It caused a regression in 252.eon.
...
llvm-svn: 52688
2008-06-24 20:44:42 +00:00
Matthijs Kooijman
ff03ea8aeb
Commit the new DeadArgElim pass again, this time with the gcc bootstrap failures fixed.
...
Also add a testcase to reproduce the gcc bootstrap failure in very much reduced form.
llvm-svn: 52677
2008-06-24 16:30:26 +00:00
Dan Gohman
7f6ee1cd4b
Revamp the loop unroller, extending it to correctly update PHI nodes
...
in the presence of out-of-loop users of in-loop values and the trip
count is not a known multiple of the unroll count, and to be a bit
simpler overall. This fixes PR2253.
llvm-svn: 52645
2008-06-23 21:29:41 +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
Chris Lattner
d80c865a09
Fix PR2369 by making scalarrepl more careful about promoting
...
structures. Its default threshold is to promote things that are
smaller than 128 bytes, which is sane. However, it is not sane
to do this for things that turn into 128 *registers*. Add a cap
on the number of registers introduced, defaulting to 128/4=32.
llvm-svn: 52611
2008-06-22 17:46:21 +00:00
Eli Friedman
369401ef95
Fix for PR2479: correctly optimize expressions like (a > 13) & (a ==
...
15).
See also PR1800, which is about the signed case.
llvm-svn: 52608
2008-06-21 23:36:13 +00:00
Duncan Sands
dd3b6236c8
This file is empty.
...
llvm-svn: 52596
2008-06-21 20:26:50 +00:00
Evan Cheng
b65bceda9c
Back out Matthijs' DAE patches. It's miscompiling gcc driver.
...
llvm-svn: 52570
2008-06-21 00:31:44 +00:00
Matthijs Kooijman
564fe9092f
Add testcase that checks that DeadArgElim doesn't touch stuff it shouldn't touch.
...
llvm-svn: 52540
2008-06-20 15:38:22 +00:00
Matthijs Kooijman
a3222e3730
Recommit r52459, rewriting of the dead argument elimination pass.
...
This is a fixed version that no longer uses multimap::equal_range, which
resulted in a pointer invalidation problem.
Also, DAE::InspectedFunctions was not really necessary, so it got removed.
Lastly, this version no longer applies the extra arg hack on functions who did
not have any arguments to start with.
llvm-svn: 52532
2008-06-20 09:36:16 +00:00
Chris Lattner
e588f546c5
Fix PR2471, which is a bug involving an invalid promotion from a conditional load.
...
llvm-svn: 52525
2008-06-20 05:12:56 +00:00
Matthijs Kooijman
343ce1868f
Modify some ipconstprop tests to also test with invokes.
...
llvm-svn: 52491
2008-06-19 09:27:44 +00:00
Owen Anderson
597b40ed60
Remove this test until the corresponding patch is reapplied because it's causing make check to crash for some people.
...
llvm-svn: 52473
2008-06-18 22:37:31 +00:00
Owen Anderson
3f78e260c1
Add local PRE to GVN. This only operates in cases where it would not increase code size, namely when the instantiated expression
...
would only need to be created in one predecessor.
llvm-svn: 52471
2008-06-18 21:41:49 +00:00