Commit Graph

3057 Commits

Author SHA1 Message Date
Dale Johannesen
e6ec25543f Fix the time regression I introduced in 464.h264ref with
my last patch to this file.

The issue there was that all uses of an IV inside a loop
are actually references to Base[IV*2], and there was one
use outside that was the same but LSR didn't see the base
or the scaling because it didn't recurse into uses outside
the loop; thus, it used base+IV*scale mode inside the loop
instead of pulling base out of the loop.  This was extra bad
because register pressure later forced both base and IV into
memory.  Doing that recursion, at least enough
to figure out addressing modes, is a good idea in general;
the change in AddUsersIfInteresting does this.  However,
there were side effects....

It is also possible for recursing outside the loop to
introduce another IV where there was only 1 before (if
the refs inside are not scaled and the ref outside is).
I don't think this is a common case, but it's in the testsuite.
It is right to be very aggressive about getting rid of
such introduced IVs (CheckForIVReuse and the handling of
nonzero RewriteFactor in StrengthReduceStridedIVUsers).
In the testcase in question the new IV produced this way
has both a nonconstant stride and a nonzero base, neither
of which was handled before.  And when inserting 
new code that feeds into a PHI, it's right to put such 
code at the original location rather than in the PHI's 
immediate predecessor(s) when the original location is outside 
the loop (a case that couldn't happen before)
(RewriteInstructionToUseNewBase); better to avoid making
multiple copies of it in this case.

Also, the mechanism for keeping SCEV's corresponding to GEP's
no longer works, as the GEP might change after its SCEV
is remembered, invalidating the SCEV, and we might get a bad
SCEV value when looking up the GEP again for a later loop.  
This also couldn't happen before, as we weren't recursing
into GEP's outside the loop.

I owe some testcases for this, want to get it in for nightly runs.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61362 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 02:12:52 +00:00
Owen Anderson
ae53c932b9 Don't forget to remove phi nodes from the value numbering table after we collapse them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61358 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 00:49:51 +00:00
Bill Wendling
30788b828a Comment clean-ups. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 22:32:22 +00:00
Bill Wendling
6d463f2efc Check that the instruction isn't in the value numbering scope.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 22:28:56 +00:00
Bill Wendling
75f02ee771 Simplification: Negate the operator== method instead of implementing a full operator!= method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61352 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 22:16:31 +00:00
Bill Wendling
70ded19b3f Add verification that deleted instruction isn't hiding in the PHI map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61350 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 22:14:07 +00:00
Bill Wendling
ec40d50aa4 Verify removed in a few more places.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 21:57:30 +00:00
Bill Wendling
246dbbb8be Add verification functions to GVN which check to see that an instruction was
truely deleted. These will be expanded with further checks of all of the data
structures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61347 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-22 21:36:08 +00:00
Nick Lewycky
13a09e298c Turn strcmp into memcmp, such as strcmp(P, "x") --> memcmp(P, "x", 2).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-21 00:19:21 +00:00
Nick Lewycky
9dce873c1a Remove redundant test for vector-nature. Scan the vector first to see whether
our optz'n will apply to it, then build the replacement vector only if needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-20 16:48:00 +00:00
Evan Cheng
ab63152871 - CodeGenPrepare does not split loop back edges but it only knows about back edges of single block loops. It now does a DFS walk to find loop back edges.
- Use SplitBlockPredecessors to factor out common predecessors of the critical edge destination. This is disabled for now due to some regressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 18:03:11 +00:00
Bill Wendling
e533f4e343 Didn't mean to commit this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61222 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 22:19:50 +00:00
Bill Wendling
82c19ae10a Re-XFAIL this test until debug stuff settles down.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61219 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 22:13:31 +00:00
Nick Lewycky
19c2892677 Oops! Left out a line.
Simplifying the sdiv might allow further simplifications for our users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61196 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 06:42:28 +00:00
Nick Lewycky
2a8f6597a3 Make all the vector elements positive in an srem of constant vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 06:31:11 +00:00
Dale Johannesen
a1d9cb1d46 Revert previous patch, appears to break bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61181 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 01:23:41 +00:00
Dale Johannesen
12b882cf53 Fix the time regression I introduced in 464.h264ref with
my last patch to this file.

The issue there was that all uses of an IV inside a loop
are actually references to Base[IV*2], and there was one
use outside that was the same but LSR didn't see the base
or the scaling because it didn't recurse into uses outside
the loop; thus, it used base+IV*scale mode inside the loop
instead of pulling base out of the loop.  This was extra bad
because register pressure later forced both base and IV into
memory.  Doing that recursion, at least enough
to figure out addressing modes, is a good idea in general;
the change in AddUsersIfInteresting does this.  However,
there were side effects....

It is also possible for recursing outside the loop to
introduce another IV where there was only 1 before (if
the refs inside are not scaled and the ref outside is).
I don't think this is a common case, but it's in the testsuite.
It is right to be very aggressive about getting rid of
such introduced IVs (CheckForIVReuse and the handling of
nonzero RewriteFactor in StrengthReduceStridedIVUsers).
In the testcase in question the new IV produced this way
has both a nonconstant stride and a nonzero base, neither
of which was handled before.  (This patch does not handle 
all the cases where this can happen.)  And when inserting 
new code that feeds into a PHI, it's right to put such 
code at the original location rather than in the PHI's 
immediate predecessor(s) when the original location is outside 
the loop (a case that couldn't happen before)
(RewriteInstructionToUseNewBase); better to avoid making
multiple copies of it in this case.

Everything above is exercised in
CodeGen/X86/lsr-negative-stride.ll (and ifcvt4 in ARM which is
the same IR).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61178 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 00:57:22 +00:00
Chris Lattner
5f4f84ba3e reapply this hunk from Bill's reversion in r61169, it is conservative
and safe and orthogonal from turning off load pre.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61177 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-18 00:51:32 +00:00
Bill Wendling
13d10096e1 Temporarily revert r61027. It was causing a bootstrap failure in "release" mode
with everyone's favorite error messages:

Comparing stages 2 and 3
warning: ./cc1-checksum.o differs
warning: ./cc1plus-checksum.o differs
Bootstrap comparison failure!
./c-decl.o differs
./cp/decl.o differs
./df-core.o differs
./gcc.o differs
./i386.o differs
./stor-layout.o differs
./tree-pretty-print.o differs
./tree.o differs
make[2]: *** [compare] Error 1
make[1]: *** [stage3-bubble] Error 2

See PR3227.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61169 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 23:31:20 +00:00
Dale Johannesen
b0390620d4 Clarify that the scale factor from CheckForIVReuse
can be negative.  Keep track of whether all uses of
an IV are outside the loop.  Some cosmetics; no
functional change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61109 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 22:16:28 +00:00
Chris Lattner
2ba3b62149 Enable Load PRE. This teaches GVN to push partially redundant loads up the
CFG when there is exactly one predecessor where the load is not available.
This is designed to not increase code size but still eliminate partially
redundant loads.  This fires 1765 times on 403.gcc even though it doesn't
do critical edge splitting yet (the most common reason for it to fail).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61027 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 05:28:29 +00:00
Owen Anderson
c34d112362 Ifdef out some code that I didn't mean to enable by default yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61024 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 03:52:17 +00:00
Chris Lattner
f33131685b make GVN try to rename inputs to the resultant replaced values, which
cleans up the generated code a bit.  This should have the added benefit of
not randomly renaming functions/globals like my previous patch did. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61023 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 03:46:38 +00:00
Owen Anderson
255dafc5de Add support for slow-path GVN with full phi construction for scalars. This is disabled for now, as it actually pessimizes code in the abscence
of phi translation for load elimination.  This slow down GVN a bit, by about 2% on 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61021 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 02:03:00 +00:00
Chris Lattner
528f16b9fa eliminate warning when asserts disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-14 21:36:23 +00:00
Owen Anderson
cbe1d94031 Generalize GVN's phi construciton routine to work for things other than loads.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61009 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-14 19:10:35 +00:00
Bill Wendling
8295e49e76 Temporarily revert r60973. It's inexplicably causing a failure when self-hosting LLVM:
llvm[2]: Linking Release executable opt (without symbols)
...
Undefined symbols:
  "llvm::APFloat::IEEEsingle", referenced from:
      __ZN4llvm7APFloat10IEEEsingleE$non_lazy_ptr in libLLVMCore.a(Constants.o)
      __ZN4llvm7APFloat10IEEEsingleE$non_lazy_ptr in libLLVMCore.a(AsmWriter.o)
      __ZN4llvm7APFloat10IEEEsingleE$non_lazy_ptr in libLLVMCore.a(ConstantFold.o)
  "llvm::APFloat::IEEEdouble", referenced from:
      __ZN4llvm7APFloat10IEEEdoubleE$non_lazy_ptr in libLLVMCore.a(Constants.o)
      __ZN4llvm7APFloat10IEEEdoubleE$non_lazy_ptr in libLLVMCore.a(AsmWriter.o)
      __ZN4llvm7APFloat10IEEEdoubleE$non_lazy_ptr in libLLVMCore.a(ConstantFold.o)
ld: symbol(s) not found

This is in release mode. To replicate, compile llvm and llvm-gcc in optimized
mode. Then build llvm, in optimized mode, with the newly created compiler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60977 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13 09:28:44 +00:00
Chris Lattner
879922932f make RLE preserve the name of the load that it replaces. This is just
a pretification of the IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-13 07:22:47 +00:00
Chris Lattner
bc99be10b8 Teach GVN to invalidate some memdep information when it does an RAUW
of a pointer.  This allows is to catch more equivalencies.  For example,
the type_lists_compatible_p function used to require two iterations of
the gvn pass (!) to delete its 18 redundant loads because the first pass
would CSE all the addressing computation cruft, which would unblock the
second memdep/gvn passes from recognizing them.  This change allows
memdep/gvn to catch all 18 when run just once on the function (as is 
typical :) instead of just 3.

On all of 403.gcc, this bumps up the # reundandancies found from:

     63 gvn    - Number of instructions PRE'd
 153991 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted
to:
     63 gvn    - Number of instructions PRE'd
 154137 gvn    - Number of instructions deleted
  50185 gvn    - Number of loads deleted

+120 loads deleted isn't bad.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60799 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:06:23 +00:00
Chris Lattner
1559b3625b rename getNonLocalDependency -> getNonLocalCallDependency, and remove
pointer stuff from it, simplifying the code a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60783 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:38:05 +00:00
Chris Lattner
91bcf6450a Switch GVN::processNonLocalLoad to using the new
MemDep::getNonLocalPointerDependency method.  There are
some open issues with this (missed optimizations) and
plenty of future work, but this does allow GVN to eliminate
*slightly* more loads (49246 vs 49033).

Switching over now allows simplification of the other code
path in memdep.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60780 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:25:07 +00:00
Chris Lattner
ae1993114f random cleanups, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:21:47 +00:00
Chris Lattner
46a879ebd3 Fix a really subtle off-by-one bug that Duncan noticed with valgrind
on test/CodeGen/Generic/2007-06-06-CriticalEdgeLandingPad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60739 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 04:47:21 +00:00
Chris Lattner
20fa76ef6f remove DebugIterations option. Despite the accusations,
jump threading has been shown to only expose problems not
have bugs itself.  I'm sure it's completely bug free! ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60725 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 22:44:07 +00:00
Devang Patel
042b877e84 Fix spelling.
Thanks Duncan!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60702 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 17:07:24 +00:00
Devang Patel
6d9896f153 Undo previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60701 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 17:02:37 +00:00
Chris Lattner
f760be1c7f don't bother touching volatile stores, they will just return clobber on
everything interesting anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60640 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:25:15 +00:00
Chris Lattner
5e600e67b1 Reimplement the inner loop of DSE. It now uniformly uses getDependence(),
doesn't do its own local caching, and is slightly more aggressive about
free/store dse (see testcase).  This eliminates the last external client 
of MemDep::getDependenceFrom().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60619 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 00:53:22 +00:00
Dale Johannesen
203af58aea Make LoopStrengthReduce smarter about hoisting things out of
loops when they can be subsumed into addressing modes.

Change X86 addressing mode check to realize that
some PIC references need an extra register.
(I believe this is correct for Linux, if not, I'm sure
someone will tell me.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60608 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 21:47:27 +00:00
Chris Lattner
b51deb929c Make a few major changes to memdep and its clients:
1. Merge the 'None' result into 'Normal', making loads
   and stores return their dependencies on allocations as Normal.
2. Split the 'Normal' result into 'Clobber' and 'Def' to
   distinguish between the cases when memdep knows the value is
   produced from when we just know if may be changed.
3. Move some of the logic for determining whether readonly calls
   are CSEs into memdep instead of it being in GVN.  This still
   leaves verification that the arguments are hte same to GVN to
   let it know about value equivalences in different contexts.
4. Change memdep's call/call dependency analysis to use 
   getModRefInfo(CallSite,CallSite) instead of doing something 
   very weak.  This only really matters for things like DSA, but
   someday maybe we'll have some other decent context sensitive
   analyses :)
5. This reimplements the guts of memdep to handle the new results.
6. This simplifies GVN significantly:
   a) readonly call CSE is slightly simpler
   b) I eliminated the "getDependencyFrom" chaining for load 
      elimination and load CSE doesn't have to worry about 
      volatile (they are always clobbers) anymore.
   c) GVN no longer does any 'lastLoad' caching, leaving it to 
      memdep.
7. The logic in DSE is simplified a bit and sped up.  A potentially
   unsafe case was eliminated.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 21:04:20 +00:00
Anton Korobeynikov
64b535608e Revert invalid r60393. It causes llvm-gcc bootstrap fails in release builds.
See PR3160 for details

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 19:38:49 +00:00
Chris Lattner
7f7c736682 Fix test/Transforms/GVN/pre-load.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60594 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 17:04:12 +00:00
Chris Lattner
72bc70d499 Make IsValueFullyAvailableInBlock safe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60588 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 07:49:08 +00:00
Devang Patel
3831005eb1 Rewrite code that 1) filters loops and 2) calculates new loop bounds.
This fixes many bugs. I will add more test cases in a separate check-in.

Some day, the code that manipulates CFG and updates dom. info could use refactoring help.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 21:38:42 +00:00
Chris Lattner
3cda3cdab1 Start simplifying a switch that has a successor that is a switch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60534 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 06:31:07 +00:00
Chris Lattner
77ee977fcf add a debugging option to help track down j-t problems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60514 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 00:07:59 +00:00
Dale Johannesen
308f24d452 Remove an unused field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 22:43:56 +00:00
Dale Johannesen
544e0d0e52 Fix a misspelled function name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 20:56:12 +00:00
Chris Lattner
29874e0dc6 Factor some code into a new FoldSingleEntryPHINodes method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:44:02 +00:00
Dale Johannesen
67c7989294 Fix a really wrong comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:25:46 +00:00
Chris Lattner
421fa9e32e Teach jump threading some more simple tricks:
1) have it fold "br undef", which does occur with
   surprising frequency as jump threading iterates.
2) teach j-t to delete dead blocks.  This removes the successor
   edges, reducing the in-edges of other blocks, allowing 
   recursive simplification.
3) Fold things like:
     br COND, BBX, BBY
  BBX:
     br COND, BBZ, BBW

   which also happens because jump threading iterates.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60470 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 07:48:08 +00:00
Dale Johannesen
fb10cd4901 Minor rewrite per review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 21:17:11 +00:00
Dale Johannesen
eccdd08d4c Make the code do what the comment says it does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60431 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 18:40:09 +00:00
Chris Lattner
c89c6a964c Implement PRE of loads in the GVN pass with a pretty cheap and
straight-forward implementation.  This does not require any extra
alias analysis queries beyond what we already do for non-local loads.

Some programs really really like load PRE.  For example, SPASS triggers
this ~1000 times, ~300 times in 255.vortex, and ~1500 times on 403.gcc.

The biggest limitation to the implementation is that it does not split
critical edges.  This is a huge killer on many programs and should be
addressed after the initial patch is enabled by default.

The implementation of this should incidentally speed up rejection of 
non-local loads because it avoids creating the repl densemap in cases 
when it won't be used for fully redundant loads.

This is currently disabled by default.
Before I turn this on, I need to fix a couple of miscompilations in
the testsuite, look at compile time performance numbers, and look at
perf impact.  This is pretty close to ready though.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 08:16:11 +00:00
Bill Wendling
286a054908 Remove some errors that crept in. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60403 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 06:24:20 +00:00
Bill Wendling
d16c6e9993 Merge two if-statements into one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 06:22:04 +00:00
Bill Wendling
29976b9e12 More styalistic changes. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60401 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 06:18:11 +00:00
Bill Wendling
3bdcda82a5 - Remove the buggy -X/C -> X/-C transform. This isn't valid when X isn't a
constant. If X is a constant, then this is folded elsewhere.

- Added a note to Target/README.txt to indicate that we'd like to implement
  this when we're able.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60399 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 05:12:47 +00:00
Bill Wendling
a8bb13f989 Improve comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60398 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 05:09:00 +00:00
Bill Wendling
dda74e0702 - Reduce nesting.
- No need to do a swap on a canonicalized pattern.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60397 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 05:06:43 +00:00
Chris Lattner
f8828eb41b some random comment improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60395 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 04:52:26 +00:00
Owen Anderson
912c49d169 Fix an issue that Chris noticed, where local PRE was not properly instantiating
a new value numbering set after splitting a critical edge.  This increases
the number of instances of PRE on 403.gcc from ~60 to ~570.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60393 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 04:09:22 +00:00
Dale Johannesen
589bf0865c Consider only references to an IV within the loop when
figuring out the base of the IV.  This produces better
code in the example.  (Addresses use (IV) instead of 
(BASE,IV) - a significant improvement on low-register
machines like x86).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60374 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 22:00:01 +00:00
Bill Wendling
57036da328 Don't rebuild RHSNeg. Just use the one that's already there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60370 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 21:06:30 +00:00
Bill Wendling
69fffa5437 Document what this check is doing. Also, no need to cast to ConstantInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 21:03:43 +00:00
Bill Wendling
c25c68305c Use a simple comparison. Overflow on integer negation can only occur when the
integer is "minint".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60366 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 19:46:27 +00:00
Bill Wendling
d54d86038d Generalize the FoldOrWithConstant method to fold for any two constants which
don't have overlapping bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60344 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 08:32:40 +00:00
Bill Wendling
a698a472f2 Reduce copy-and-paste code by splitting out the code into its own function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60343 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 08:23:25 +00:00
Bill Wendling
03aae5f7e1 Use m_Specific() instead of double matching.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60341 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 08:09:47 +00:00
Bill Wendling
9c531a0f07 Move pattern check outside of the if-then statement. This prevents us from fiddling with constants unless we have to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60340 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 07:47:02 +00:00
Chris Lattner
d0f5bfc9be Rename some variables, only increment BI once at the start of the loop instead of throughout it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60339 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 07:35:54 +00:00
Chris Lattner
09713794c1 pull the predMap densemap out of the inner loop of performPRE, so
that it isn't reallocated all the time.  This is a tiny speedup for
GVN: 3.90->3.88s


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60338 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 07:29:03 +00:00
Chris Lattner
a3522000ab switch a couple more calls to use array_pod_sort.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60337 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:52:57 +00:00
Chris Lattner
99d0015735 Introduce a new array_pod_sort function and switch LSR to use it
instead of std::sort.  This shrinks the release-asserts LSR.o file
by 1100 bytes of code on my system.

We should start using array_pod_sort where possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60335 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:49:59 +00:00
Chris Lattner
09fb7dadf1 Eliminate use of setvector for the DeadInsts set, just use a smallvector.
This is a lot cheaper and conceptually simpler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60332 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:27:41 +00:00
Chris Lattner
a68d4ca73e DeleteTriviallyDeadInstructions is always passed the
DeadInsts ivar, just use it directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60330 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:14:28 +00:00
Chris Lattner
bfcee36cd7 simplify DeleteTriviallyDeadInstructions again, unlike my previous
buggy rewrite, this notifies ScalarEvolution of a pending instruction
about to be removed and then erases it, instead of erasing it then 
notifying.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60329 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:11:32 +00:00
Chris Lattner
d8aafcb200 simplify these patterns using m_Specific. No need to grep for
xor in testcase (or is a substring).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60328 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 05:16:26 +00:00
Chris Lattner
ef0c6744d5 Teach jump threading to clean up after itself, DCE and constfolding the
new instructions it simplifies.  Because we're threading jumps on edges
with constants coming in from PHI's, we inherently are exposing a lot more
constants to the new block.  Folding them and deleting dead conditions
allows the cost model in jump threading to be more accurate as it iterates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60327 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 04:48:07 +00:00
Chris Lattner
38b3dcc465 Change instcombine to use FoldPHIArgGEPIntoPHI to fold two operand PHIs
instead of using FoldPHIArgBinOpIntoPHI.  In addition to being more
obvious, this also fixes a problem where instcombine wouldn't merge two
phis that had different variable indices.  This prevented instcombine
from factoring big chunks of code in 403.gcc.  For example:

 insn_cuid.exit:                
-       %tmp336 = load i32** @uid_cuid, align 4      
-       %tmp337 = getelementptr %struct.rtx_def* %insn_addr.0.ph.i, i32 0, i32 3    
-       %tmp338 = bitcast [1 x %struct.rtunion]* %tmp337 to i32*               
-       %tmp339 = load i32* %tmp338, align 4           
-       %tmp340 = getelementptr i32* %tmp336, i32 %tmp339     
        br label %bb62
 
 bb61:       
-       %tmp341 = load i32** @uid_cuid, align 4     
-       %tmp342 = getelementptr %struct.rtx_def* %insn, i32 0, i32 3        
-       %tmp343 = bitcast [1 x %struct.rtunion]* %tmp342 to i32*           
-       %tmp344 = load i32* %tmp343, align 4        
-       %tmp345 = getelementptr i32* %tmp341, i32 %tmp344          
        br label %bb62
 
 bb62:      
-       %iftmp.62.0.in = phi i32* [ %tmp345, %bb61 ], [ %tmp340, %insn_cuid.exit ]         
+       %insn.pn2 = phi %struct.rtx_def* [ %insn, %bb61 ], [ %insn_addr.0.ph.i, %insn_cuid.exit ]         
+       %tmp344.pn.in.in = getelementptr %struct.rtx_def* %insn.pn2, i32 0, i32 3     
+       %tmp344.pn.in = bitcast [1 x %struct.rtunion]* %tmp344.pn.in.in to i32*  
+       %tmp341.pn = load i32** @uid_cuid     
+       %tmp344.pn = load i32* %tmp344.pn.in 
+       %iftmp.62.0.in = getelementptr i32* %tmp341.pn, i32 %tmp344.pn   
        %iftmp.62.0 = load i32* %iftmp.62.0.in     



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60325 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 03:42:51 +00:00
Chris Lattner
05f18920e1 Teach inst combine to merge GEPs through PHIs. This is really
important because it is sinking the loads using the GEPs, but
not the GEPs themselves.  This triggers 647 times on 403.gcc
and makes the .s file much much nicer.  For example before:

        je      LBB1_87 ## bb78
LBB1_62:        ## bb77
        leal    84(%esi), %eax
LBB1_63:        ## bb79
        movl    (%eax), %eax
...
LBB1_87:        ## bb78
        movl    $0, 4(%esp)
        movl    %esi, (%esp)
        call    L_make_decl_rtl$stub
        jmp     LBB1_62 ## bb77


after:

        jne     LBB1_63 ## bb79
LBB1_62:        ## bb78
        movl    $0, 4(%esp)
        movl    %esi, (%esp)
        call    L_make_decl_rtl$stub
LBB1_63:        ## bb79
        movl    84(%esi), %eax

The input code was (and the GEPs are merged and
the PHI is now eliminated by instcombine):

        br i1 %tmp233, label %bb78, label %bb77
bb77:           
        %tmp234 = getelementptr %struct.tree_node* %t_addr.3, i32 0, i32 0, i32 22              
        br label %bb79
bb78:           
        call void @make_decl_rtl(%struct.tree_node* %t_addr.3, i8* null) nounwind
        %tmp235 = getelementptr %struct.tree_node* %t_addr.3, i32 0, i32 0, i32 22              
        br label %bb79
bb79:           
        %iftmp.12.0.in = phi %struct.rtx_def** [ %tmp235, %bb78 ], [ %tmp234, %bb77 ]           
        %iftmp.12.0 = load %struct.rtx_def** %iftmp.12.0.in             



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60322 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 02:34:36 +00:00
Chris Lattner
978796eaad Make GVN be more intelligent about redundant load
elimination: when finding dependent load/stores, realize that
they are the same if aliasing claims must alias instead of relying
on the pointers to be exactly equal.  This makes load elimination
more aggressive.  For example, on 403.gcc, we had:

<     68 gvn    - Number of instructions PRE'd
< 152718 gvn    - Number of instructions deleted
<  49699 gvn    - Number of loads deleted
<   6153 memdep - Number of dirty cached non-local responses
< 169336 memdep - Number of fully cached non-local responses
< 162428 memdep - Number of uncached non-local responses

now we have:

>     64 gvn    - Number of instructions PRE'd
> 153623 gvn    - Number of instructions deleted
>  49856 gvn    - Number of loads deleted
>   5022 memdep - Number of dirty cached non-local responses
> 159030 memdep - Number of fully cached non-local responses
> 162443 memdep - Number of uncached non-local responses

That's an extra 157 loads deleted and extra 905 other instructions nuked.

This slows down GVN very slightly, from 3.91 to 3.96s.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60314 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 01:31:36 +00:00
Chris Lattner
bf145d6e2b Reimplement the non-local dependency data structure in terms of a sorted
vector instead of a densemap.  This shrinks the memory usage of this thing
substantially (the high water mark) as well as making operations like
scanning it faster.  This speeds up memdep slightly, gvn goes from
3.9376 to 3.9118s on 403.gcc

This also splits out the statistics for the cached non-local case to
differentiate between the dirty and clean cached case.  Here's the stats
for 403.gcc:

  6153 memdep - Number of dirty cached non-local responses
169336 memdep - Number of fully cached non-local responses
162428 memdep - Number of uncached non-local responses

yay for caching :)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 01:15:42 +00:00
Bill Wendling
b3833d1eb9 Implement ((A|B)&1)|(B&-2) -> (A&1) | B transformation. This also takes care of
permutations of this pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 01:07:11 +00:00
Chris Lattner
663e441a75 Cache analyses in ivars and add some useful DEBUG output.
This speeds up GVN from 4.0386s to 3.9376s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60310 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 00:40:32 +00:00
Chris Lattner
1440ac5417 improve indentation, do cheap checks before expensive ones,
remove some fixme's.  This speeds up GVN very slightly on 403.gcc 
(4.06->4.03s)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60309 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 23:39:23 +00:00
Eli Friedman
8b019c8a45 Minor cleanup: use getTrue and getFalse where appropriate. No
functional change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60307 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 22:48:49 +00:00
Eli Friedman
d1fd1da143 Some minor cleanups to instcombine; no functionality change.
Note that the FoldOpIntoPhi call is dead because it's impossible for the 
first operand of a subtraction to be both a ConstantInt and a PHINode.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60306 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 21:09:11 +00:00
Bill Wendling
b01865c210 Add instruction combining for ((A&~B)|(~A&B)) -> A^B and all permutations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 13:52:49 +00:00
Bill Wendling
7f0ef6b325 Implement (A&((~A)|B)) -> A&B transformation in the instruction combiner. This
takes care of all permutations of this pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60290 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 13:08:13 +00:00
Bill Wendling
7c7048ecc6 Forgot one remaining call to getSExtValue().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 12:41:09 +00:00
Bill Wendling
6e1783fb4a getSExtValue() doesn't work for ConstantInts with bitwidth > 64 bits. Use all
APInt calls instead.

This fixes PR3144.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 12:38:24 +00:00
Eli Friedman
d83ae7d698 Optimize memmove and memset into the LLVM builtins. Note that these
only show up in code from front-ends besides llvm-gcc, like clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60287 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 08:32:11 +00:00
Bill Wendling
3f93df5733 Don't make TwoToExp signed by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 05:29:33 +00:00
Bill Wendling
f0e44c4d7a From Hacker's Delight:
"For signed integers, the determination of overflow of x*y is not so simple. If
x and y have the same sign, then overflow occurs iff xy > 2**31 - 1. If they
have opposite signs, then overflow occurs iff xy < -2**31."

In this case, x == -1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60278 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 05:01:05 +00:00
Bill Wendling
e1196d6d3e Instcombine was illegally transforming -X/C into X/-C when either X or C
overflowed on negation. This commit checks to make sure that neithe C nor X
overflows. This requires that the RHS of X (a subtract instruction) be a
constant integer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60275 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 03:42:12 +00:00
Chris Lattner
237a828745 Fix a fixme by making memdep's handling of allocations more logical.
If we see that a load depends on the allocation of its memory with no
intervening stores, we now return a 'None' depedency instead of "Normal".
This tweaks GVN to do its optimization with the new result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60267 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:39:32 +00:00
Chris Lattner
4f8c18c7c7 Eliminate the dropInstruction method, which is not needed any more.
Fix a subtle iterator invalidation bug I introduced in the last commit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60258 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 23:30:39 +00:00
Chris Lattner
396a4a55e5 Change MemDep::getNonLocalDependency to return its results as
a smallvector instead of a DenseMap.  This speeds up GVN by 5%
on 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60255 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 21:33:22 +00:00
Chris Lattner
86b29ef64a reimplement getNonLocalDependency with a simpler worklist
formulation that is faster and doesn't require nonLazyHelper.
Much less code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 21:22:42 +00:00
Chris Lattner
3a76be584b Fix a thinko that manifested as a crash on clamav last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 20:29:04 +00:00
Chris Lattner
5391a1d804 Split getDependency into getDependency and getDependencyFrom, the
former does caching, the later doesn't.  This dramatically simplifies
the logic in getDependency and getDependencyFrom.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60234 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 03:47:00 +00:00
Bill Wendling
411052bb96 Temporarily revert r60195. It's causing an optimized bootstrap of llvm-gcc to fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60233 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 03:43:04 +00:00
Chris Lattner
4c72400625 Introduce and use a new MemDepResult class to hold the results of a memdep
query.  This makes it crystal clear what cases can escape from MemDep that
the clients have to handle.  This also gives the clients a nice simplified
interface to it that is easy to poke at.

This patch also makes DepResultTy and MemoryDependenceAnalysis::DepType
private, yay.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60231 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 02:29:27 +00:00
Chris Lattner
39f372e23e Reimplement the internal abstraction used by MemDep in terms
of a pointer/int pair instead of a manually bitmangled pointer.
This forces clients to think a little more about checking the 
appropriate pieces and will be useful for internal 
implementation improvements later.

I'm not particularly happy with this.  After going through this
I don't think that the clients of memdep should be exposed to
the internal type at all.  I'll fix this in a subsequent commit.

This has no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60230 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 01:43:36 +00:00
Chris Lattner
5425f22fa3 don't revisit instructions off the beginning of the block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60221 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 22:50:08 +00:00
Chris Lattner
565f96b196 simplify some code, remove escaped newline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60213 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 21:29:52 +00:00
Chris Lattner
f5102a0f08 don't call MergeBasicBlockIntoOnlyPred on a block whose only
predecessor is itself.  This doesn't make sense, and this is
a dead infinite loop anyway.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60210 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 19:54:49 +00:00
Chris Lattner
925451e020 rewrite a big chunk of how DSE does recursive dead operand
elimination to use more modern infrastructure.  Also do a bunch
of small cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60201 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 00:27:14 +00:00
Chris Lattner
1363949380 Simplify LoopStrengthReduce::DeleteTriviallyDeadInstructions by
making it use RecursivelyDeleteTriviallyDeadInstructions to do
the heavy lifting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 23:23:35 +00:00
Chris Lattner
a0d4486073 use continue to reduce indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60192 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 23:00:20 +00:00
Chris Lattner
3481f24c06 remove doConstantPropagation and dceInstruction, they are just
wrappers around the interesting code and use an obscure iterator
abstraction that dates back many many years.

Move EraseDeadInstructions to Transforms/Utils and name it
RecursivelyDeleteTriviallyDeadInstructions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60191 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 22:57:53 +00:00
Chris Lattner
15678533f3 simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60190 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 22:56:14 +00:00
Chris Lattner
cb03f8547d simplify this logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60189 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 22:46:09 +00:00
Nick Lewycky
8ca5248522 Chris prefers icmp/select over udiv!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60187 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 22:41:10 +00:00
Nick Lewycky
895f085385 Add a couple of missed optimizations on integer vectors. Multiply and divide
by 1, as well as multiply by -1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60182 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 20:21:08 +00:00
Chris Lattner
9918fb5631 defensive patch: if CGP is merging a block with the entry block, make sure
it ends up being the entry block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 19:29:14 +00:00
Chris Lattner
3d86d242c6 Fix PR3138: if we merge the entry block into another block, make sure to
move the other block back up into the entry position!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60179 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 19:25:19 +00:00
Chris Lattner
4aebaee0e4 switch InstCombine::visitLoadInst to use
FindAvailableLoadedValue


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60169 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 08:56:30 +00:00
Chris Lattner
52c95856b4 move FindAvailableLoadedValue from JumpThreading to Transforms/Utils.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60166 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 08:10:05 +00:00
Chris Lattner
3c4f8b91ef Use the new MergeBasicBlockIntoOnlyPred function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 07:54:12 +00:00
Chris Lattner
b29714a10a move MergeBasicBlockIntoOnlyPred to Transforms/Utils.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60162 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 07:43:12 +00:00
Chris Lattner
c7bcbf6903 rename ThreadBlock to ProcessBlock, since it does other things than
just simple threading.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 07:20:04 +00:00
Chris Lattner
69e067fdd8 Make jump threading substantially more powerful, in the following ways:
1. Make it fold blocks separated by an unconditional branch.  This enables
   jump threading to see a broader scope.
2. Make jump threading able to eliminate locally redundant loads when they
   feed the branch condition of a block.  This frequently occurs due to
   reg2mem running.
3. Make jump threading able to eliminate *partially redundant* loads when
   they feed the branch condition of a block.  This is common in code with
   lots of loads and stores like C++ code and 255.vortex.

This implements thread-loads.ll and rdar://6402033.

Per the fixme's, several pieces of this should be moved into Transforms/Utils.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60148 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 05:07:53 +00:00
Chris Lattner
ab8b794a78 Turn on my codegen prepare heuristic by default. It doesn't affect
performance in most cases on the Grawp tester, but does speed some 
things up (like shootout/hash by 15%).  This also doesn't impact 
compile time in a noticable way on the Grawp tester.

It also, of course, gets the testcase it was designed for right :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60120 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 22:16:44 +00:00
Chris Lattner
695d8ec33b teach the new heuristic how to handle inline asm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60088 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 04:59:11 +00:00
Chris Lattner
896617b776 Improve ValueAlreadyLiveAtInst with a cheap and dirty, but effective
heuristic: the value is already live at the new memory operation if
it is used by some other instruction in the memop's block.  This is
cheap and simple to compute (moreso than full liveness).

This improves the new heuristic even more.  For example, it cuts two
out of three new instructions out of 255.vortex:DbmFileInGrpHdr, 
which is one of the functions that the heuristic regressed.  This
overall eliminates another 40 instructions from 403.gcc and visibly
reduces register pressure in 255.vortex (though this only actually
ends up saving the 2 instructions from the whole program).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60084 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 03:20:37 +00:00
Chris Lattner
84d1b40d44 Start rewroking a subpiece of the profitability heuristic to be
phrased in terms of liveness instead of as a horrible hack.  :)

In pratice, this doesn't change the generated code for either 
255.vortex or 403.gcc, but it could cause minor code changes in 
theory.  This is framework for coming changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 03:02:41 +00:00
Chris Lattner
653b2581df add a comment, make save/restore logic more obvious.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60076 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 02:11:11 +00:00
Chris Lattner
5eecb7f164 This adds in some code (currently disabled unless you pass
-enable-smarter-addr-folding to llc) that gives CGP a better
cost model for when to sink computations into addressing modes.
The basic observation is that sinking increases register 
pressure when part of the addr computation has to be available
for other reasons, such as having a use that is a non-memory
operation.  In cases where it works, it can substantially reduce
register pressure.

This code is currently an overall win on 403.gcc and 255.vortex
(the two things I've been looking at), but there are several 
things I want to do before enabling it by default:

1. This isn't doing any caching of results, so it is much slower 
   than it could be.  It currently slows down release-asserts llc 
   by 1.7% on 176.gcc: 27.12s -> 27.60s.
2. This doesn't think about inline asm memory operands yet.
3. The cost model botches the case when the needed value is live
   across the computation for other reasons.

I'll continue poking at this, and eventually turn it on as llcbeta.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60074 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 02:00:14 +00:00
Evan Cheng
794a7dbce0 Revert r60042. IndVarSimplify should check if APFloat is PPCDoubleDouble first before trying to convert it to an integer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 01:11:57 +00:00
Chris Lattner
2efbbb38ba Teach CodeGenPrepare to look through Bitcast instructions when attempting to
optimize addressing modes.  This allows us to optimize things like isel-sink2.ll
into:

	movl	4(%esp), %eax
	cmpb	$0, 4(%eax)
	jne	LBB1_2	## F
LBB1_1:	## TB
	movl	$4, %eax
	ret
LBB1_2:	## F
	movzbl	7(%eax), %eax
	ret

instead of:

_test:
	movl	4(%esp), %eax
	cmpb	$0, 4(%eax)
	leal	4(%eax), %eax
	jne	LBB1_2	## F
LBB1_1:	## TB
	movl	$4, %eax
	ret
LBB1_2:	## F
	movzbl	3(%eax), %eax
	ret

This shrinks (e.g.) 403.gcc from 1133510 to 1128345 lines of .s.

Note that the 2008-10-16-SpillerBug.ll testcase is dubious at best, I doubt
it is really testing what it thinks it is.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60068 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 00:26:16 +00:00
Chris Lattner
3b48501adc Teach MatchScaledValue to handle Scales by 1 with MatchAddr (which
can recursively match things) and scales by 0 by ignoring them.
This triggers once in 403.gcc, saving 1 (!!!!) instruction in the 
whole huge app.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60013 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 07:25:26 +00:00
Chris Lattner
88a5c832ac significantly refactor all the addressing mode matching logic
into a new AddressingModeMatcher class.  This makes it easier
to reason about and reduces passing around of stuff, but has
no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 07:09:13 +00:00
Chris Lattner
bb3204a440 refactor all the constantexpr/instruction handling code out into a
new FindMaximalLegalAddressingModeForOperation helper method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60011 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 05:15:49 +00:00
Chris Lattner
7ad1c7342b another minor tweak
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60010 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 04:47:41 +00:00
Chris Lattner
088a1e84ea minor cleanups no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60009 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 04:42:10 +00:00
Chris Lattner
85fa13c02d rearrange and tidy some code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59990 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 22:44:16 +00:00
Chris Lattner
4744d85c50 minor cleanups to debug code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59989 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 22:40:05 +00:00
Chris Lattner
ae297f8da5 reenable the right part of the code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59985 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 21:26:21 +00:00
Chris Lattner
7f2d6efbaa revert an accidental commit, this fixes the regression on test/CodeGen/X86/isel-sink.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59976 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 19:40:34 +00:00
Chris Lattner
47f5751c80 Fix 3113: If we have a dead cyclic PHI, replace the whole thing
with an undef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59972 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 19:25:36 +00:00
Devang Patel
50cacb2a52 Fix build failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59844 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 21:00:20 +00:00
Devang Patel
59500c8f9a Silence unused variable warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59841 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 20:00:59 +00:00
Chris Lattner
824b958e6f reapply Sanjiv's patch to genericize memcpy/memset/memmove to take an
arbitrary integer width for the count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59823 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 16:42:48 +00:00
Bill Wendling
dc770929cb Revert r59802. It was breaking the build of llvm-gcc:
g++ -m32 -c -g -DIN_GCC -W -Wall -Wwrite-strings -Wmissing-format-attribute -fno-common -mdynamic-no-pic -DHAVE_CONFIG_H -Wno-unused -DTARGET_NAME=\"i386-apple-darwin9.5.0\" -I. -I. -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/. -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include  -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include -DENABLE_LLVM -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/../llvm.src/include  -D_DEBUG  -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS   -I. -I. -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/. -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include  -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include ../../llvm-gcc.src/gcc/llvm-types.cpp -o llvm-types.o
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemCpy(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1496: error: 'memcpy_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1496: error: 'memcpy_i64' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemMove(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1512: error: 'memmove_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1512: error: 'memmove_i64' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemSet(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1528: error: 'memset_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1528: error: 'memset_i64' is not a member of 'llvm::Intrinsic'
make[3]: *** [llvm-convert.o] Error 1
make[3]: *** Waiting for unfinished jobs....
rm fsf-funding.pod gcov.pod gfdl.pod cpp.pod gpl.pod gcc.pod
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59809 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 09:09:41 +00:00
Sanjiv Gupta
219ab405e6 Make mem[cpy,move,set] intrinsics overloaded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 07:49:09 +00:00
Nick Lewycky
0c73079855 Optimize (x/y)*y into x-(x%y) in general. Div and rem are about the same, and
a subtract is cheaper than a multiply. This generalizes an existing transform.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59800 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 07:33:58 +00:00
Devang Patel
cb9a354d13 Fix unused variable warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59778 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 01:52:59 +00:00
Devang Patel
b8f69c65df Let instcombiner remove redundant dbg intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59658 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 18:59:41 +00:00
Devang Patel
7fe1decf3a If there are two consecutive llvm.dbg.stoppoint calls then
it is likely that the optimizer deleted code in between these
two intrinsics. Keep only the last llvm.dbg.stoppoint in this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59657 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 18:56:50 +00:00
Bill Wendling
9bef70609c Cast to remove warning about comparing signed and unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59518 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 10:57:27 +00:00
Devang Patel
13877bf6c2 Give SIToFPInst preference over UIToFPInst because it is faster on platforms that are widely used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 00:40:02 +00:00
Devang Patel
cd40233429 While handling floating point IVs lift restrictions on initial value and increment value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59471 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 23:27:13 +00:00
Devang Patel
84e3515974 Handle floating point ivs during doInitialization().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59466 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 21:32:02 +00:00
Chris Lattner
1a6111f32d eliminate some std::set's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59409 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 07:17:51 +00:00
Chris Lattner
cb504b95c5 simplify a bunch more instcombines to use m_Specific etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59403 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 05:38:51 +00:00
Chris Lattner
69d4ced68d factor the code for simplifying (icmp)|(icmp) into its own function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 05:20:07 +00:00
Chris Lattner
aa3e157845 do some computation with apints instead of ConstantInts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59401 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 05:14:43 +00:00
Chris Lattner
ea065fbdd8 merge a check into a place where it is simpler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59400 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 05:10:52 +00:00
Chris Lattner
29cd5ba621 factor a whole bunch of code out into a helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59398 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 05:06:21 +00:00
Chris Lattner
b9553d693b simplify the conditions on two gigantic if's, decreasing indentation
a bit.  Next step is to factor out into their own helper functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59397 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 04:55:20 +00:00
Chris Lattner
6046fb7bef simplify some instcombine matches by using m_Specific
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59395 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 04:46:19 +00:00
Chris Lattner
321e6a6e82 Use new m_SelectCst template to eliminate macros.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59392 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 04:33:38 +00:00
Chris Lattner
a6a474dca9 simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59390 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 04:26:55 +00:00
Chris Lattner
a74cefa6d3 Handle the case where there is no "not". It is possible it got
folded into the select.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59389 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 04:25:26 +00:00
Chris Lattner
faaf951fab factor a bunch of copy/paste code out into a helper function.
Eliminate the cases checking for cond?0:-1, since that is already
handled by commutative checking.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59388 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 04:24:12 +00:00
Chris Lattner
1ca0c9922b rearrange some code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59381 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 03:56:24 +00:00
Chris Lattner
7d3b4e92ab if we're going to use a macro, use it maximally. no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59380 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 03:54:57 +00:00
Devang Patel
35275f499a Cleanup debug info. assocated with deleted instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 00:54:10 +00:00
Devang Patel
d4e7f44319 If the sign of exit condition and split condition does not match
then do not split loop index.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58995 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-10 19:48:34 +00:00
Bill Wendling
11bb6c6d2c Third time's a charm.
The previous patches didn't match correctly. Also, we need to make sure that
the conditional is the same before doing the transformation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58978 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-10 06:59:06 +00:00
Mon P Wang
aeb06d2462 Added support for the following definition of shufflevector
<result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x i32> <mask> 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58964 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-10 04:46:22 +00:00
Bill Wendling
8f24cc237f Correction for the last patch. Should match the conditional in the first part
of the select match, not the select instruction itself.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58947 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-09 23:37:53 +00:00
Bill Wendling
1fb43c32ed The method of doing the matching with a 'select' instruction was wrong. The
original code was matching like this:

	if (match(A, m_Not(m_Value(B))))

B was already matched as a 'select' instruction. However, this isn't matching
what we think it's matching. It would match B as a 'Value', so basically
anything would match to it. In this case, a Constant matched. B was replaced
with a constant representation. And then the wrong value would be used in the
SelectInst::Create statement, causing a crash.

After thinking on this for a moment, and after Nick L. told me how the pattern
matching stuff was supposed to work, the solution was to match NOT an m_Value,
but an m_Select.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58946 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-09 23:17:42 +00:00
Nuno Lopes
ea736cee2b fix leakage of ValueNumbering
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-09 12:45:23 +00:00
Bill Wendling
c143bcf9ac If the LHS of the FCMP is coming from a UIToFP instruction, then we don't want
to generate signed ICMP instructions to replace the FCMP. This would violate
the following:

define i1 @test1(i32 %val) {
  %1 = uitofp i32 %val to double
  %2 = fcmp ole double %1, 0.000000e+00
  ret i1 %2
}

would be transformed into:

define i1 @test1(i32 %val) {
  %1 = icmp slt i33 %val, 1
  ret i1 %1
}

which is obviously wrong. This patch modifes InstCombiner::FoldFCmp_IntToFP_Cst
to handle when the LHS comes from UIToFP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58929 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-09 04:26:50 +00:00
Mon P Wang
e0b436ac41 Fixed scalarizing an extract subvector and prevent an infinite loop
when simplify a vector. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58820 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-06 22:52:21 +00:00
Oscar Fuentes
436893d924 CMake: updated list of source files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58736 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-05 00:11:22 +00:00
Dan Gohman
8f027c7fea Add a new pass to simplify specific half_powr function calls. This is
a specialized pass that it not likely to be generally useful.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58732 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 23:41:45 +00:00
Dale Johannesen
c0bc547c99 Allow SROA of vectors. Removing this caused a
huge performance regression in something we care
about.  This may not be final fix.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58718 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 20:54:03 +00:00
Devang Patel
265ca5dff5 Ignore conditions that are outside the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58631 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 19:38:07 +00:00
Devang Patel
58d43d4a41 Turn floating point IVs into integer IVs where possible.
This allows SCEV users to effectively calculate trip count.
LSR later on transforms back integer IVs to floating point IVs
later on to avoid int-to-float casts inside the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58625 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 18:32:19 +00:00
Nick Lewycky
af38613e31 Replace explicit loop with utility function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58593 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 03:49:14 +00:00
Nick Lewycky
8e39432ea9 Fix demanded bits analysis with srem by negative number. Based on a patch
by Richard Osborne.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58555 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-02 02:41:50 +00:00
Dan Gohman
21440acc06 Fix this recently moved code to use the correct type. CI is now a
ConstantInt, and SI is the original cast instruction. This fixes
PR2996.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58549 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-02 00:17:33 +00:00
Dan Gohman
1975d03183 Canonicalize sext(i1) to i1?-1:0, and update various instcombine
optimizations accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58457 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30 20:40:10 +00:00
Dan Gohman
b493b2774c (A & sext(C)) | (B & ~sext(C) -> C ? A : B
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58351 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 22:38:57 +00:00
Nick Lewycky
79cce5c51b Add value range analyzing of Add and Sub.
Understand that mul %x, 1 = %x.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 04:00:26 +00:00
Daniel Dunbar
394f0441e0 Change create*Pass factory functions to return Pass* instead of
LoopPass*.
 - Although less precise, this means they can be used in clients
   without RTTI (who would otherwise need to include LoopPass.h, which
   eventually includes things using dynamic_cast). This was the
   simplest solution that presented itself, but I am happy to use a
   better one if available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58010 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 23:32:42 +00:00
Dan Gohman
a1fcd77ccf Use 0 instead of false to return a null pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57660 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 00:56:52 +00:00
Dan Gohman
2276a7bc8e Teach instcombine's visitLoad to scan back several instructions
to find opportunities for store-to-load forwarding or load CSE,
in the same way that visitStore scans back to do DSE. Also, define
a new helper function for testing whether the addresses of two
memory accesses are known to have the same value, and use it in
both visitStore and visitLoad.

These two changes allow instcombine to eliminate loads in code
produced by front-ends that frequently emit obviously redundant
addressing for memory references.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57608 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 23:19:35 +00:00
Evan Cheng
403006205f Combine (fcmp cc0 x, y) | (fcmp cc1 x, y) into a single fcmp when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57515 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-14 18:44:08 +00:00
Evan Cheng
4990b257dd - Somehow I forgot about one / une.
- Renumber fcmp predicates to match their icmp counterparts.
- Try swapping operands to expose more optimization opportunities.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-14 18:13:38 +00:00
Evan Cheng
8db90725cb Optimize anding of two fcmp into a single fcmp if the operands are the same. e.g. uno && ueq -> ueq
ord && olt -> olt
     ord && ueq -> oeq


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57507 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-14 17:15:11 +00:00
Matthijs Kooijman
7e6d9b96ad Make InstructionCombining::getBitCastOperand() recognize GEP instructions and
constant expression with all zero indices as being the same as a bitcast.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-13 15:17:01 +00:00
Chris Lattner
a6321b40c2 Fix PR2697 by rewriting the '(X / pos) op neg' logic. This also changes
a couple other cases for clarity, but shouldn't affect correctness.

Patch by Eli Friedman!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57387 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-11 22:55:00 +00:00
Devang Patel
fc19fbd2ca Check loop exit predicate properly while eliminating one iteration loop.
This patch fixes PR 2869


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10 22:02:57 +00:00
Nuno Lopes
7cdd9ee088 fix memleak by cleaning the global sets on pass exit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10 16:25:50 +00:00
Dale Johannesen
23a98551ab Add a "loses information" return value to APFloat::convert
and APFloat::convertToInteger.  Restore return value to
IEEE754.  Adjust all users accordingly.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57329 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-09 23:00:39 +00:00
Duncan Sands
4520dd2b7b Add <cstdio> include where needed by gcc-4.4.
Patch by Samuel Tardieu.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 07:23:46 +00:00
Chris Lattner
de17ddc65f Add parentheses to avoid warnings in GCC 4.4.0,
patch by Samuel Tardieu!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 06:42:28 +00:00
Devang Patel
d44b7c1b07 Fix typo, fix PR 2865.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57221 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 23:22:54 +00:00
Matthijs Kooijman
5fac55fafb Allow scalarrepl to treat an all-zero GEP just as bitcast.
This includes not marking a GEP involving a vector as unsafe, but only when it
has all zero indices. This allows scalarrepl to work in a few more cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57177 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 16:23:31 +00:00
Chris Lattner
8c34cd287a rewrite bswap matching to be more general, allowing arbitrary
shifting and masking inside a bswap expr.  This allows it to handle
the cases from PR2842, which involve the intermediate 'or' 
expressions being shifted, not just the input value.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57095 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 02:13:19 +00:00
Chris Lattner
2f63ca3fa8 fix a bug where the bswap matcher could match a case involving
ashr.  It should only apply to lshr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:50:57 +00:00
Duncan Sands
5d0392c6b3 Factorize code: remove variants of "strip off
pointer bitcasts and GEP's", and centralize the
logic in Value::getUnderlyingObject.  The
difference with stripPointerCasts is that
stripPointerCasts only strips GEPs if all
indices are zero, while getUnderlyingObject
strips GEPs no matter what the indices are.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56922 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 15:25:41 +00:00
Dan Gohman
586b7b7547 Call ScalarEvolution's deleteValueFromRecords before deleting an
instruction, not after. This fixes some uses of free'd memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56908 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 02:02:03 +00:00
Nick Lewycky
a06cf82a7b Fix misoptimization of: xor i1 (icmp eq (X, C1), icmp s[lg]t (X, C2))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56834 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 06:08:34 +00:00
Devang Patel
2c9c3e7368 Implement function notes as function attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 23:51:19 +00:00
Devang Patel
19c874638d Now Attributes are divided in three groups
- return attributes - inreg, zext and sext
- parameter attributes
- function attributes - nounwind, readonly, readnone, noreturn

Return attributes use 0 as the index.
Function attributes use ~0U as the index.

This patch requires corresponding changes in llvm-gcc and clang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56704 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 22:53:05 +00:00
Devang Patel
0598866c05 Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.

This requires corresponding changes in llvm-gcc and clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 21:00:45 +00:00
Evan Cheng
a7e6146688 Commit CodeGenPrepare.cpp changes which was accidentially left out of 56526.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56549 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 06:48:55 +00:00
Eric Christopher
692bf6b85e Fix fallout in CodeGenPrepare from 56526. Will likely need more work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 05:32:41 +00:00
Devang Patel
e3d76d37e9 s/ParamAttrsWithIndex/FnAttributeWithIndex/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 00:55:02 +00:00
Devang Patel
20bcaff6a7 Put FN_NOTE_AlwaysInline and others in FnAttr namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 00:06:15 +00:00
Devang Patel
dd4924c564 Move FN_NOTE_AlwaysInline and other out of ParamAttrs namespace.
Do not check isDeclaration() in hasNote(). It is clients' responsibility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56524 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 23:52:03 +00:00
Devang Patel
eaf42abab6 s/ParameterAttributes/Attributes/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 23:03:40 +00:00
Devang Patel
d9b4a5f859 Use parameter attribute store (soon to be renamed) for
Function Notes also. Function notes are stored at index ~0.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56511 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 22:35:17 +00:00
Devang Patel
f3ba70861c Add hasNote() to check note associated with a function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56477 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 22:32:29 +00:00
Oscar Fuentes
3d01fc7de8 Initial support for the CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 01:08:49 +00:00
Duncan Sands
acdb2eeb45 Remove the MarkModRef pass (use AddReadAttrs instead).
Unfortunately this means removing one regression test
of GlobalsModRef because I couldn't work out how to
perform it without MarkModRef.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56342 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-19 08:23:44 +00:00
Devang Patel
4fe0fe8b49 splitLoop does not handle split condition EQ.
Fixes PR 2805


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56321 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 23:45:14 +00:00
Bill Wendling
670ed09238 Decrementing the iterator here could be wrong if the worklist is empty after the "erase".
Thanks to Ji Young Park for the patch!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56316 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 23:04:18 +00:00
Devang Patel
00622952ce Do not ignore iv uses outside the loop.
This one slipped through cracks very well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56284 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 17:53:47 +00:00
Dan Gohman
81b28ceab6 Improve instcombine's handling of integer min and max in two ways:
- Recognize expressions like "x > -1 ? x : 0" as min/max and turn them
   into expressions like "x < 0 ? 0 : x", which is easily recognizable
   as a min/max operation.
 - Refrain from folding expression like "y/2 < 1" to "y < 2" when the
   comparison is being used as part of a min or max idiom, like
   "y/2 < 1 ? 1 : y/2". In that case, the division has another use, so
   folding doesn't eliminate it, and obfuscates the min/max, making it
   harder to recognize as a min/max operation.

These benefit ScalarEvolution, CodeGen, and anything else that wants to
recognize integer min and max.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56246 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 18:46:06 +00:00
Dan Gohman
ad7321f58a Teach LSR to optimize away SMAX operations for tripcounts in common
cases.  See the comment above OptimizeSMax for the full story, and
the testcase for an example. This cancels out a pessimization
commonly attributed to indvars, and will allow us to lift some of
the artificial throttles in indvars, rather than add new ones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56230 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-15 21:22:06 +00:00
Dan Gohman
4f833d4351 On 64-bit targets, change 32-bit getelementptr indices to be 64-bit
getelementptr indices, inserting an explicit cast if necessary.
This helps expose the sign-extension operation to other optimizations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 23:06:38 +00:00
Dan Gohman
3139ff8f7b Fix a vectorshuffle instcombine bug introduced by r55995.
Patch by Nicolas Capens!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56129 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 22:47:57 +00:00
Dan Gohman
bcb37fd22f Fix a copy+paste bug that Duncan spotted. For several
cases it was still getting lucky and detecting overflow
but it was clearly incorrect.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56113 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 18:53:02 +00:00
Dan Gohman
7f85fbd9de In my analysis for r56076 I missed the case where the original
multiplication overflows.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:25:00 +00:00
Dan Gohman
1df3fd6683 Fix an icmp+sdiv optimization to check for and handle an overflow
condition. This fixes PR2740.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56076 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 23:30:57 +00:00
Devang Patel
36a5bf8fd8 fix white spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 14:49:55 +00:00
Dan Gohman
cb89309399 Fix a warning about comparing signed and unsigned values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56040 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 01:09:32 +00:00
Devang Patel
d22a849282 if loop induction variable is always sign or zero extended then
extend the type of induction variable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 21:41:07 +00:00
Devang Patel
4b3f08bac7 fix overflow check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56011 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 20:54:34 +00:00
Dan Gohman
488fbfc69e Make SimplifyDemandedVectorElts simplify vectors with multiple
users, and teach it about shufflevector instructions.

Also, fix a subtle bug in SimplifyDemandedVectorElts'
insertelement code.

This is a patch that was originally written by Eli Friedman,
with some fixes and cleanup by me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55995 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 18:11:14 +00:00
Devang Patel
2379089a6e s/RemoveUnreachableBlocks/RemoveUnreachableBlocksFromFn/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55965 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-08 22:14:17 +00:00
Devang Patel
245d0ab166 Remove unused counter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-08 17:14:54 +00:00
Devang Patel
175f9d94db Remove OptimizeIVType()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55913 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-08 16:13:27 +00:00
Devang Patel
bcc11d2a71 Remove unused map.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55861 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 21:55:33 +00:00
Devang Patel
deafefabae A loop may be unswitched multiple times. Reconstruct dom info. at the end.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 22:43:59 +00:00
Devang Patel
027bb92541 Initialize loop data first.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55792 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 20:36:36 +00:00
Devang Patel
10b359ccb6 Do not unswitch if the function notes say we're optimizing this function for size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55786 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 18:55:13 +00:00
Dale Johannesen
53bfbbccbf Add intrinsic forms of pow and exp2. The non-intrinsic
forms remain to handle older IR files, but will go away soon.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55781 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 18:30:46 +00:00
Dan Gohman
ae73dc1448 Tidy up several unbeseeming casts from pointer to intptr_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 17:05:41 +00:00
Owen Anderson
0c7f91cf84 Fix a bug that prevented PRE from applying in some cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55744 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 23:06:07 +00:00
Nick Lewycky
23c04309fb Don't apply this transform to vectors. Fixes PR2756.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55690 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 06:24:21 +00:00
Devang Patel
e925ccc553 Add additional check to ensure that iv is canonicalized.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55682 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 00:29:13 +00:00
Devang Patel
a9348dc7ac Check iteration count.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55680 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 00:10:56 +00:00