Commit Graph

1859 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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