Nick Lewycky
205be593b8
Xor'ing both sides of icmp by sign-bit is equivalent to swapping signedness of
...
the predicate.
Also, make this optz'n apply in more cases where it's safe to do so.
llvm-svn: 54876
2008-08-17 07:34:14 +00:00
Chris Lattner
c0610874cc
Rework the routines that convert AP[S]Int into a string. Now, instead of
...
returning an std::string by value, it fills in a SmallString/SmallVector
passed in. This significantly reduces string thrashing in some cases.
More specifically, this:
- Adds an operator<< and a print method for APInt that allows you to
directly send them to an ostream.
- Reimplements APInt::toString to be much simpler and more efficient
algorithmically in addition to not thrashing strings quite as much.
This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the
asmprinter. This also fixes a bug I introduced into the asmwriter in a
previous patch w.r.t. alias printing.
llvm-svn: 54873
2008-08-17 07:19:36 +00:00
Owen Anderson
13498aa150
Remove GCSE, ValueNumbering, and LoadValueNumbering. These have been deprecated for almost a year; it's finally time for them to go away.
...
llvm-svn: 54822
2008-08-15 21:31:02 +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
Chris Lattner
28a74aa6ca
use smallvector instead of vector for a couple worklists. This speeds up instcombine
...
by ~10% on some testcases.
llvm-svn: 54811
2008-08-15 04:03:01 +00:00
Bill Wendling
bebfe7b7fc
Temporarily revert r54792. It's causing an ICE during bootstrapping.
...
llvm-svn: 54804
2008-08-14 23:05:24 +00:00
Devang Patel
8aa62f7dfa
Use DenseMap. Patch by Pratik Solanki.
...
llvm-svn: 54792
2008-08-14 21:31:10 +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
Dan Gohman
027326ba3e
Use empty() instead of begin() == end().
...
llvm-svn: 54780
2008-08-14 18:13:49 +00:00
Matthijs Kooijman
3bbc2deb9c
Replace two for loops with while(!X->use_empty()) loops. This prevents
...
invalidating the iterator by deleting the current use. This fixes a segfault on
64 bit linux reported in PR2675.
Also remove an unneeded if.
llvm-svn: 54778
2008-08-14 15:03:05 +00:00
Dan Gohman
db5b503d60
Fix a bogus srem rule - a negative value srem'd by a power-of-2
...
can have a non-negative result; for example, -16%16 is 0. Also,
clarify the related comments. This fixes PR2670.
llvm-svn: 54767
2008-08-13 23:12:35 +00:00
Dan Gohman
374d9328b7
Fix SCCP's handling of struct value loads and stores. SCCP doesn't
...
track individual leaf values in such cases, so it needs to treat
struct values as normal values in this case.
llvm-svn: 54760
2008-08-13 21:22:48 +00:00
Devang Patel
bb9cb77326
Rename. s/FindIVForUser/FindIVUserForCond/g
...
llvm-svn: 54754
2008-08-13 20:31:11 +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
Bill Wendling
d910182ca9
Remove tabs.
...
llvm-svn: 54707
2008-08-12 23:15:44 +00:00
Chris Lattner
ae09ade343
Implement support for simplifying vector comparisons by 0.0 and 1.0 like we
...
do for scalars. Patch contributed by Nicolas Capens
This also generalizes the previous xforms to work on long double, now that
isExactlyValue works for long double.
llvm-svn: 54653
2008-08-11 22:06:05 +00:00
Eric Christopher
dcd4752642
Have IRBuilder take a template argument on whether or not to preserve
...
names. This can save a lot of allocations if you aren't going to be
looking at the output.
llvm-svn: 54546
2008-08-08 19:39:37 +00:00
Matthijs Kooijman
d62ee008d1
Let SRETPromotion properly preserve the function name instead of (implicitly)
...
postfixing it with a number.
llvm-svn: 54468
2008-08-07 16:01:23 +00:00
Matthijs Kooijman
287cca11b3
Fix SRETPromotion, it was generating functions without returns statements since
...
r53941 (but this was not noticed due to the lack of a basic test for
SRETPromotion).
llvm-svn: 54467
2008-08-07 15:58:09 +00:00
Matthijs Kooijman
9ff5c484cf
Add some debug output to SRETPromotion.
...
llvm-svn: 54464
2008-08-07 15:14:04 +00:00
Dan Gohman
4ad77e1ca2
Fix a shufflevector instcombine that was emitting invalid masks indices
...
when it meant to be emitting undef indices.
llvm-svn: 54417
2008-08-06 18:17:32 +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
Chris Lattner
55b99a6739
optimize a common idiom generated by clang for bitfield access, PR2638.
...
llvm-svn: 54408
2008-08-06 07:35:52 +00:00
Chris Lattner
cae04940bd
Zap sitofp/fptoui pairs. In all cases when the sign difference
...
matters, the result is undefined anyway.
llvm-svn: 54396
2008-08-06 05:13:06 +00:00
Nick Lewycky
0bf3c812d2
Reinstate this optimization, but without the miscompile. Thanks to Bill for
...
tracking down that this was breaking llvm-gcc bootstrap on Linux.
llvm-svn: 54394
2008-08-06 04:54:03 +00:00
Dan Gohman
8377e7019f
Pass the computed iteration count value to RewriteLoopExitValues
...
instead of having it call getIterationCount again.
llvm-svn: 54380
2008-08-05 22:34:21 +00:00
Bill Wendling
3882f060ef
Revert r53282. This was causing a miscompile on Linux. Also, the transformation
...
looks bogus. Please see PR2629 for details on why this is breaking things.
llvm-svn: 54372
2008-08-05 21:23:45 +00:00
Dan Gohman
1238bf634b
Trim #includes.
...
llvm-svn: 54350
2008-08-05 15:32:23 +00:00
Duncan Sands
573c01d5da
Fix comment typos.
...
llvm-svn: 54266
2008-08-01 12:23:49 +00:00
Nate Begeman
9a71580e21
Add vector shifts to the IR, patch by Eli Friedman.
...
CodeGen & Clang work coming next.
llvm-svn: 54161
2008-07-29 15:49:41 +00:00
Matthijs Kooijman
7199907f50
Add -unroll-allow-partial command line option that enabled the loop unroller to
...
partially unroll a loop when fully unrolling would not fit under the threshold.
Patch by Mikael Lepistö.
llvm-svn: 54160
2008-07-29 13:21:23 +00:00
Matthijs Kooijman
77948dbbc2
Restructure ArgumentPromotion a bit. Instead of just having a single boolean
...
that says "unconditional loads from this argument are safe", we now keep track
of the safety per set of indices from which loads happen. This prevents
ArgPromotion from promoting loads that aren't really valid. As an added effect,
this will now disregard the the type of the indices passed to a GEP, so
"load GEP %A, i32 1" and "load GEP %A, i64 1" will result in a single argument,
not two.
This fixes PR2598, for which a testcase has been added as well.
llvm-svn: 54159
2008-07-29 10:00:13 +00:00
Owen Anderson
d2cc2655af
Don't remove volatile loads. Thanks to Duncan for noticing this one.
...
llvm-svn: 54144
2008-07-28 20:52:42 +00:00
Owen Anderson
4d84a90fa9
Add support for eliminating stores that store the same value that was just loaded.
...
This fixes PR2599.
llvm-svn: 54133
2008-07-28 16:14:26 +00:00
Dan Gohman
9742f7772d
Rename SDOperand to SDValue.
...
llvm-svn: 54128
2008-07-27 21:46:04 +00:00
Dan Gohman
1ecbcecdf3
Put the LICM of constant GlobalVariables, introduced in r53945, under a
...
command-line option, and disable it by default. It introduced performance
regressions because CodeGen is currently not able to remat such loads.
llvm-svn: 53997
2008-07-24 23:57:25 +00:00
Chris Lattner
8eb899ecbc
"Allow LICM to sink or lift loads from constant memory. Also add a test
...
case for this.
This allows instructions like loads from global variables declared to
be constant to be moved out of loops."
Patch by Stefanus Du Toit!
llvm-svn: 53945
2008-07-23 05:06:28 +00:00
Dan Gohman
6564581be0
Enable first-class aggregates support.
...
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.
The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.
llvm-svn: 53941
2008-07-23 00:34:11 +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
Duncan Sands
b4646d7dbe
Supress a gcc-4.3 warning.
...
llvm-svn: 53771
2008-07-18 21:06:02 +00:00
Owen Anderson
8500aba55a
Make PRE actually handle critical edges (by splitting them). Confirmed that bootstrap passes with this change.
...
llvm-svn: 53762
2008-07-18 18:03:38 +00:00
Owen Anderson
bba5ddaf0f
Reapply r53735. My last patch fixed the failures Dan observed.
...
llvm-svn: 53761
2008-07-18 17:49:43 +00:00
Owen Anderson
736e4b3a3f
Add some checks that got lost in the shuffle. This fixes 464.h264ref.
...
llvm-svn: 53760
2008-07-18 17:46:41 +00:00
Dan Gohman
4dc7526774
Revert r53735. It broke SPEC 464.h264ref.
...
llvm-svn: 53757
2008-07-18 16:44:49 +00:00
Owen Anderson
8e971c22fd
Use MergeBlockIntoPredecessor to simplify some code.
...
llvm-svn: 53735
2008-07-17 20:00:46 +00:00
Owen Anderson
cb787a2004
Make MergeBlockIntoPredecessor more aggressive when the same successor appears
...
more than once.
llvm-svn: 53731
2008-07-17 19:42:29 +00:00
Owen Anderson
5524271234
Enable PRE. My last batch of changes fixed the miscompile.
...
llvm-svn: 53730
2008-07-17 19:41:00 +00:00
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