Dan Gohman
230d92b375
Move MaximumAlignment to be a member of the Value class.
...
llvm-svn: 109891
2010-07-30 21:07:05 +00:00
Eli Friedman
642f4c66c3
PR7750: !CExpr->isNullValue() only properly computes whether CExpr is nonnull
...
if CExpr is a ConstantInt.
llvm-svn: 109773
2010-07-29 18:03:33 +00:00
Dan Gohman
939744be5f
Define a maximum supported alignment value for load, store, and
...
alloca instructions (constrained by their internal encoding),
and add error checking for it. Fix an instcombine bug which
generated huge alignment values (null is infinitely aligned).
This fixes undefined behavior noticed by John Regehr.
llvm-svn: 109643
2010-07-28 20:12:04 +00:00
Dan Gohman
5295c21189
When user code intentionally dereferences null, the alignment of the
...
dereference is theoretically infinite. Put a cap on the computed
alignment to avoid overflow, noticed by John Regehr.
llvm-svn: 109596
2010-07-28 17:14:23 +00:00
Gabor Greif
96a9f8c7c6
mass elimination of reliance on automatic iterator dereferencing
...
llvm-svn: 109103
2010-07-22 13:36:47 +00:00
Gabor Greif
a7509fca78
undo 80 column trespassing I caused
...
llvm-svn: 109092
2010-07-22 10:37:47 +00:00
Owen Anderson
f8addbb0a1
Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
...
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Owen Anderson
0217b8e1d9
Tweak per Chris' comments.
...
llvm-svn: 108736
2010-07-19 19:23:32 +00:00
Owen Anderson
8159755faa
Reimplement r108639 in InstCombine rather than DAGCombine.
...
llvm-svn: 108687
2010-07-19 08:09:34 +00:00
Owen Anderson
c8dc055b5e
Another attempt at getting the clang self-host to like my instcombine patch.
...
llvm-svn: 108614
2010-07-17 06:56:35 +00:00
Owen Anderson
ca2a306a1a
Remove the rest of my instcombine changes. Back to the drawing board on this one.
...
llvm-svn: 108530
2010-07-16 16:39:00 +00:00
Gabor Greif
17c48ecd68
eliminate CallInst::ArgOffset
...
llvm-svn: 108522
2010-07-16 09:38:02 +00:00
Eric Christopher
5eef314caf
Also revert 108422, it's causing some test failures.
...
Working on testcases for Owen.
llvm-svn: 108494
2010-07-16 01:36:12 +00:00
Owen Anderson
cc5ef967da
Speculatively revert r108429 to fix the clang self-host.
...
llvm-svn: 108436
2010-07-15 18:18:57 +00:00
Owen Anderson
565ac2758c
Per Chris' suggestion, get rid of the select canonicalization and just add
...
the corresponding or-icmp-and pattern. This has the added benefit of doing
the matching earlier, and thus being less susceptible to being confused by
earlier transforms.
llvm-svn: 108429
2010-07-15 17:24:23 +00:00
Owen Anderson
01a2992a91
Reapply r108378, with bugfixes, testcase, and improved comment formatting.
...
This now passes LIT, nighty test, and llvm-gcc bootstrap on my machine.
llvm-svn: 108422
2010-07-15 15:00:23 +00:00
Eli Friedman
ded29cd2dc
Speculatively revert r108378; may be causing bootstrap failures.
...
llvm-svn: 108389
2010-07-15 00:33:00 +00:00
Owen Anderson
4656b749f2
Add instcombine transforms to optimize tests of multiple bits of the same value into a single larger comparison.
...
llvm-svn: 108378
2010-07-14 23:33:51 +00:00
Chris Lattner
38e6ecd9f1
revert r108320, I see the failures now...
...
llvm-svn: 108322
2010-07-14 06:16:35 +00:00
Chris Lattner
5822d6d579
reapply benjamin's instcombine patch, I don't see anything wrong with it and can't repro any problems with a manual self-host.
...
llvm-svn: 108320
2010-07-14 05:59:13 +00:00
Benjamin Kramer
cf8ad46899
Nope, still breaks the release selfhost bots :(
...
llvm-svn: 108153
2010-07-12 16:38:48 +00:00
Benjamin Kramer
e391789246
Reapply the "or" half of r108136, which seems to be less problematic.
...
llvm-svn: 108152
2010-07-12 16:15:48 +00:00
Gabor Greif
9f6b0059e4
cache result of operator*
...
llvm-svn: 108150
2010-07-12 15:48:26 +00:00
Benjamin Kramer
98c95e7743
Revert r108141 again, sigh.
...
llvm-svn: 108148
2010-07-12 14:42:04 +00:00
Gabor Greif
04d1ca9e95
cache result of operator*
...
llvm-svn: 108147
2010-07-12 14:15:58 +00:00
Benjamin Kramer
c4f46375d3
Reapply 108136 with an ugly pasto fixed.
...
llvm-svn: 108141
2010-07-12 13:44:00 +00:00
Benjamin Kramer
e12b88fafe
Move optimization to avoid redundant matching.
...
llvm-svn: 108140
2010-07-12 13:34:22 +00:00
Benjamin Kramer
d9bf737e62
Revert r108136 until I figure out why it broke selfhost.
...
llvm-svn: 108139
2010-07-12 12:35:49 +00:00
Benjamin Kramer
f00a49ceff
instcombine: fold (x & y) | (~x & z) and (x & y) ^ (~x & z) into ((y ^ z) & x) ^ z which is one instruction shorter. (PR6773)
...
before:
%and = and i32 %y, %x
%neg = xor i32 %x, -1
%and4 = and i32 %z, %neg
%xor = xor i32 %and4, %and
after:
%xor1 = xor i32 %z, %y
%and2 = and i32 %xor1, %x
%xor = xor i32 %and2, %z
llvm-svn: 108136
2010-07-12 11:54:45 +00:00
Duncan Sands
f7b98e2b1e
Convert some tab stops into spaces.
...
llvm-svn: 108130
2010-07-12 08:16:59 +00:00
Gabor Greif
72d36e30a0
cache result of operator*
...
llvm-svn: 107972
2010-07-09 15:01:36 +00:00
Gabor Greif
9e2aa5d5d7
do not repeatedly dereference use_iterator
...
llvm-svn: 107962
2010-07-09 12:23:50 +00:00
Benjamin Kramer
27eb255a70
Teach instcombine to transform
...
(X >s -1) ? C1 : C2 and (X <s 0) ? C2 : C1
into ((X >>s 31) & (C2 - C1)) + C1, avoiding the conditional.
This optimization could be extended to take non-const C1 and C2 but we better
stay conservative to avoid code size bloat for now.
for
int sel(int n) {
return n >= 0 ? 60 : 100;
}
we now generate
sarl $31, %edi
andl $40, %edi
leal 60(%rdi), %eax
instead of
testl %edi, %edi
movl $60, %ecx
movl $100, %eax
cmovnsl %ecx, %eax
llvm-svn: 107866
2010-07-08 11:39:10 +00:00
Gabor Greif
e315b7db00
use getArgOperand (corrected by CallInst::ArgOffset) instead of getOperand
...
llvm-svn: 107275
2010-06-30 12:38:26 +00:00
Gabor Greif
cc251773b5
use ArgOperand API
...
llvm-svn: 107017
2010-06-28 16:50:57 +00:00
Gabor Greif
a96e0eb251
use ArgOperand API
...
llvm-svn: 107016
2010-06-28 16:45:00 +00:00
Gabor Greif
d2559bceee
use ArgOperand API (some hunks I could split)
...
llvm-svn: 106824
2010-06-25 07:57:14 +00:00
Gabor Greif
b81fcc907e
use ArgOperand API
...
llvm-svn: 106752
2010-06-24 16:11:44 +00:00
Gabor Greif
04a3ec3771
use (even more, still) ArgOperand API
...
llvm-svn: 106750
2010-06-24 15:51:11 +00:00
Gabor Greif
55a6d5f8c5
use (even more) ArgOperand API
...
llvm-svn: 106744
2010-06-24 13:54:33 +00:00
Gabor Greif
37ff2f8455
use ArgOperand API
...
llvm-svn: 106743
2010-06-24 13:42:49 +00:00
Gabor Greif
f53212a5a3
use ArgOperand API
...
llvm-svn: 106740
2010-06-24 12:58:35 +00:00
Gabor Greif
c7140da218
use ArgOperand API
...
llvm-svn: 106737
2010-06-24 12:35:13 +00:00
Gabor Greif
847eba58d8
use ArgOperand API, also tighten the type of visitFree to make this work out smoothly
...
llvm-svn: 106736
2010-06-24 12:21:15 +00:00
Gabor Greif
1d1526999b
use ArgOperand API
...
llvm-svn: 106707
2010-06-24 00:44:01 +00:00
Dan Gohman
0d7d3faf8e
Move FindAvailableLoadedValue isSafeToLoadUnconditionally out of
...
lib/Transforms/Utils and into lib/Analysis so that Analysis passes
can use them.
llvm-svn: 104949
2010-05-28 16:19:17 +00:00
Dan Gohman
22d22caaed
Teach instcombine to promote alloca array sizes.
...
llvm-svn: 104945
2010-05-28 15:09:00 +00:00
Dan Gohman
082d391a46
Fix instcombine's handling of alloca to accept non-i32 types.
...
llvm-svn: 104935
2010-05-28 04:33:04 +00:00
Duncan Sands
32d3986765
Teach instCombine to remove malloc+free if malloc's only uses are comparisons
...
to null. Patch by Matti Niemenmaa.
llvm-svn: 104871
2010-05-27 19:09:06 +00:00
Dan Gohman
a08b225866
Fix a missing newline in debug output.
...
llvm-svn: 104644
2010-05-25 21:50:35 +00:00