Commit Graph

3523 Commits

Author SHA1 Message Date
Owen Anderson
45537917ee Fix a couple more bugs in the phi construction by pulling in code that does
almost the same things from LCSSA.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40540 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-26 18:26:51 +00:00
Dan Gohman
37f3ee17d2 Move the GET_SIDE_EFFECT_INFO logic from isInstructionTriviallyDead
to Instruction::mayWriteToMemory, fixing a FIXME, and helping
various places that call mayWriteToMemory directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40533 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-26 16:06:08 +00:00
Dan Gohman
c2dfd066c0 Remove a bogus return statement, what appears to have been a pasto
from Relation::contradicts in Relation::incorporate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40531 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-26 15:29:35 +00:00
Owen Anderson
febc7e3613 Fix what is _hopefully_ the last corner case for loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40503 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-25 23:54:42 +00:00
Owen Anderson
9f435740b1 My last commit was not correct for nested loops. Fix it, and add a testcase for it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40498 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-25 22:19:40 +00:00
Owen Anderson
0d16988690 Fix an infinite loop on 300.twolf.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40497 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-25 22:03:06 +00:00
Owen Anderson
2e3d6b4a27 Fix a bug that was causing GVN to crash on 252.eon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40494 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-25 21:13:41 +00:00
Owen Anderson
0cd320362e Add basic support for performing whole-function RLE.
Note: This has not yet been thoroughly tested.  Use at your own risk.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40489 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-25 19:57:03 +00:00
Devang Patel
6899b31422 Add BasicInliner interface.
This interface allows clients to inline bunch of functions with module
level call graph information.:wq



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40486 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-25 18:00:25 +00:00
Owen Anderson
1ad2cb7555 Add a GVN pass, using the value numbering code I developed for GVNPRE and the
load elimination code from RedundantLoadElimination.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40469 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 17:55:58 +00:00
Owen Anderson
a7f98e2919 Rename a lot of things to change FastDLE to RedundantLoadElimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40457 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 00:17:04 +00:00
Owen Anderson
e2a1624da3 Rename FastDLE as RedundantLoadElimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40456 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 00:08:38 +00:00
Owen Anderson
6b8894bb67 Don't delete volatile loads. Doing so is not safe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40448 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23 22:05:54 +00:00
Owen Anderson
ffe40aa97d Add FastDLE, the load-elimination counterpart of FastDSE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40445 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23 21:48:08 +00:00
Owen Anderson
d989711844 Fix file header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40440 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23 18:30:37 +00:00
Chris Lattner
410ce1c49a completely remove a transformation that is unsafe in the face of
undefs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40439 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23 17:10:17 +00:00
Devang Patel
00ae1a2f02 Apply temporary work around to fix llvm mis-compilation
reported in PR 1556.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40133 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-21 00:34:29 +00:00
Chris Lattner
3ccc6bc61c this xform is already done by the constant folder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40124 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20 22:06:41 +00:00
Dan Gohman
9941f7426d Optimize alignment of loads and stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40102 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20 16:34:21 +00:00
Duncan Sands
e2abf12436 Place SCCPSolver also in the anonymous namespace. This
pacifies g++-4.2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40089 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20 08:56:21 +00:00
Owen Anderson
c9399be5e5 Fix a bug where we were marking GEP expressions with the wrong opcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40085 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20 08:19:20 +00:00
Owen Anderson
b83e56f6b6 Make val_replace fail early, which reduces the time to optimize 403.gcc to 14.8s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40064 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 19:57:13 +00:00
Devang Patel
58e0ef1e90 Verify loop info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40062 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 18:02:32 +00:00
Owen Anderson
19bc4a8acd Use SmallVector and DenseMap in even more places.
With this, the time to optimize 403.gcc is down to 15.1s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40042 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 06:37:56 +00:00
Owen Anderson
fb66541e63 Change ValueTable to use a DenseMap for mapping expressions to value numbers.
This results in a slight speedup for 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40040 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 06:13:15 +00:00
Owen Anderson
b97819852a Move some sets and maps to SmallPtrSet and DenseMap respectively. This
reduces the time to optimize 403.gcc from 17.6s to 16.4s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40036 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 03:32:44 +00:00
Devang Patel
a8a8a36629 After a basic block is split into two parts,
second part dominates all the blocks dominated
by original basic block. And first part dominates
second part.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40035 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 02:29:24 +00:00
Devang Patel
72ea8d9060 Now this temp. fix is not required.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40034 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 02:22:21 +00:00
Devang Patel
24857a3fac Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40025 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-18 23:50:19 +00:00
Devang Patel
31ad75329e Fix dominator info update to accommodate CFG changes.
This fixes PR1559.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40024 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-18 23:48:20 +00:00
Owen Anderson
ce17b1c1f8 Take advantage of undefined behavior if the source program tries to GEP
beyond the end of an alloca to make FastDSE faster and more aggressive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39945 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 23:34:39 +00:00
Owen Anderson
faac518ce0 Add support for walking up memory def chains, which enables finding many more
dead stores on 400.perlbench.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39929 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 21:52:50 +00:00
Reid Spencer
bde6869ef4 Return Undef if the block has no dominator. This was required to allow
llvm-gcc build to succeed. Without this change it fails in libstdc++
compilation. This causes no regressions in dejagnu tests. However, 
someone who knows this code better might want to review it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39924 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 21:03:44 +00:00
Dan Gohman
07a96765da Fix comments about vectors to use the current wording.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39921 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 14:29:03 +00:00
Chris Lattner
cb7122bb7d Repair a regression in Transforms/InstCombine/mul.ll that Reid noticed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39896 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 04:15:34 +00:00
Nick Lewycky
5380e941ef Start adding and cleaning up comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39894 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 02:58:37 +00:00
Chris Lattner
4241e4da85 Implement shift-simplify.ll:test[45].
First teach instcombine that sign bit checks only demand the 
sign bit, this allows simplify demanded bits to hack on 
expressions better.

Second, teach instcombine that ashr is useless if only the
sign bit is demanded.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39880 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15 20:54:51 +00:00
Chris Lattner
a0141b90a3 Implement shift-simplify.ll:test3, turning:
(X << 31) <s 0  --> (X&1) != 0

This happens dozens of times in the CFE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39879 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15 20:42:37 +00:00
Nick Lewycky
a73d11efd4 Use maximal intersection algorithm exclusively. Fixes miscompile bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39852 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-14 04:28:04 +00:00
Devang Patel
b4559a2179 Make LCSSA a loop pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39844 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 23:57:11 +00:00
Owen Anderson
a08971559d Handle GEPs with all-zero indices in the same way we handle pointer-pointer bitcasts. Also, fix a potentia infinite loop.
This brings FastDSE to parity with old DSE on 175.vpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39839 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 22:50:48 +00:00
Devang Patel
fba36b8cba Disable claims to preserve analysis until open issues are resolved.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39834 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 21:53:42 +00:00
Owen Anderson
3e8d001799 Be more aggressive in removing dead stores, and in removing instructions trivially dead after DSE.
This drastically improves the effect of FastDSE on kimwitu++.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39819 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 18:26:26 +00:00
Owen Anderson
43b2676cc2 Reimplement removing stores to allocas at the end of a function. This should be safe now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39790 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 21:41:30 +00:00
Owen Anderson
dd61c2b25c Make the condition-checking for free with non-trivial dependencies more correct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39789 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 18:08:51 +00:00
Owen Anderson
1b4542b6df Remove the end-block handling code. It was unsafe, and making it safe would have resulted in falling back to the slow DSE case. I need to think some more about the right way to handle this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39788 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 17:52:20 +00:00
Gabor Greif
3b0a7ea66e checked in as obvious,
thanks Benoit Boissinot!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39774 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 13:31:38 +00:00
Owen Anderson
1cb960a4bb Let MemoryDependenceAnalysis take care of updating AliasAnalysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39769 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 00:06:21 +00:00
Devang Patel
990e866deb Preserve analysis info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39767 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 23:47:28 +00:00
Owen Anderson
a96c1f665a Handle the case where an entire structure is freed, and its dependency is a store to a field within
that structure.

Also, refactor the runOnBasicBlock() function, splitting some of the special cases into separate functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39762 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 23:19:17 +00:00
Owen Anderson
6f46d65104 Add support for eliminate stores to stack-allocated memory locations at the end
of a function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39754 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 21:06:56 +00:00
Owen Anderson
2655adb3b2 Handle eliminating stores that occur right before a free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39753 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 20:38:34 +00:00
Owen Anderson
bfbfb3c464 Clean up a few things based on Chris' feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39747 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 19:03:09 +00:00
Tanya Lattner
08d14d2469 Adding ability to demote phi to stack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39744 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 18:41:34 +00:00
Owen Anderson
b77c457cc8 Add FastDSE, a new algorithm for doing dead store elimination. This algorithm is not as accurate
as the current DSE, but it only a linear scan over each block, rather than quadratic.  Eventually
(once it has been improved somewhat), this will replace the current DSE.

NOTE: This has not yet been extensively tested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38517 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 00:46:18 +00:00
Owen Anderson
16a72bb47d Make the pass registration static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38508 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-10 20:20:19 +00:00
Anton Korobeynikov
a289511090 During module cloning copy aliases too. This fixes PR1544
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38505 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-10 19:07:35 +00:00
Nick Lewycky
6e8eb7f075 Update the ValueRanges interface to use value numbers instead of Value*s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38483 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-10 03:28:21 +00:00
Owen Anderson
81c2a6ecbb Move some key maps from std::map to DenseMap. This improves the time to optimize Anton's testcase from 17.5s
to 15.7s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38480 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-10 00:27:22 +00:00
Owen Anderson
a05a81b10a Use a cheaper test, delaying calling find_leader() until we know that it's necessary. This improves
the time to optimize Anton's testcase from 21.1s to 17.6s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38479 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-10 00:09:25 +00:00
Owen Anderson
5fd507d431 Add an assertion if find_leader fails.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38477 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 23:57:18 +00:00
Owen Anderson
dfa2435784 Take advantage of the new fast SmallPtrSet assignment operator when propagating AVAIL_OUT sets.
This reduces the time to optimize Anton's testcase from 31.2s to 21.s!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38475 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 22:29:50 +00:00
Devang Patel
ff366850aa Expose struct size threhold to allow users to tweak their own setting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38472 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 21:19:23 +00:00
Owen Anderson
ab3fd054ea Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38459 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 16:43:55 +00:00
Owen Anderson
b9eeb1acbc Improve a hotspot that was making build_sets() slower by calling lookup() too
often.  This improves Anton's testcase from 36s to 32s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38441 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 07:56:55 +00:00
Owen Anderson
0616dffd64 Start using a set representation that remembers the set of value numbers represented
in the set.  For the moment, this results in a slight performance decrease, but
it lays the groundwork for future improvements.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38439 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 06:50:06 +00:00
Owen Anderson
36a07daabd Fix an error where ANTIC_OUT was ending up with more than one expression of
the same value number.  This fixes an infinite loop on 444.namd.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37967 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-07 20:13:57 +00:00
Nick Lewycky
8f5149e002 Back out Devang's fix for PR1320 because it causes PR1542.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37966 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-07 16:23:34 +00:00
Devang Patel
05c1dc6493 These rountines are now available as part of basic block utilities.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37955 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 22:03:47 +00:00
Devang Patel
7be06f9158 Request DominanceFrontiner in advance.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37954 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 21:43:22 +00:00
Devang Patel
658f625d16 Preserve various analysis info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37953 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 21:40:13 +00:00
Devang Patel
8019893c3f Add SplitEdge and SplitBlock utility routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37952 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 21:39:20 +00:00
Owen Anderson
ec5614b522 Be more aggressive in the heuristic. This mostly exposes more opportunities
for the GVN part of GVNPRE to apply.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37951 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 20:29:43 +00:00
Owen Anderson
2c194e6bd1 Achieve what the incorrect test was trying to do by simply requiring that all
critical edges be split before we begin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37949 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 18:12:36 +00:00
Owen Anderson
6a6152ca2d Remove an incorrect check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37948 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 16:52:47 +00:00
Zhou Sheng
33b0b8d242 Correct a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37936 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 06:01:16 +00:00
Owen Anderson
2a5c9d8aac Fix a bunch of issues found in a testcase from 400.perlbench.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37929 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-05 23:11:26 +00:00
Nick Lewycky
29a05b6a71 Break "variable canonicalization" out of InequalityGraph and into its own class
"ValueNumbering".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37881 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-05 03:15:00 +00:00
Owen Anderson
ec3ed5f8e4 Fix another bug, this time in PREing select instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37878 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-04 22:33:23 +00:00
Owen Anderson
df30b63663 Fix a typo that was killing GVNPRE of select instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37871 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-04 18:26:18 +00:00
Owen Anderson
9eee94c5f7 Fix an error in phi translation of GEPs that was causing failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37868 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-04 04:51:16 +00:00
Owen Anderson
5653322e72 Add support for performing GVNPRE on GEP instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37862 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-03 23:51:19 +00:00
Owen Anderson
eb21686ea9 Add functionality to value number GEP instructions. This also provides the infrastructure that will
be used for function calls.  NOTE: This does not yet do any transformation of GEPs or function calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37860 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-03 22:50:56 +00:00
Owen Anderson
3d6fac3993 Make the unary operator case a bit faster, since casts are the only kind of unary operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37857 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-03 19:01:42 +00:00
Owen Anderson
216394f9b3 Add support for performing GVNPRE on cast instructions, and add a testcase for this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37856 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-03 18:37:08 +00:00
Devang Patel
f34a43acc0 Preserve DominanceFrontier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37820 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-29 23:11:49 +00:00
David Greene
c08fa28897 Fix reference to iterator invalidated by an erase operation. Uncovered
by _GLIBCXX_DEBUG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37796 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-29 02:53:16 +00:00
Devang Patel
6c631988c7 Do not filter loop if candidate branch is in loop header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37792 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-29 01:39:53 +00:00
Owen Anderson
ca6c31cc41 Add support for value numbering (but not actually optimizing) cast instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37789 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-29 00:51:03 +00:00
Owen Anderson
40dc00eb82 Add a type field to expressions in preparation for performing GVNPRE on casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37788 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-29 00:40:05 +00:00
Owen Anderson
890e1a0401 Add support for performing GVNPRE on select instructions. This fixes test/Transforms/GVNPRE/select.ll.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37783 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-28 23:51:21 +00:00
Devang Patel
eb62eca503 - Undo previous check and allow loop switch for condtion that is not inside
loop.
- Avoid loop unswich for loop header branch.
- While cloning dominators fix typo and handle self dominating blocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37772 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-28 02:05:46 +00:00
Devang Patel
cce624a7a9 Update LoopUnswitch pass to preserve DomiantorTree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37771 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-28 00:49:00 +00:00
Devang Patel
558f1b8439 If a condition is not inside a loop then the condition is suitable
to loop unswitch candidate for the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37770 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-28 00:44:10 +00:00
Owen Anderson
a20f35d2e7 Make many sets a much more reasonable size. This decreases the time to optimize
Anton's testcase from 35.5s to 34.7s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37769 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-28 00:34:34 +00:00
Owen Anderson
68cb52e468 Use cached information that has already been computed to make clean() simpler and faster. This is a small speedup on most cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37761 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-27 17:38:29 +00:00
Owen Anderson
7b317d2f59 Fold a lot of code into two cases: binary instructions and ternary instructions.
This saves many lines of code duplication.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37759 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-27 17:03:03 +00:00
Zhou Sheng
0d7d3656f3 Fix a bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37751 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-27 09:50:26 +00:00
Owen Anderson
62cf8babdb Add support for performing GVNPRE on the three vector-specific operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37745 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-27 04:10:46 +00:00
Owen Anderson
6032a5ba64 1. Correct some comments and clean up some dead code.
2. When calculating ANTIC_IN, only iterate the changed blocks.  For most average
inputs this is a small speedup, but for cases with unusual CFGs, this can be a significant win.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37742 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-26 23:29:41 +00:00
Chris Lattner
ba6801e6e7 fix Transforms/Inline/2007-06-25-WeakInline.ll by not inlining functions
with weak linkage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37723 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-25 21:50:09 +00:00
Owen Anderson
9030d384c4 Use the built-in postorder iterators rather than computing a postorder walk by hand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37721 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-25 18:25:31 +00:00
Owen Anderson
f62c44a38d 1) Fix an issue with non-deterministic iteration order in phi_translate
2) Remove some maximal-set computing code that is no longer used.
3) Use a post-order CFG traversal to compute ANTIC_IN instead of a postdom traversal.
This causes the ANTIC_IN calculation to converge much faster.  Thanks to Daniel Berlin for suggesting this.

With this patch, the time to optimize 403.gcc decreased from 17.5s to 7.5s, and Anton's huge
testcase decreased from 62 minutes to 38 seconds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37714 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-25 05:41:12 +00:00
Nick Lewycky
4390feb7ae Fix value ranges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37713 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-24 20:14:22 +00:00
Owen Anderson
79a6370133 Fix a silly mistake that was causing failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37712 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-24 08:42:24 +00:00
Nick Lewycky
dea252689d Remove tabs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37710 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-24 04:40:16 +00:00
Nick Lewycky
984504b912 Remove use of ETForest. Also cleaned up issues around unreachable basic
blocks, and optimizing within one basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37709 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-24 04:36:20 +00:00
Owen Anderson
647580483c Rework topo_sort so eliminate some behavior that scaled terribly. This reduces the time to optimize 403.gcc from 18.2s to 17.5s,
and has an even larger effect on larger testcases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37708 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-22 21:31:16 +00:00
Owen Anderson
2106f61f23 Perform fewer set insertions while calculating ANTIC_IN. This reduces the amount of time to optimize 403.gcc from 21.9s to 18.2s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37707 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-22 18:27:04 +00:00
Owen Anderson
b3b37345de Remove some code that I was using for collecting performance information that should not have been committed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37706 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-22 17:04:40 +00:00
Owen Anderson
124084604d Avoid excessive calls to find_leader when calculating AVAIL_OUT. This reduces the time to optimize 403.gcc from 23.5s to 21.9s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37702 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-22 03:14:03 +00:00
Owen Anderson
e8138ffeaf Reserve space in vectors before topologically sorting into them. This improves the time to optimize 403.gcc from 28s to 23.5s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37699 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-22 00:43:22 +00:00
Owen Anderson
82575d8ab1 Make a bunch of optimizations for compile time to GVNPRE, including smarter set unions, deferring blocks rather than computing maximal sets, and smarter use of sets. With these enhancements, the time to optimize 273.perlbmk goes from 5.3s to 2.7s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37698 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-22 00:20:30 +00:00
Chris Lattner
1dbfd48fa2 Significantly improve the documentation of the instcombine divide/compare
transformation.  Also, keep track of which end of the integer interval overflows
occur on.  This fixes Transforms/InstCombine/2007-06-21-DivCompareMiscomp.ll
and rdar://5278853, a miscompilation of perl.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37692 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-21 18:11:19 +00:00
Owen Anderson
66fd906074 Change lots of sets from std::set to SmallPtrSet. This reduces the time required to optimize 253.perlbmk from 10.9s to 5.3s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37690 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-21 17:57:53 +00:00
Devang Patel
0e7f728ad1 Move code to update dominator information after basic block is split
from LoopSimplify.cpp to Dominator.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37689 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-21 17:23:45 +00:00
Owen Anderson
58e087b6e3 Eliminate a redundant check. This speeds up optimization of 253.perlbmk from 13.5 seconds to 10.9 seconds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37683 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-21 01:59:05 +00:00
Owen Anderson
9cb56014ce Comment-ize the functions in GVNPRE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37681 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-21 00:19:05 +00:00
Chris Lattner
562ef78df2 refactor a bunch of code out of visitICmpInstWithInstAndIntCst into its own
routine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37679 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-20 23:46:26 +00:00
Owen Anderson
3eaca716bf Split runOnFunction into many smaller functions. This make it easier to get accurate performance analysis of GVNPRE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37678 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-20 22:10:02 +00:00
Owen Anderson
0304b2bc2b Make GVNPRE accurate report whether it modified the function or not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37673 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-20 18:30:20 +00:00
Owen Anderson
5dbea73e35 Get rid of an unneeded helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37670 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-20 00:43:33 +00:00
Owen Anderson
4f703ec0a1 Use a DenseMap instead of an std::map for the value numbering. This reduces the time to optimize lencod on a PPC Debug build from ~300s to ~140s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37668 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 23:23:54 +00:00
Owen Anderson
52471b102c Make dependsOnInvoke much more specific in what it tests, which in turn make it much faster to run. This reduces the time to optimize lencondwith a debug build on PPC from ~450s to ~300s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37667 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 23:07:16 +00:00
Tanya Lattner
c91c56cf43 Moved Inliner.h to include/llvm/Transforms/IPO/InlinerPass.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37666 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 22:31:52 +00:00
Tanya Lattner
6f7426ec2e Inliner pass header file was moved.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37665 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 22:29:50 +00:00
Dan Gohman
5cec4db6ae Rename ScalarEvolution::deleteInstructionFromRecords to
deleteValueFromRecords and loosen the types to all it to accept
Value* instead of just Instruction*, since this is what
ScalarEvolution uses internally anyway. This allows more flexibility
for future uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37657 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 14:28:31 +00:00
Owen Anderson
d0954105f0 Handle constants in phi nodes properly. This fixes test/Transforms/GVNPRE/2007-06-18-ConstantInPhi.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37655 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 07:35:36 +00:00
Chris Lattner
2384d7b179 silence a bogus warning Duraid ran into.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37649 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 05:43:49 +00:00
Owen Anderson
20cb51fda4 Be careful to erase values from all of the appropriate sets when they're not needed anymore. This fixes a few more memory-related issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37647 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 05:37:32 +00:00
Owen Anderson
6cae7409b1 Remember to clear the maximal sets between functions.
Thanks to Nicholas for valgrinding this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37646 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 04:32:55 +00:00
Owen Anderson
086f5f350b Refactor GVNPRE to use a much smart method of uniquing value sets, and centralize a lot of the value numbering information. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37645 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 03:31:41 +00:00
Owen Anderson
bbf1197be1 Cache the results of dependsOnInvoke()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37622 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-18 04:42:29 +00:00
Owen Anderson
a8daa7176b Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37621 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-18 04:31:21 +00:00
Owen Anderson
60e174495a Don't perform an expensive check if it's not necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37620 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-18 04:30:44 +00:00
Owen Anderson
32bc789b6c Fix test/Transforms/GVNPRE/2007-06-15-InvokeInst.ll by ignoring all instructions that depend on invokes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37610 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-16 00:26:54 +00:00
Dan Gohman
e19dd87598 Use SCEVConstant::get instead of SCEVUnknown::get to create an
integer constant SCEV.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37596 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-15 18:00:55 +00:00
Owen Anderson
383bcb2e78 Fix test/Transforms/GVNPRE/2007-06-15-Looping.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37595 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-15 17:55:15 +00:00
Dan Gohman
d19534add9 Add a SCEV class and supporting code for sign-extend expressions.
This created an ambiguity for expandInTy to decide when to use
sign-extension or zero-extension, but it turns out that most of its callers
don't actually need a type conversion, now that LLVM types don't have
explicit signedness. Drop expandInTy in favor of plain expand, and change
the few places that actually need a type conversion to do it themselves.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37591 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-15 14:38:12 +00:00
Chris Lattner
7cbe2ebb21 Generalize many transforms to work on ~ of vectors in addition to ~ of
integer ops.  This implements Transforms/InstCombine/and-or-not.ll
test3/test4, and finishes off PR1510


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37589 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-15 06:23:19 +00:00
Chris Lattner
003b6200df Implement two xforms:
1. ~(~X | Y) === (X & ~Y)
2. (A|B) & ~(A&B) -> A^B

This allows us to transform  ~(~(a|b) | (a&b)) -> a^b.

This implements PR1510 for scalar values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37584 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-15 05:58:24 +00:00
Chris Lattner
041a6c9048 delete some obviously dead vector operations, which deletes a few thousand
operations from Duraids example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37582 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-15 05:26:55 +00:00
Owen Anderson
71fcebcf8a Fix test/Transforms/GVNPRE/2007-06-12-PhiTranslate.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37564 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-12 22:43:57 +00:00
Owen Anderson
239e71201e Refactor some code, and fix test/Transforms/GVNPRE/2007-06-12-NoExit.ll by being more careful when using
post-dominator information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37556 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-12 16:57:50 +00:00
Dale Johannesen
ce0b23721e Sink CmpInst's to their uses to reduce register pressure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37554 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-12 16:50:17 +00:00
Owen Anderson
65d2862a60 Fix a few more bugs, including an instance of walking in reverse topological rather than topological order. This
fixes a testcase extracted from llvm-test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37550 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-12 00:50:47 +00:00
Devang Patel
fe7d4e50b8 Add and use DominatorTreeBase::findNearestCommonDominator().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37545 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 23:31:22 +00:00
Devang Patel
f60e5a2cd9 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37542 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 21:45:31 +00:00
Devang Patel
b28aaadfff simplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37541 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 21:25:31 +00:00
Devang Patel
e3f653606d Simplify. Dominator Tree is required so always available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37540 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 21:18:00 +00:00
Owen Anderson
0e71466405 Handle functions with multiple exit blocks properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37539 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 16:25:17 +00:00
Owen Anderson
139fe848a2 Perform PRE of comparison operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37536 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-09 18:35:31 +00:00
Owen Anderson
b8b873cb7d Collect statistics from GVN-PRE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37530 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 22:02:36 +00:00
Owen Anderson
a7f916cf89 Fix typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37526 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 20:57:08 +00:00
Owen Anderson
8338ff5ff1 Fix a bug that was causing the elimination phase not to replace values when it should be.
With this patch, GVN-PRE now correctly optimizes the example from the thesis.

Many thanks to Daniel Berlin for helping me find errors in this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37525 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 20:44:02 +00:00
Owen Anderson
900997ba3b Small bugfix, and const-ify some methods (Thanks, Bill).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37513 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 01:52:45 +00:00
Devang Patel
dba2413b2e Update LoopSimplify to require and preserve DominatorTree only.
Now LoopSimplify does not require nor preserve ETForest.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37512 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 01:50:32 +00:00
Owen Anderson
397d405731 Add partial redundancy elimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37510 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 01:03:01 +00:00
Devang Patel
f86a73cbef Do not preserve ETForest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37506 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 00:02:08 +00:00
Devang Patel
468502e41a Do not require ETForest. Now it is unused by LICM.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37502 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 22:21:15 +00:00
Devang Patel
4b90e3a276 Do not use ETForest as well as DomiantorTree. DominatorTree is sufficient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37501 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 22:17:16 +00:00
Devang Patel
326821ef12 Use DominatorTree instead of ETForest.
This allows faster immediate domiantor walk.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37500 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 21:57:03 +00:00
Devang Patel
b7d9dfc7ba Use DominatorTree instead of ETForest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37499 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 21:42:15 +00:00
Devang Patel
fa51f9ae12 Use DominatorTree instead of ETForest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37498 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 21:35:27 +00:00
Devang Patel
a97e040e05 Use DominatorTree instead of ETForest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37495 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 18:45:06 +00:00
Devang Patel
387b8cbc2d Use DominatorTree instead of ETForest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37494 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 18:40:55 +00:00
Devang Patel
9a51157db5 Maintain ETNode as part of DomTreeNode.
This adds redundancy for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37492 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 17:47:21 +00:00
Tanya Lattner
b62fa8ab6b Formating fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37491 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 17:12:16 +00:00
Tanya Lattner
682f683669 Instruct the inliner to obey the noinline attribute. Add test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37481 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-06 21:59:26 +00:00
Chris Lattner
4e2288b9de simplify this code and fix PR1493, now that llvm-gcc3 is dead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37478 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-06 20:51:41 +00:00
Lauro Ramos Venancio
d0499af703 Fix PR1499.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37472 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-06 17:08:48 +00:00
Nick Lewycky
5adcefb04d Inform ScalarEvolutions that we're deleting Values.
This is the obviously correct part of the fix for PR1487.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37457 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-06 03:51:56 +00:00
Owen Anderson
12112af5e8 Add simple full redundancy elimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37455 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-06 01:27:49 +00:00
Chris Lattner
b47f6124f4 Fix PR1495 and CodeGen/X86/2007-06-05-LSR-Dominator.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37454 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-06 01:23:55 +00:00
Devang Patel
743f7e8839 Avoid non-trivial loop unswitching while optimizing for size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37446 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-06 00:21:03 +00:00
Owen Anderson
1d4eb6ab0d Fix a misunderstanding of the algorithm. Really, we should be tracking values
and expression separately.  We can get around this, however, by only keeping
opaque values in TMP_GEN.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37443 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-05 23:46:12 +00:00
Owen Anderson
8f862c80bc Don't leak memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37442 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-05 22:11:49 +00:00
Owen Anderson
359208032b Fix a small bug, some 80 cols violations, and add some more debugging output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37436 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-05 17:31:23 +00:00
Dan Gohman
d8af90c1da Allow insertelement, extractelement, and shufflevector to be hoisted/sunk
by LICM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37435 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-05 16:05:55 +00:00
Bill Wendling
851879c4cf Patches by Chuck Rose to unbreak V Studio builds.
Thanks Chuck!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37428 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 23:52:59 +00:00
Devang Patel
170f2b9bef s/ETNode::getChildren/ETNode::getETNodeChildren/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37426 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 23:45:02 +00:00
Owen Anderson
dbc705b73f Don't use std::set_difference when the two sets are sorted differently. Compute
the difference manually instead.

This allows GVNPRE to produce correct analysis for the example in the GVNPRE
paper.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37425 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 23:34:56 +00:00
Owen Anderson
082fe7185e Fix a bunch of small bugs, and improve the debugging output significantly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37424 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 23:28:33 +00:00
Chris Lattner
f0a9aaba4c When rebuilding constant structs, make sure to honor the isPacked bit.
This fixes PR1491 and GlobalOpt/2007-06-04-PackedStruct.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37423 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 22:23:42 +00:00
Owen Anderson
5ea069fdda Make phi_translate correct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 18:05:26 +00:00
Devang Patel
83beaee227 s/DominatorTree::createNewNode/DominatorTree::addNewBlock/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 16:43:25 +00:00
Devang Patel
26a6908768 Add basic block level interface to change immediate dominator
and create new node.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37414 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 16:22:33 +00:00
Devang Patel
26042420d6 s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37407 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 00:32:22 +00:00
Owen Anderson
0fa6b37c6f Don't use the custom comparator where it's not necessary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37406 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-03 22:02:14 +00:00
Devang Patel
bec7647f98 s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37403 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-03 06:26:14 +00:00
Owen Anderson
10ac137d0b Remove an unused method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37402 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-03 05:58:25 +00:00
Owen Anderson
a724ac1a73 There's no need to have an Expression class... Value works just as well! This simplifies a lot of code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37401 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-03 05:55:58 +00:00
Devang Patel
e7ae1a9dee Insert new instructions in AliasSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37390 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-01 22:15:31 +00:00
Owen Anderson
aa7d3351f0 clean() needs to process things in topological order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37389 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-01 22:00:37 +00:00
Owen Anderson
8e21fb7df8 Fix Expression comparison, which in turn fixes a value numbering error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37386 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-01 17:34:47 +00:00
Owen Anderson
243f348c2a Add a topological sort function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37376 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-31 22:44:11 +00:00
Owen Anderson
8214d50338 Attempt to fix up phi_translate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37366 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-31 00:42:15 +00:00
Devang Patel
f38ac5dd39 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37360 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-30 15:29:37 +00:00
Chris Lattner
39a1c04323 Fix Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll and the second
half of PR1421, by not decimating structs with holes that are the source and
destination of a memcpy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37358 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-30 06:11:23 +00:00
Owen Anderson
2c0c51593d Fix a typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37350 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-29 23:34:14 +00:00