Commit Graph

67 Commits

Author SHA1 Message Date
Owen Anderson 59bd053fc5 Add support for performing GVNPRE on cast instructions, and add a testcase for this.
llvm-svn: 37856
2007-07-03 18:37:08 +00:00
Owen Anderson 67799d4ffb Add support for value numbering (but not actually optimizing) cast instructions.
llvm-svn: 37789
2007-06-29 00:51:03 +00:00
Owen Anderson c738f7ca42 Add a type field to expressions in preparation for performing GVNPRE on casts.
llvm-svn: 37788
2007-06-29 00:40:05 +00:00
Owen Anderson 8a9fa5d081 Add support for performing GVNPRE on select instructions. This fixes test/Transforms/GVNPRE/select.ll.
llvm-svn: 37783
2007-06-28 23:51:21 +00:00
Owen Anderson e02da55cc8 Make many sets a much more reasonable size. This decreases the time to optimize
Anton's testcase from 35.5s to 34.7s.

llvm-svn: 37769
2007-06-28 00:34:34 +00:00
Owen Anderson 7dae8efcf2 Use cached information that has already been computed to make clean() simpler and faster. This is a small speedup on most cases.
llvm-svn: 37761
2007-06-27 17:38:29 +00:00
Owen Anderson 0eb265729a Fold a lot of code into two cases: binary instructions and ternary instructions.
This saves many lines of code duplication.  No functionality change.

llvm-svn: 37759
2007-06-27 17:03:03 +00:00
Owen Anderson b6a39fcb21 Add support for performing GVNPRE on the three vector-specific operations.
llvm-svn: 37745
2007-06-27 04:10:46 +00:00
Owen Anderson 5477c54aa0 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.

llvm-svn: 37742
2007-06-26 23:29:41 +00:00
Owen Anderson 43ca4b48f1 Use the built-in postorder iterators rather than computing a postorder walk by hand.
llvm-svn: 37721
2007-06-25 18:25:31 +00:00
Owen Anderson 191eb06352 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.

llvm-svn: 37714
2007-06-25 05:41:12 +00:00
Owen Anderson 7fb6da8e4d Fix a silly mistake that was causing failures.
llvm-svn: 37712
2007-06-24 08:42:24 +00:00
Owen Anderson 49409f6501 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.

llvm-svn: 37708
2007-06-22 21:31:16 +00:00
Owen Anderson 21a1131565 Perform fewer set insertions while calculating ANTIC_IN. This reduces the amount of time to optimize 403.gcc from 21.9s to 18.2s.
llvm-svn: 37707
2007-06-22 18:27:04 +00:00
Owen Anderson 92c7b22e1a Remove some code that I was using for collecting performance information that should not have been committed.
llvm-svn: 37706
2007-06-22 17:04:40 +00:00
Owen Anderson f6e21871ad Avoid excessive calls to find_leader when calculating AVAIL_OUT. This reduces the time to optimize 403.gcc from 23.5s to 21.9s.
llvm-svn: 37702
2007-06-22 03:14:03 +00:00
Owen Anderson d50a29d613 Reserve space in vectors before topologically sorting into them. This improves the time to optimize 403.gcc from 28s to 23.5s.
llvm-svn: 37699
2007-06-22 00:43:22 +00:00
Owen Anderson 28a2d449fa 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.
llvm-svn: 37698
2007-06-22 00:20:30 +00:00
Owen Anderson 2ff912bf33 Change lots of sets from std::set to SmallPtrSet. This reduces the time required to optimize 253.perlbmk from 10.9s to 5.3s.
llvm-svn: 37690
2007-06-21 17:57:53 +00:00
Owen Anderson 27876a3ff9 Eliminate a redundant check. This speeds up optimization of 253.perlbmk from 13.5 seconds to 10.9 seconds.
llvm-svn: 37683
2007-06-21 01:59:05 +00:00
Owen Anderson fd5683ad7a Comment-ize the functions in GVNPRE.
llvm-svn: 37681
2007-06-21 00:19:05 +00:00
Owen Anderson 06c1e585c9 Split runOnFunction into many smaller functions. This make it easier to get accurate performance analysis of GVNPRE.
llvm-svn: 37678
2007-06-20 22:10:02 +00:00
Owen Anderson b0714bb7bb Make GVNPRE accurate report whether it modified the function or not.
llvm-svn: 37673
2007-06-20 18:30:20 +00:00
Owen Anderson 7b0fb44ca9 Get rid of an unneeded helper function.
llvm-svn: 37670
2007-06-20 00:43:33 +00:00
Owen Anderson 1ad2c10215 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.
llvm-svn: 37668
2007-06-19 23:23:54 +00:00
Owen Anderson 2320d430bd 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.
llvm-svn: 37667
2007-06-19 23:07:16 +00:00
Owen Anderson 1370faf889 Handle constants in phi nodes properly. This fixes test/Transforms/GVNPRE/2007-06-18-ConstantInPhi.ll
llvm-svn: 37655
2007-06-19 07:35:36 +00:00
Owen Anderson 91c54950b3 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.
llvm-svn: 37647
2007-06-19 05:37:32 +00:00
Owen Anderson b9cbaed623 Remember to clear the maximal sets between functions.
Thanks to Nicholas for valgrinding this.

llvm-svn: 37646
2007-06-19 04:32:55 +00:00
Owen Anderson b56fba0c5a Refactor GVNPRE to use a much smart method of uniquing value sets, and centralize a lot of the value numbering information. No functionality change.
llvm-svn: 37645
2007-06-19 03:31:41 +00:00
Owen Anderson dd998e1913 Cache the results of dependsOnInvoke()
llvm-svn: 37622
2007-06-18 04:42:29 +00:00
Owen Anderson f1c04e1ddb Fix indentation.
llvm-svn: 37621
2007-06-18 04:31:21 +00:00
Owen Anderson b364b413af Don't perform an expensive check if it's not necessary.
llvm-svn: 37620
2007-06-18 04:30:44 +00:00
Owen Anderson 658f2c4881 Fix test/Transforms/GVNPRE/2007-06-15-InvokeInst.ll by ignoring all instructions that depend on invokes.
llvm-svn: 37610
2007-06-16 00:26:54 +00:00
Owen Anderson acaed06827 Fix test/Transforms/GVNPRE/2007-06-15-Looping.ll
llvm-svn: 37595
2007-06-15 17:55:15 +00:00
Owen Anderson 4036ad485f Fix test/Transforms/GVNPRE/2007-06-12-PhiTranslate.ll
llvm-svn: 37564
2007-06-12 22:43:57 +00:00
Owen Anderson 4276984012 Refactor some code, and fix test/Transforms/GVNPRE/2007-06-12-NoExit.ll by being more careful when using
post-dominator information.

llvm-svn: 37556
2007-06-12 16:57:50 +00:00
Owen Anderson a75dd4dc56 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.

llvm-svn: 37550
2007-06-12 00:50:47 +00:00
Owen Anderson d184c18074 Handle functions with multiple exit blocks properly.
llvm-svn: 37539
2007-06-11 16:25:17 +00:00
Owen Anderson 223718c40e Perform PRE of comparison operators.
llvm-svn: 37536
2007-06-09 18:35:31 +00:00
Owen Anderson 7d76b2a774 Collect statistics from GVN-PRE.
llvm-svn: 37530
2007-06-08 22:02:36 +00:00
Owen Anderson b232efaf48 Fix typo in a comment.
llvm-svn: 37526
2007-06-08 20:57:08 +00:00
Owen Anderson 55994f2453 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.

llvm-svn: 37525
2007-06-08 20:44:02 +00:00
Owen Anderson 2e5efc30c2 Small bugfix, and const-ify some methods (Thanks, Bill).
llvm-svn: 37513
2007-06-08 01:52:45 +00:00
Owen Anderson be80240b29 Add partial redundancy elimination.
llvm-svn: 37510
2007-06-08 01:03:01 +00:00
Owen Anderson 634a063c1d Add simple full redundancy elimination.
llvm-svn: 37455
2007-06-06 01:27:49 +00:00
Owen Anderson ddbe430732 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.

llvm-svn: 37443
2007-06-05 23:46:12 +00:00
Owen Anderson c84720913a Don't leak memory.
llvm-svn: 37442
2007-06-05 22:11:49 +00:00
Owen Anderson 9b89e4b561 Fix a small bug, some 80 cols violations, and add some more debugging output.
llvm-svn: 37436
2007-06-05 17:31:23 +00:00
Owen Anderson 3c9d8eef21 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.

llvm-svn: 37425
2007-06-04 23:34:56 +00:00