Nick Lewycky
34cf98c558
It's safe to fold not of fcmp.
...
llvm-svn: 40870
2007-08-06 20:04:16 +00:00
David Greene
02ac5cfce9
Make this code more efficient.
...
llvm-svn: 40861
2007-08-06 15:09:17 +00:00
Chris Lattner
bf64e878e6
remove some dead lines
...
llvm-svn: 40859
2007-08-06 06:21:06 +00:00
Reid Spencer
ac9262072f
Silence some warnings from doxygen about @param argument name not matching the
...
actual argument name of the documented function.
llvm-svn: 40851
2007-08-05 19:35:22 +00:00
Chris Lattner
6d8e77a703
at the end of instcombine, explicitly clear WorklistMap.
...
This shrinks it down to something small. On the testcase
from PR1432, this speeds up instcombine from 0.7959s to 0.5000s,
(59%)
llvm-svn: 40840
2007-08-05 08:47:58 +00:00
Chris Lattner
e562e9bdb0
rewrite the code used to construct pruned SSA form with the IDF method.
...
In the old way, we computed and inserted phi nodes for the whole IDF of
the definitions of the alloca, then computed which ones were dead and
removed them.
In the new method, we first compute the region where the value is live,
and use that information to only insert phi nodes that are live. This
eliminates the need to compute liveness later, and stops the algorithm
from inserting a bunch of phis which it then later removes.
This speeds up the testcase in PR1432 from 2.00s to 0.15s (14x) in a
release build and 6.84s->0.50s (14x) in a debug build.
llvm-svn: 40825
2007-08-04 22:50:14 +00:00
Chris Lattner
b7d4ef6ca6
Factor out a whole bunch of code into it's own method.
...
llvm-svn: 40824
2007-08-04 21:14:29 +00:00
Chris Lattner
d4a88d77d4
Use getNumPreds(BB) instead of computing them manually. This is a very small but
...
measurable speedup.
llvm-svn: 40823
2007-08-04 21:06:15 +00:00
Chris Lattner
6b9dca62dd
Change the rename pass to be "tail recursive", only adding N-1 successors
...
to the worklist, and handling the last one with a 'tail call'. This speeds
up PR1432 from 2.0578s to 2.0012s (2.8%)
llvm-svn: 40822
2007-08-04 20:40:27 +00:00
Chris Lattner
c1d2c2bdc8
cache computation of #preds for a BB. This speeds up
...
mem2reg from 2.0742->2.0522s on PR1432.
llvm-svn: 40821
2007-08-04 20:24:50 +00:00
Chris Lattner
8335a86536
reserve operand space for phi nodes when we insert them.
...
llvm-svn: 40820
2007-08-04 20:14:34 +00:00
Chris Lattner
32d9e4ba5c
use continue to avoid nesting, no functionality change.
...
llvm-svn: 40819
2007-08-04 20:07:06 +00:00
Chris Lattner
a97ceae263
Promoting allocas with the 'single store' fastpath is
...
faster than with the 'local to a block' fastpath. This speeds
up PR1432 from 2.1232 to 2.0686s (2.6%)
llvm-svn: 40818
2007-08-04 20:03:23 +00:00
Chris Lattner
479e3fa267
When PromoteLocallyUsedAllocas promoted allocas, it didn't remember
...
to increment NumLocalPromoted, and didn't actually delete the
dead alloca, leading to an extra iteration of mem2reg.
llvm-svn: 40817
2007-08-04 20:01:43 +00:00
Chris Lattner
bd506a8e12
std::map -> DenseMap
...
llvm-svn: 40816
2007-08-04 19:52:20 +00:00
Nick Lewycky
4e96222245
Clean up comments, fix up some confusing code logic.
...
Predsimplify fails llvm-gcc bootstrap.
llvm-svn: 40815
2007-08-04 18:45:32 +00:00
Chris Lattner
9748fa5c6f
fix a logic bug where we wouldn't promote single store allocas if the
...
stored value was a non-instruction value. Doh.
This increase the # single store allocas from 8982 to 9026, and
speeds up mem2reg on the testcase in PR1432 from 2.17 to 2.13s.
llvm-svn: 40813
2007-08-04 02:45:02 +00:00
Chris Lattner
3f971fdbd5
When we do the single-store optimization, delete both the store
...
and the alloca so they don't get reprocessed.
This speeds up PR1432 from 2.20s to 2.17s.
llvm-svn: 40812
2007-08-04 02:38:38 +00:00
Chris Lattner
c38b2a2473
Three improvements:
...
1. Check for revisiting a block before checking domination, which is faster.
2. If the stored value isn't an instruction, we don't have to check for domination.
3. If we have a value used in the same block more than once, make sure to remove the
block from the UsingBlocks vector. Not doing so forces us to go through the slow
path for the alloca.
The combination of these improvements increases the number of allocas on the fastpath
from 8935 to 8982 on PR1432. This speeds it up from 2.90s to 2.20s (31%)
llvm-svn: 40811
2007-08-04 02:32:22 +00:00
Chris Lattner
fe6a3e2fb4
switch from using a std::set to using a SmallPtrSet. This speeds up the
...
testcase in PR1432 from 6.33s to 2.90s (2.22x)
llvm-svn: 40810
2007-08-04 02:21:22 +00:00
Chris Lattner
9b45ad1f5c
In mem2reg, when handling the single-store case, make sure to remove
...
a using block from the list if we handle it. Not doing this caused us
to not be able to promote (with the fast path) allocas which have uses (whoops).
This increases the # allocas hitting this fastpath from 4042 to 8935 on the
testcase in PR1432, speeding up mem2reg by 2.6x
llvm-svn: 40809
2007-08-04 02:15:24 +00:00
Chandler Carruth
00e56b0e81
This is the patch to provide clean intrinsic function overloading support in LLVM. It cleans up the intrinsic definitions and generally smooths the process for more complicated intrinsic writing. It will be used by the upcoming atomic intrinsics as well as vector and float intrinsics in the future.
...
This also changes the syntax for llvm.bswap, llvm.part.set, llvm.part.select, and llvm.ct* intrinsics. They are automatically upgraded by both the LLVM ASM reader and the bitcode reader. The test cases have been updated, with special tests added to ensure the automatic upgrading is supported.
llvm-svn: 40807
2007-08-04 01:51:18 +00:00
Chris Lattner
b5af2cf90d
split rewriting of single-store allocas into its own
...
method.
llvm-svn: 40806
2007-08-04 01:47:41 +00:00
Chris Lattner
f8b22a3568
refactor some code to shrink PromoteMem2Reg::run a bit
...
llvm-svn: 40805
2007-08-04 01:41:18 +00:00
Chris Lattner
2d4d557c80
add a typedef, no other change.
...
llvm-svn: 40804
2007-08-04 01:19:38 +00:00
Chris Lattner
65181deba3
avoid an unneeded vector copy. This speeds up mem2reg on the testcase
...
in PR1432 by 6%
llvm-svn: 40803
2007-08-04 01:07:49 +00:00
Chris Lattner
34cf111957
make RenamePassWorkList a local var instead of an ivar.
...
llvm-svn: 40802
2007-08-04 01:04:40 +00:00
Owen Anderson
891f5b4d28
Fix a subtle miscompilation. This allows 197.parser to be compiled correctly.
...
llvm-svn: 40791
2007-08-03 19:59:35 +00:00
Owen Anderson
d1063b7a3c
Fix a subtle iterator invalidation bug in a recursive algorithm.
...
llvm-svn: 40776
2007-08-03 11:03:26 +00:00
Chris Lattner
cf6dd53ad8
Fix an accidental commit.
...
llvm-svn: 40758
2007-08-02 21:33:36 +00:00
Owen Anderson
414247c075
Fix 80 col. violations.
...
llvm-svn: 40751
2007-08-02 18:20:52 +00:00
Owen Anderson
ad74eeed3d
Fix 80 col. violations.
...
llvm-svn: 40750
2007-08-02 18:16:06 +00:00
Owen Anderson
ae769ac824
Fix 80 col. violations.
...
llvm-svn: 40749
2007-08-02 18:11:11 +00:00
Owen Anderson
d617e4c963
Fix a bug that was causing several miscompilations on SPEC.
...
llvm-svn: 40746
2007-08-02 17:56:05 +00:00
Chris Lattner
5ca7348fc4
Replacing a cast with another one does not reduce the number of
...
casts in the input.
llvm-svn: 40741
2007-08-02 17:23:38 +00:00
Chris Lattner
7c6e8f735f
Disable an xform that causes an infinite loop. This fixes PR1594
...
llvm-svn: 40739
2007-08-02 16:56:32 +00:00
Chris Lattner
25a8bfdedb
wrap some long lines. Major offenders that are left include
...
gvn, gvnpre, dse, and predsimplify. To see these, use:
make check-line-length
llvm-svn: 40738
2007-08-02 16:53:43 +00:00
Devang Patel
937b07fb5e
Update dominator info for the middle blocks created while spliting
...
exit edge to preserve LCSSA.
Fix dominance frontier update during loop unswitch. This fixes PR 1589, again
llvm-svn: 40737
2007-08-02 15:25:57 +00:00
Chris Lattner
0111f62050
Enhance instcombine to be more aggressive about folding casts of
...
operations of casts. This implements InstCombine/zext-fold.ll
llvm-svn: 40726
2007-08-02 06:11:14 +00:00
Chris Lattner
2cacb6cc56
Fix PR1575 and test/Transforms/CondProp/2007-08-01-InvalidRead.ll
...
llvm-svn: 40720
2007-08-02 04:47:05 +00:00
Devang Patel
f21f509c2c
Undo previous check-in.
...
llvm-svn: 40698
2007-08-01 23:24:50 +00:00
Devang Patel
51c61e730a
Update dominator info for the middle blocks created while spliting
...
exit edge to preserve LCSSA.
Fix dominance frontier update during loop unswitch. This fixes PR 1589.
llvm-svn: 40695
2007-08-01 22:23:50 +00:00
Owen Anderson
7028dfaf9d
Make non-local memdep not be recursive, and fix a bug on 403.gcc that this exposed.
...
llvm-svn: 40692
2007-08-01 22:01:54 +00:00
Dan Gohman
7dd04fb91c
More explicit keywords.
...
llvm-svn: 40673
2007-08-01 15:32:29 +00:00
Owen Anderson
58e64df595
Rename FastDSE to just DSE.
...
llvm-svn: 40668
2007-08-01 06:36:51 +00:00
Owen Anderson
45499c55e5
Move FastDSE in to DeadStoreElimination.
...
llvm-svn: 40667
2007-08-01 06:30:51 +00:00
Owen Anderson
48e3b68d57
Remove old DSE.
...
llvm-svn: 40666
2007-08-01 06:30:10 +00:00
David Greene
f06a395bb9
New CallInst interface to address GLIBCXX_DEBUG errors caused by
...
indexing an empty std::vector.
Updates to all clients.
llvm-svn: 40660
2007-08-01 03:43:44 +00:00
Owen Anderson
89022c1367
Don't let the memory allocator outsmart GVN. ;-)
...
llvm-svn: 40655
2007-07-31 23:27:13 +00:00
Owen Anderson
9c996b3212
Fix a failure I accidentally caused in my last commit by mishandling the
...
removal of redundant phis.
llvm-svn: 40650
2007-07-31 20:18:28 +00:00
Lauro Ramos Venancio
abf6c6d469
Fix a bug in GetKnownAlignment of packed structs.
...
llvm-svn: 40649
2007-07-31 20:13:21 +00:00
Owen Anderson
d178c05c62
Fix a misoptimization in aha.
...
llvm-svn: 40642
2007-07-31 17:43:14 +00:00
Dan Gohman
7702c23d4a
Use SCEVExpander::InsertCastOfTo instead of calling new IntToPtrInst
...
directly, because the insert point used by the SCEVExpander may vary
from what LSR originally computes.
llvm-svn: 40641
2007-07-31 17:22:27 +00:00
Devang Patel
5a3594de20
Add note.
...
llvm-svn: 40638
2007-07-31 16:52:25 +00:00
Devang Patel
84e123116e
Loop unswitch preserves dom info.
...
Use simple analysis interface to preserve analysis info maintained by other loop passes.
llvm-svn: 40627
2007-07-31 08:03:26 +00:00
Devang Patel
67b3734f28
Implement Simple Analysis interfaces - cloneBasicBlockAnalysis and deleteAnalysisValue.
...
llvm-svn: 40626
2007-07-31 08:01:41 +00:00
Devang Patel
069a8d9716
If loop can be unswitched again, then do it yourself.
...
llvm-svn: 40609
2007-07-30 23:07:10 +00:00
Owen Anderson
c7545280a2
Avoid potential iterator invalidation problems.
...
llvm-svn: 40607
2007-07-30 21:26:39 +00:00
Devang Patel
81c015b472
Remove dead code.
...
llvm-svn: 40606
2007-07-30 21:10:44 +00:00
Devang Patel
1b2732c880
LCSSA preserves dom info.
...
llvm-svn: 40604
2007-07-30 20:23:45 +00:00
Devang Patel
84144042b2
Loop Rotation pass preserves dominator tree and frontier.
...
llvm-svn: 40603
2007-07-30 20:22:53 +00:00
Devang Patel
2e8466c22a
LICM preserves scalar evolution and dom frontier.
...
llvm-svn: 40602
2007-07-30 20:19:59 +00:00
Reid Spencer
eb6f2d338a
Fix a typo/thinko.
...
llvm-svn: 40599
2007-07-30 19:53:57 +00:00
Owen Anderson
fff534d147
Use more caching when computing non-local dependence. This makes bzip2 not
...
use up the entire 32-bit address space.
llvm-svn: 40596
2007-07-30 17:29:24 +00:00
Owen Anderson
a8d0a6ee40
Fix a bug caused by indiscriminantly asking for the dominators of a predecessor.
...
llvm-svn: 40595
2007-07-30 16:57:08 +00:00
Devang Patel
a03e82d7ee
Use SmallPtrSet.
...
llvm-svn: 40560
2007-07-27 18:34:27 +00:00
Chuck Rose III
4a3a018844
VStudio compiler errors and placing Function*->ExFunc map under ManagedStatic control.
...
This commit fixes two things. One is a pair of VStudio compiler errors stemming from variables
which defined within the for loop statement and also within the body of the for loop. I fixed these
by renaming one of the two variables. Additionally, I've made the Function*->ExFunc map in
ExternalFunctions.cpp a ManagedStatic object, so that cleanup will be done on llvm_shutdown. In repeated
uses of the interpreter, where the same Function* address may get used for completely differnet functions,
this was causing a crash.
llvm-svn: 40558
2007-07-27 18:26:35 +00:00
Devang Patel
4dea53597a
Fix thinko. Update return status appropriately.
...
llvm-svn: 40546
2007-07-26 20:21:42 +00:00
Owen Anderson
f2b10d3de3
Fix a couple more bugs in the phi construction by pulling in code that does
...
almost the same things from LCSSA.
llvm-svn: 40540
2007-07-26 18:26:51 +00:00
Dan Gohman
298f3fd9b7
Move the GET_SIDE_EFFECT_INFO logic from isInstructionTriviallyDead
...
to Instruction::mayWriteToMemory, fixing a FIXME, and helping
various places that call mayWriteToMemory directly.
llvm-svn: 40533
2007-07-26 16:06:08 +00:00
Dan Gohman
fd392a7a51
Remove a bogus return statement, what appears to have been a pasto
...
from Relation::contradicts in Relation::incorporate.
llvm-svn: 40531
2007-07-26 15:29:35 +00:00
Owen Anderson
ed75133924
Fix what is _hopefully_ the last corner case for loops.
...
llvm-svn: 40503
2007-07-25 23:54:42 +00:00
Owen Anderson
1e53615073
My last commit was not correct for nested loops. Fix it, and add a testcase for it.
...
llvm-svn: 40498
2007-07-25 22:19:40 +00:00
Owen Anderson
ce9d73dbe7
Fix an infinite loop on 300.twolf.
...
llvm-svn: 40497
2007-07-25 22:03:06 +00:00
Owen Anderson
522f7a7608
Fix a bug that was causing GVN to crash on 252.eon.
...
llvm-svn: 40494
2007-07-25 21:13:41 +00:00
Owen Anderson
6a1a8d05b8
Add basic support for performing whole-function RLE.
...
Note: This has not yet been thoroughly tested. Use at your own risk.
llvm-svn: 40489
2007-07-25 19:57:03 +00:00
Devang Patel
d7b401bafd
Add BasicInliner interface.
...
This interface allows clients to inline bunch of functions with module
level call graph information.:wq
llvm-svn: 40486
2007-07-25 18:00:25 +00:00
Owen Anderson
eb9f1b612c
Add a GVN pass, using the value numbering code I developed for GVNPRE and the
...
load elimination code from RedundantLoadElimination.
llvm-svn: 40469
2007-07-24 17:55:58 +00:00
Owen Anderson
5969a3cb91
Rename a lot of things to change FastDLE to RedundantLoadElimination.
...
llvm-svn: 40457
2007-07-24 00:17:04 +00:00
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
Devang Patel
45675e56ad
Verify loop info.
...
llvm-svn: 40062
2007-07-19 18:02:32 +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
fe0ef94227
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.
llvm-svn: 40035
2007-07-19 02:29:24 +00:00
Devang Patel
4020116257
Now this temp. fix is not required.
...
llvm-svn: 40034
2007-07-19 02:22:21 +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