Commit Graph

4087 Commits

Author SHA1 Message Date
Devang Patel
8dbd9ada30 Remove useless check.
Patch by Matthijs Kooijman.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51154 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-15 18:04:29 +00:00
Duncan Sands
9c0d50ecae Use of UINT_MAX requires climits, at least when
compiling with gcc 4.3.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51145 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-15 11:22:50 +00:00
Gabor Greif
b1dbcd886a Fix a bunch of 80col violations that arose from the Create API change. Tweak makefile targets to find these better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-15 10:04:30 +00:00
Bill Wendling
a6c3112b1f Situations can arise when you have a function called that returns a 'void', but
is bitcast to return a floating point value. The result of the instruction may
not be used by the program afterwards, and LLVM will happily remove all
instructions except the call. But, on some platforms, if a value is returned as
a floating point, it may need to be removed from the stack (like x87). Thus, we
can't get rid of the bitcast even if there isn't a use of the value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 22:45:20 +00:00
Chris Lattner
4186ad56cf rename SimplifyCFG.cpp -> SimplifyCFGPass.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51130 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 20:38:44 +00:00
Devang Patel
ef3682a4fb Simplify internalize pass. Add test case.
Patch by Matthijs Kooijman!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51114 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 20:01:01 +00:00
Dan Gohman
45b3197090 Split the loop unroll mechanism logic out into a utility function.
Patch by Matthijs Kooijman!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 00:24:14 +00:00
Owen Anderson
c4f406e736 Fix Analysis/BasicAA/pure-const-dce.ll. This turned out to be a correctness
bug as well as a missed optimization.  We weren't properly checking for local
dependencies before moving on to non-local ones when doing non-local read-only 
call CSE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 23:18:30 +00:00
Dale Johannesen
72997fedab Fix for PR 2323, infinite loop in tail dup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 20:06:43 +00:00
Owen Anderson
16db1f70b7 Make the non-local CSE safety checks slightly more thorough.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51035 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 13:41:23 +00:00
Owen Anderson
3b3f58cb77 Add support for non-local CSE of read-only calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51024 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 08:17:22 +00:00
Dan Gohman
6ddba2b933 Change class' public PassInfo variables to by initialized with the
address of the PassInfo directly instead of calling getPassInfo.
This eliminates a bunch of dynamic initializations of static data.

Also, fold RegisterPassBase into PassInfo, make a bunch of its
data members const, and rearrange some code to initialize data
members in constructors instead of using setter member functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51022 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 02:05:11 +00:00
Nate Begeman
a72acf9389 80 col / tabs fixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51021 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 01:48:26 +00:00
Dan Gohman
844731a7f1 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 00:00:25 +00:00
Owen Anderson
a472c4a280 Go back to passing the analyses around as parameters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50995 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-12 20:15:55 +00:00
Owen Anderson
7b45e33107 Move the various analyses used by GVN into static variables so we don't have to keep passing them around or refetching them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50963 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-12 08:15:27 +00:00
Chris Lattner
5c8e8d7fc5 Fix various DOUTs to not call the extremely expensive Value::getName()
method.  DOUT statements are disabled when assertions are off, but the
side effects of getName() are still evaluated.  Just call getNameSTart,
which is close enough and doesn't cause heap traffic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50958 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-11 01:55:59 +00:00
Chris Lattner
3a73c9e5f9 Simplify code by using SwitchInst::findCaseValue instead of reimplementing it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50957 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-10 23:56:54 +00:00
Chris Lattner
bfc538c09e don't sink invokes, even if they are readonly. This fixes a
crash on kimwitu++.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50901 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09 15:07:33 +00:00
Duncan Sands
33af59d0f0 Fix a type and formatting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50900 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09 12:20:10 +00:00
Chris Lattner
7d2cbd2d43 Implement PR2298. This transforms:
~x < ~y --> y < x
   -x == -y --> x == y



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50882 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09 05:19:28 +00:00
Chris Lattner
94019f8e06 restore doxygen comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50881 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09 04:43:13 +00:00
Gordon Henriksen
a8a118b68f Improve pass documentation and comments.
Patch by Matthijs Kooijman!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50861 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 17:46:35 +00:00
Chris Lattner
2539e33893 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50860 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 17:37:37 +00:00
Chris Lattner
0ef546e639 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50859 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 17:20:30 +00:00
Devang Patel
d7266d484a Check linkage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50851 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 15:08:39 +00:00
Anton Korobeynikov
0b12ecf6ff Turn StripPointerCast() into a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 22:54:15 +00:00
Dan Gohman
42ac929ed9 Fix a bug in the ComputeMaskedBits logic for multiply.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50793 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 00:35:55 +00:00
Anton Korobeynikov
b04adddd50 Make StripPointerCast a common function (should we mak it method of Value instead?)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50775 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 22:52:30 +00:00
Owen Anderson
8b23bb792e We need to update PHIs containing the exiting block, not the exit block. We really should come up with better names for these.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50770 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 20:55:16 +00:00
Devang Patel
d1e50edf5a Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50713 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 05:40:11 +00:00
Chris Lattner
9b34849a6b fix typo Duncan noticed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50699 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 02:31:18 +00:00
Dan Gohman
4a3f6c8882 Make several variable declarations static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 01:53:16 +00:00
Dan Gohman
84b7df43fb Remove uses of llvm/System/IncludeFile.h that are no longer needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 01:32:53 +00:00
Dan Gohman
23e1df8b8d Correct the value of LowBits in srem and urem handling in
ComputeMaskedBits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 00:51:48 +00:00
Bill Wendling
ac17822206 Fix: Some classes were derived from a class in an anonymous namespace, but they
themselves weren't in the anonymous namespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50673 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 21:37:59 +00:00
Chris Lattner
8554cc2ea7 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50667 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 20:21:22 +00:00
Torok Edwin
529bd53411 processStore may delete the instruction, avoid
using dyn_cast<> on already freed memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50618 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-04 08:51:25 +00:00
Devang Patel
7b39969528 Handle multiple return values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-03 01:12:15 +00:00
Devang Patel
f944c9a19e Do not sink getresult.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-03 00:36:30 +00:00
Dan Gohman
1d9cd50677 Fix a mistake in the computation of leading zeros for udiv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 21:30:02 +00:00
Chris Lattner
e818f770bb strength reduce exp2 into ldexp, rdar://5852514
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50586 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 18:43:35 +00:00
Chris Lattner
4446997e0a add a FIXME so we remember to eventually remove this code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50582 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 17:18:31 +00:00
Bill Wendling
643310da6d Porting r50563 from Tak to mainline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50564 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 00:43:20 +00:00
Dale Johannesen
796026711d Don't try to create PHIs of struct types. Fallout
from x86-64 calling convention work.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50545 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 22:27:44 +00:00
Dan Gohman
e85b7585e9 Fix an overaggressive SimplifyDemandedBits optimization on urem. This
fixes the 254.gap regression on x86 and the 403.gcc regression on x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50537 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 19:13:24 +00:00
Chris Lattner
56b4f2bdf6 1) add '-debug' output
2) Return NULL instead of false in several places for tidiness.
3) fix a bug optimizing  sprintf(p, "%c", x)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50521 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 06:39:12 +00:00
Chris Lattner
fd1cbbe9cf 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50520 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 06:25:24 +00:00
Owen Anderson
5023aa58ca This condition got inverted accidentally.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50473 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 07:16:33 +00:00
Chris Lattner
69ea9d2308 move lowering of llvm.memset -> store from simplify libcalls
to instcombine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50472 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 06:39:11 +00:00