Owen Anderson
2aab0eafe9
Rename FastDLE as RedundantLoadElimination.
...
llvm-svn: 40456
2007-07-24 00:08:38 +00:00
Owen Anderson
0a79ada820
Don't delete volatile loads. Doing so is not safe.
...
llvm-svn: 40448
2007-07-23 22:05:54 +00:00
Owen Anderson
bd3360e856
Add FastDLE, the load-elimination counterpart of FastDSE.
...
llvm-svn: 40445
2007-07-23 21:48:08 +00:00
Owen Anderson
d3a8c81c04
Fix file header.
...
llvm-svn: 40440
2007-07-23 18:30:37 +00:00
Chris Lattner
914de64a0a
completely remove a transformation that is unsafe in the face of
...
undefs.
llvm-svn: 40439
2007-07-23 17:10:17 +00:00
Devang Patel
f45fc256e1
Apply temporary work around to fix llvm mis-compilation
...
reported in PR 1556.
llvm-svn: 40133
2007-07-21 00:34:29 +00:00
Chris Lattner
9663eb4a5b
this xform is already done by the constant folder.
...
llvm-svn: 40124
2007-07-20 22:06:41 +00:00
Dan Gohman
87107326f6
Optimize alignment of loads and stores.
...
llvm-svn: 40102
2007-07-20 16:34:21 +00:00
Duncan Sands
4b390d541e
Place SCCPSolver also in the anonymous namespace. This
...
pacifies g++-4.2.
llvm-svn: 40089
2007-07-20 08:56:21 +00:00
Owen Anderson
89afa507b1
Fix a bug where we were marking GEP expressions with the wrong opcode.
...
llvm-svn: 40085
2007-07-20 08:19:20 +00:00
Owen Anderson
3b1129af78
Make val_replace fail early, which reduces the time to optimize 403.gcc to 14.8s.
...
llvm-svn: 40064
2007-07-19 19:57:13 +00:00
Owen Anderson
57d33add2c
Use SmallVector and DenseMap in even more places.
...
With this, the time to optimize 403.gcc is down to 15.1s.
llvm-svn: 40042
2007-07-19 06:37:56 +00:00
Owen Anderson
7a4b965739
Change ValueTable to use a DenseMap for mapping expressions to value numbers.
...
This results in a slight speedup for 403.gcc.
llvm-svn: 40040
2007-07-19 06:13:15 +00:00
Owen Anderson
c32df0bc73
Move some sets and maps to SmallPtrSet and DenseMap respectively. This
...
reduces the time to optimize 403.gcc from 17.6s to 16.4s.
llvm-svn: 40036
2007-07-19 03:32:44 +00:00
Devang Patel
ef7c515e9a
Fix typo.
...
llvm-svn: 40025
2007-07-18 23:50:19 +00:00
Devang Patel
b5482a65c9
Fix dominator info update to accommodate CFG changes.
...
This fixes PR1559.
llvm-svn: 40024
2007-07-18 23:48:20 +00:00
Owen Anderson
55b794723f
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.
llvm-svn: 39945
2007-07-16 23:34:39 +00:00
Owen Anderson
efc00e35cf
Add support for walking up memory def chains, which enables finding many more
...
dead stores on 400.perlbench.
llvm-svn: 39929
2007-07-16 21:52:50 +00:00
Dan Gohman
0ba554c0c8
Fix comments about vectors to use the current wording.
...
llvm-svn: 39921
2007-07-16 14:29:03 +00:00
Chris Lattner
66b7f0c956
Repair a regression in Transforms/InstCombine/mul.ll that Reid noticed.
...
llvm-svn: 39896
2007-07-16 04:15:34 +00:00
Nick Lewycky
6cdd641e1d
Start adding and cleaning up comments.
...
llvm-svn: 39894
2007-07-16 02:58:37 +00:00
Chris Lattner
f6a91d74e0
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.
llvm-svn: 39880
2007-07-15 20:54:51 +00:00
Chris Lattner
9cb8da1cb8
Implement shift-simplify.ll:test3, turning:
...
(X << 31) <s 0 --> (X&1) != 0
This happens dozens of times in the CFE.
llvm-svn: 39879
2007-07-15 20:42:37 +00:00
Nick Lewycky
93d39c53b6
Use maximal intersection algorithm exclusively. Fixes miscompile bug.
...
llvm-svn: 39852
2007-07-14 04:28:04 +00:00
Owen Anderson
9ade055c0f
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.
llvm-svn: 39839
2007-07-13 22:50:48 +00:00
Devang Patel
cfdf3b6eff
Disable claims to preserve analysis until open issues are resolved.
...
llvm-svn: 39834
2007-07-13 21:53:42 +00:00
Owen Anderson
275a5ef481
Be more aggressive in removing dead stores, and in removing instructions trivially dead after DSE.
...
This drastically improves the effect of FastDSE on kimwitu++.
llvm-svn: 39819
2007-07-13 18:26:26 +00:00
Owen Anderson
0ad3e0795b
Reimplement removing stores to allocas at the end of a function. This should be safe now.
...
llvm-svn: 39790
2007-07-12 21:41:30 +00:00
Owen Anderson
999d27d563
Make the condition-checking for free with non-trivial dependencies more correct.
...
llvm-svn: 39789
2007-07-12 18:08:51 +00:00
Owen Anderson
6edb47d8be
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.
...
llvm-svn: 39788
2007-07-12 17:52:20 +00:00
Gabor Greif
33f07df616
checked in as obvious,
...
thanks Benoit Boissinot!
llvm-svn: 39774
2007-07-12 13:31:38 +00:00
Owen Anderson
b6211f5b50
Let MemoryDependenceAnalysis take care of updating AliasAnalysis.
...
llvm-svn: 39769
2007-07-12 00:06:21 +00:00
Devang Patel
f26f0ea111
Preserve analysis info.
...
llvm-svn: 39767
2007-07-11 23:47:28 +00:00
Owen Anderson
733ff7bbc0
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.
llvm-svn: 39762
2007-07-11 23:19:17 +00:00
Owen Anderson
fb23f70dbf
Add support for eliminate stores to stack-allocated memory locations at the end
...
of a function.
llvm-svn: 39754
2007-07-11 21:06:56 +00:00
Owen Anderson
2388e80b0a
Handle eliminating stores that occur right before a free.
...
llvm-svn: 39753
2007-07-11 20:38:34 +00:00
Owen Anderson
28789d81c5
Clean up a few things based on Chris' feedback.
...
llvm-svn: 39747
2007-07-11 19:03:09 +00:00
Owen Anderson
1eaba31f12
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.
llvm-svn: 38517
2007-07-11 00:46:18 +00:00
Owen Anderson
7d38ac8a37
Make the pass registration static.
...
llvm-svn: 38508
2007-07-10 20:20:19 +00:00
Nick Lewycky
ea767d42e8
Update the ValueRanges interface to use value numbers instead of Value*s.
...
llvm-svn: 38483
2007-07-10 03:28:21 +00:00
Owen Anderson
4ce919d799
Move some key maps from std::map to DenseMap. This improves the time to optimize Anton's testcase from 17.5s
...
to 15.7s.
llvm-svn: 38480
2007-07-10 00:27:22 +00:00
Owen Anderson
65f9dd6973
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.
llvm-svn: 38479
2007-07-10 00:09:25 +00:00
Owen Anderson
2106613ce6
Add an assertion if find_leader fails.
...
llvm-svn: 38477
2007-07-09 23:57:18 +00:00
Owen Anderson
8d4339f8db
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!
llvm-svn: 38475
2007-07-09 22:29:50 +00:00
Devang Patel
65f3717db9
Expose struct size threhold to allow users to tweak their own setting.
...
llvm-svn: 38472
2007-07-09 21:19:23 +00:00
Owen Anderson
08020078f3
Fix a comment.
...
llvm-svn: 38459
2007-07-09 16:43:55 +00:00
Owen Anderson
25d57adc4a
Improve a hotspot that was making build_sets() slower by calling lookup() too
...
often. This improves Anton's testcase from 36s to 32s.
llvm-svn: 38441
2007-07-09 07:56:55 +00:00
Owen Anderson
f695fa9257
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.
llvm-svn: 38439
2007-07-09 06:50:06 +00:00
Owen Anderson
30fc1decdc
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.
llvm-svn: 37967
2007-07-07 20:13:57 +00:00
Nick Lewycky
dc39ec317a
Back out Devang's fix for PR1320 because it causes PR1542.
...
llvm-svn: 37966
2007-07-07 16:23:34 +00:00
Devang Patel
91939a6a55
These rountines are now available as part of basic block utilities.
...
llvm-svn: 37955
2007-07-06 22:03:47 +00:00
Devang Patel
8803061b9e
Request DominanceFrontiner in advance.
...
llvm-svn: 37954
2007-07-06 21:43:22 +00:00
Devang Patel
a7af16c808
Preserve various analysis info.
...
llvm-svn: 37953
2007-07-06 21:40:13 +00:00
Owen Anderson
16d027ce3e
Be more aggressive in the heuristic. This mostly exposes more opportunities
...
for the GVN part of GVNPRE to apply.
llvm-svn: 37951
2007-07-06 20:29:43 +00:00
Owen Anderson
d50fe47cf3
Achieve what the incorrect test was trying to do by simply requiring that all
...
critical edges be split before we begin.
llvm-svn: 37949
2007-07-06 18:12:36 +00:00
Owen Anderson
da85a8134e
Remove an incorrect check.
...
llvm-svn: 37948
2007-07-06 16:52:47 +00:00
Zhou Sheng
2a79b1ae13
Correct a typo.
...
llvm-svn: 37936
2007-07-06 06:01:16 +00:00
Owen Anderson
7cf3a2aa1f
Fix a bunch of issues found in a testcase from 400.perlbench.
...
llvm-svn: 37929
2007-07-05 23:11:26 +00:00
Nick Lewycky
c744dbdd30
Break "variable canonicalization" out of InequalityGraph and into its own class
...
"ValueNumbering".
llvm-svn: 37881
2007-07-05 03:15:00 +00:00
Owen Anderson
2024c08f65
Fix another bug, this time in PREing select instructions.
...
llvm-svn: 37878
2007-07-04 22:33:23 +00:00
Owen Anderson
ac8fe6b8ca
Fix a typo that was killing GVNPRE of select instructions.
...
llvm-svn: 37871
2007-07-04 18:26:18 +00:00
Owen Anderson
06dd016177
Fix an error in phi translation of GEPs that was causing failures.
...
llvm-svn: 37868
2007-07-04 04:51:16 +00:00
Owen Anderson
4a5c005585
Add support for performing GVNPRE on GEP instructions.
...
llvm-svn: 37862
2007-07-03 23:51:19 +00:00
Owen Anderson
6599e49230
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.
llvm-svn: 37860
2007-07-03 22:50:56 +00:00
Owen Anderson
778ad67a26
Make the unary operator case a bit faster, since casts are the only kind of unary operation.
...
llvm-svn: 37857
2007-07-03 19:01:42 +00:00
Owen Anderson
ba084e17fd
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
Devang Patel
2a1af2196d
Preserve DominanceFrontier.
...
llvm-svn: 37820
2007-06-29 23:11:49 +00:00
Devang Patel
8292a2ee90
Do not filter loop if candidate branch is in loop header.
...
llvm-svn: 37792
2007-06-29 01:39:53 +00:00
Owen Anderson
cff6ffe45c
Add support for value numbering (but not actually optimizing) cast instructions.
...
llvm-svn: 37789
2007-06-29 00:51:03 +00:00
Owen Anderson
f134e54bb1
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
f1665858f3
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
Devang Patel
03d844eebd
- 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.
llvm-svn: 37772
2007-06-28 02:05:46 +00:00
Devang Patel
7f468af921
Update LoopUnswitch pass to preserve DomiantorTree.
...
llvm-svn: 37771
2007-06-28 00:49:00 +00:00
Devang Patel
50d5420cdc
If a condition is not inside a loop then the condition is suitable
...
to loop unswitch candidate for the loop.
llvm-svn: 37770
2007-06-28 00:44:10 +00:00
Owen Anderson
9372f36b3c
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
97dd99d761
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
a7927caa56
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
Zhou Sheng
011fc80616
Fix a bug.
...
llvm-svn: 37751
2007-06-27 09:50:26 +00:00
Owen Anderson
97de56ae2b
Add support for performing GVNPRE on the three vector-specific operations.
...
llvm-svn: 37745
2007-06-27 04:10:46 +00:00
Owen Anderson
dc1d567274
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
fb09af59e0
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
293173ccd2
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
Nick Lewycky
59c02f6336
Fix value ranges.
...
llvm-svn: 37713
2007-06-24 20:14:22 +00:00
Owen Anderson
e16e7f2d3d
Fix a silly mistake that was causing failures.
...
llvm-svn: 37712
2007-06-24 08:42:24 +00:00
Nick Lewycky
c238dd7dca
Remove tabs.
...
llvm-svn: 37710
2007-06-24 04:40:16 +00:00
Nick Lewycky
fff717bc50
Remove use of ETForest. Also cleaned up issues around unreachable basic
...
blocks, and optimizing within one basic block.
llvm-svn: 37709
2007-06-24 04:36:20 +00:00
Owen Anderson
4713f37034
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
65af4e7d2b
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
1fe94b16dc
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
92c7510376
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
0abfa1ecb2
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
e121e85517
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
Chris Lattner
4624e16f16
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.
llvm-svn: 37692
2007-06-21 18:11:19 +00:00
Owen Anderson
eb29dac190
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
a783224b25
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
b06cc18b7c
Comment-ize the functions in GVNPRE.
...
llvm-svn: 37681
2007-06-21 00:19:05 +00:00
Chris Lattner
26537049eb
refactor a bunch of code out of visitICmpInstWithInstAndIntCst into its own
...
routine.
llvm-svn: 37679
2007-06-20 23:46:26 +00:00
Owen Anderson
ff60973eb8
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
58265d2391
Make GVNPRE accurate report whether it modified the function or not.
...
llvm-svn: 37673
2007-06-20 18:30:20 +00:00
Owen Anderson
815c4d384b
Get rid of an unneeded helper function.
...
llvm-svn: 37670
2007-06-20 00:43:33 +00:00