Chris Lattner
b6db834a47
don't sink invokes, even if they are readonly. This fixes a
...
crash on kimwitu++.
llvm-svn: 50901
2008-05-09 15:07:33 +00:00
Duncan Sands
dd33da4795
Fix a type and formatting.
...
llvm-svn: 50900
2008-05-09 12:20:10 +00:00
Chris Lattner
02ca137915
Implement PR2298. This transforms:
...
~x < ~y --> y < x
-x == -y --> x == y
llvm-svn: 50882
2008-05-09 05:19:28 +00:00
Chris Lattner
8ec87dd865
restore doxygen comment.
...
llvm-svn: 50881
2008-05-09 04:43:13 +00:00
Gordon Henriksen
846171a09e
Improve pass documentation and comments.
...
Patch by Matthijs Kooijman!
llvm-svn: 50861
2008-05-08 17:46:35 +00:00
Chris Lattner
4c1ef3628b
More than just loads can read from memory: readonly calls like strlen
...
also need to be checked for memory modifying instructions before we
can sink them. THis fixes the second half of PR2297.
llvm-svn: 50860
2008-05-08 17:37:37 +00:00
Chris Lattner
cba8b4c7e8
Make instcombine's DSE respect loads as well as stores. It is not safe to
...
delete the first store in:
store x -> p
load p
store y -> p
This is for PR2297.
llvm-svn: 50859
2008-05-08 17:20:30 +00:00
Devang Patel
3dce0e9d2e
Check linkage.
...
llvm-svn: 50851
2008-05-08 15:08:39 +00:00
Anton Korobeynikov
ddb93e7a02
Turn StripPointerCast() into a method
...
llvm-svn: 50836
2008-05-07 22:54:15 +00:00
Dan Gohman
6ea87fa437
Fix a bug in the ComputeMaskedBits logic for multiply.
...
llvm-svn: 50793
2008-05-07 00:35:55 +00:00
Anton Korobeynikov
90ee6d6616
Make StripPointerCast a common function (should we mak it method of Value instead?)
...
llvm-svn: 50775
2008-05-06 22:52:30 +00:00
Owen Anderson
d82a778214
We need to update PHIs containing the exiting block, not the exit block. We really should come up with better names for these.
...
llvm-svn: 50770
2008-05-06 20:55:16 +00:00
Devang Patel
c5aee6c84d
Fix typo.
...
llvm-svn: 50713
2008-05-06 05:40:11 +00:00
Chris Lattner
a75e149023
fix typo Duncan noticed
...
llvm-svn: 50699
2008-05-06 02:31:18 +00:00
Dan Gohman
d4a670284c
Make several variable declarations static.
...
llvm-svn: 50696
2008-05-06 01:53:16 +00:00
Dan Gohman
a84b75df17
Remove uses of llvm/System/IncludeFile.h that are no longer needed.
...
llvm-svn: 50695
2008-05-06 01:32:53 +00:00
Dan Gohman
faf9df7227
Correct the value of LowBits in srem and urem handling in
...
ComputeMaskedBits.
llvm-svn: 50692
2008-05-06 00:51:48 +00:00
Bill Wendling
5234187c50
Fix: Some classes were derived from a class in an anonymous namespace, but they
...
themselves weren't in the anonymous namespace.
llvm-svn: 50673
2008-05-05 21:37:59 +00:00
Chris Lattner
50d16c2939
Fix a crash when threading a block that includes a MRV call result.
...
DemoteRegToStack doesn't work with MRVs yet, because it relies on the
ability to load/store things.
This fixes PR2285.
llvm-svn: 50667
2008-05-05 20:21:22 +00:00
Torok Edwin
a68816f876
processStore may delete the instruction, avoid
...
using dyn_cast<> on already freed memory.
llvm-svn: 50618
2008-05-04 08:51:25 +00:00
Devang Patel
e8518dd7ff
Handle multiple return values.
...
llvm-svn: 50604
2008-05-03 01:12:15 +00:00
Devang Patel
b3112b4417
Do not sink getresult.
...
llvm-svn: 50600
2008-05-03 00:36:30 +00:00
Dan Gohman
27156711ef
Fix a mistake in the computation of leading zeros for udiv.
...
llvm-svn: 50591
2008-05-02 21:30:02 +00:00
Chris Lattner
96467cc665
strength reduce exp2 into ldexp, rdar://5852514
...
llvm-svn: 50586
2008-05-02 18:43:35 +00:00
Chris Lattner
e45796cb56
add a FIXME so we remember to eventually remove this code.
...
llvm-svn: 50582
2008-05-02 17:18:31 +00:00
Bill Wendling
277f2a205d
Porting r50563 from Tak to mainline.
...
llvm-svn: 50564
2008-05-02 00:43:20 +00:00
Dale Johannesen
d758175889
Don't try to create PHIs of struct types. Fallout
...
from x86-64 calling convention work.
llvm-svn: 50545
2008-05-01 22:27:44 +00:00
Dan Gohman
793c9fed45
Fix an overaggressive SimplifyDemandedBits optimization on urem. This
...
fixes the 254.gap regression on x86 and the 403.gcc regression on x86-64.
llvm-svn: 50537
2008-05-01 19:13:24 +00:00
Chris Lattner
ab0c73a95c
1) add '-debug' output
...
2) Return NULL instead of false in several places for tidiness.
3) fix a bug optimizing sprintf(p, "%c", x)
llvm-svn: 50521
2008-05-01 06:39:12 +00:00
Chris Lattner
be2bafbe92
Delete the IPO simplify-libcalls and completely reimplement it as
...
a FunctionPass. This makes it simpler, fixes dozens of bugs, adds
a couple of minor features, and shrinks is considerably: from
2214 to 1437 lines.
llvm-svn: 50520
2008-05-01 06:25:24 +00:00
Owen Anderson
aaa86b3249
This condition got inverted accidentally.
...
llvm-svn: 50473
2008-04-30 07:16:33 +00:00
Chris Lattner
15195e00ee
move lowering of llvm.memset -> store from simplify libcalls
...
to instcombine.
llvm-svn: 50472
2008-04-30 06:39:11 +00:00
Chris Lattner
844e32537d
use string length computation to generalize several xforms.
...
llvm-svn: 50464
2008-04-30 03:07:53 +00:00
Owen Anderson
cc69e3444e
Revert r50441. The original code was correct. Add some more comments so that I don't make the same mistake in the future.
...
llvm-svn: 50446
2008-04-29 21:51:00 +00:00
Owen Anderson
2caa79ae70
Fix a bug in memcpyopt where the memcpy-memcpy transform was never being applied because
...
we were checking for it in the wrong order. This caused a miscompilation because the
return slot optimization assumes that the call it is dealing with is NOT a memcpy.
llvm-svn: 50444
2008-04-29 21:26:06 +00:00
Owen Anderson
8150660ba3
We should be returning true here since we've changed the function.
...
llvm-svn: 50442
2008-04-29 21:02:46 +00:00
Owen Anderson
9db9df7329
A lot of cleanups and documentation improvements, as well as a few corner case fixes. Most
...
of this was suggested by Chris.
llvm-svn: 50441
2008-04-29 20:59:33 +00:00
Owen Anderson
5b7928f3d2
Rename DeadLoopElimination to LoopDeletion, part 2.
...
llvm-svn: 50437
2008-04-29 20:06:54 +00:00
Owen Anderson
f9e11b8327
Rename DeadLoopElimination to LoopDeletion, part one.
...
llvm-svn: 50436
2008-04-29 19:58:07 +00:00
Chris Lattner
5bd55b0885
don't eliminate load from volatile value on paths where the load is dead.
...
This fixes the second half of PR2262
llvm-svn: 50430
2008-04-29 17:28:22 +00:00
Chris Lattner
7099f3c400
fix a subtle volatile handling bug.
...
llvm-svn: 50428
2008-04-29 17:13:43 +00:00
Chris Lattner
5e47b186a7
Implement more aggressive support for analyzing string length. This
...
generalizes the previous code to handle the case when the string is not
an immediate to the strlen call (for example, crazy stuff like
strlen(c ? "foo" : "bart"+1) -> 3). This implements
gcc.c-torture/execute/builtins/strlen-2.c. I will generalize other
cases in simplifylibcalls to use the same routine later.
llvm-svn: 50408
2008-04-29 06:56:02 +00:00
Owen Anderson
dc1c838b4d
Clarify what we mean by a dead loop.
...
llvm-svn: 50406
2008-04-29 06:34:55 +00:00
Chris Lattner
51fe8415da
don't delete the last store to an alloca if the store is volatile.
...
llvm-svn: 50390
2008-04-29 04:58:38 +00:00
Owen Anderson
45b160745b
Add some more comments.
...
llvm-svn: 50384
2008-04-29 00:45:15 +00:00
Owen Anderson
e0f9e8446b
Remove debugging code.
...
llvm-svn: 50383
2008-04-29 00:39:24 +00:00
Owen Anderson
4cc52fd657
Add dead loop elimination, which removes dead loops for which we can compute
...
the trip count.
llvm-svn: 50382
2008-04-29 00:38:34 +00:00
Dan Gohman
9e4db7f0bd
Fix DSE to not eliminate volatile loads with no uses.
...
llvm-svn: 50370
2008-04-28 19:51:27 +00:00
Dan Gohman
1b7238e6e4
Teach InstCombine's ComputeMaskedBits what SelectionDAG's
...
ComputeMaskedBits knows about cttz, ctlz, and ctpop. Teach
SelectionDAG's ComputeMaskedBits what InstCombine's knows
about SRem. And teach them both some things about high bits
in Mul, UDiv, URem, and Sub. This allows instcombine and
dagcombine to eliminate sign-extension operations in
several new cases.
llvm-svn: 50358
2008-04-28 17:02:21 +00:00
Chris Lattner
ede7e89144
Fix PR2256, yet another miscompilation in simplifycfg of i
...
multiple return values.
Bill, please pull this into Tak.
llvm-svn: 50332
2008-04-28 00:19:07 +00:00