Commit Graph

92 Commits

Author SHA1 Message Date
Owen Anderson
9fed589912 Fix 80 col. violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40751 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-02 18:20:52 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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