Commit Graph

939 Commits

Author SHA1 Message Date
Devang Patel
b4559a2179 Make LCSSA a loop pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39844 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 23:57:11 +00:00
Tanya Lattner
08d14d2469 Adding ability to demote phi to stack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39744 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 18:41:34 +00:00
Anton Korobeynikov
a289511090 During module cloning copy aliases too. This fixes PR1544
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38505 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-10 19:07:35 +00:00
Devang Patel
8019893c3f Add SplitEdge and SplitBlock utility routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37952 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 21:39:20 +00:00
David Greene
c08fa28897 Fix reference to iterator invalidated by an erase operation. Uncovered
by _GLIBCXX_DEBUG.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37796 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-29 02:53:16 +00:00
Devang Patel
0e7f728ad1 Move code to update dominator information after basic block is split
from LoopSimplify.cpp to Dominator.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37689 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-21 17:23:45 +00:00
Devang Patel
fe7d4e50b8 Add and use DominatorTreeBase::findNearestCommonDominator().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37545 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 23:31:22 +00:00
Devang Patel
f60e5a2cd9 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37542 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 21:45:31 +00:00
Devang Patel
b28aaadfff simplify
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37541 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 21:25:31 +00:00
Devang Patel
e3f653606d Simplify. Dominator Tree is required so always available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37540 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-11 21:18:00 +00:00
Devang Patel
dba2413b2e Update LoopSimplify to require and preserve DominatorTree only.
Now LoopSimplify does not require nor preserve ETForest.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37512 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 01:50:32 +00:00
Devang Patel
f86a73cbef Do not preserve ETForest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37506 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-08 00:02:08 +00:00
Devang Patel
4b90e3a276 Do not use ETForest as well as DomiantorTree. DominatorTree is sufficient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37501 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 22:17:16 +00:00
Devang Patel
326821ef12 Use DominatorTree instead of ETForest.
This allows faster immediate domiantor walk.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37500 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 21:57:03 +00:00
Devang Patel
9a51157db5 Maintain ETNode as part of DomTreeNode.
This adds redundancy for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37492 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-07 17:47:21 +00:00
Devang Patel
83beaee227 s/DominatorTree::createNewNode/DominatorTree::addNewBlock/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 16:43:25 +00:00
Devang Patel
26a6908768 Add basic block level interface to change immediate dominator
and create new node.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37414 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 16:22:33 +00:00
Devang Patel
26042420d6 s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37407 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-04 00:32:22 +00:00
Devang Patel
bec7647f98 s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37403 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-03 06:26:14 +00:00
Dan Gohman
fa73ea2d9f Minor comment cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37321 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-24 14:36:04 +00:00
Dan Gohman
23d9d27c26 Fix typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36994 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 21:10:54 +00:00
Nick Lewycky
ecd94c804a Fix typo in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36873 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 13:37:16 +00:00
Devang Patel
1997473cf7 Drop 'const'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 01:11:54 +00:00
Devang Patel
3e15bf33e0 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 21:39:20 +00:00
Devang Patel
794fd75c67 Do not use typeinfo to identify pass in pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-01 21:15:47 +00:00
Devang Patel
68c01b3cf3 Mem2Reg does not need TargetData.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36444 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-25 18:32:35 +00:00
Devang Patel
41968df51e Remove unused function argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36441 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-25 17:15:20 +00:00
Owen Anderson
cdacc498e4 Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36299 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-21 07:12:44 +00:00
Jeff Cohen
09b362cee6 Comment out usage of write() for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36287 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-20 22:40:10 +00:00
Devang Patel
58d7fbf250 Avoid recursion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36272 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-20 20:04:37 +00:00
Owen Anderson
df07335b46 Move more passes to using ETForest instead of DominatorTree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36271 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-20 06:27:13 +00:00
Evan Cheng
cc045d5df8 Revert Owen's last check-in. This is breaking Mac OS X / PPC llvm-gcc bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36258 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-18 22:39:00 +00:00
Owen Anderson
ee6dcaf906 Use new ETForest accessor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36248 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-18 04:46:35 +00:00
Owen Anderson
26c37b1fdc Use ETForest instead of DominatorTree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36247 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-18 04:39:32 +00:00
Chris Lattner
261cdfbe5e remove use of BasicBlock::getNext
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36205 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-17 18:09:47 +00:00
Chris Lattner
decb0ca18b remove use of Instruction::getNext
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36199 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-17 17:47:54 +00:00
Anton Korobeynikov
bed2946a96 Removed tabs everywhere except autogenerated & external files. Add make
target for tabs checking.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36146 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-16 18:10:23 +00:00
Chris Lattner
a6a996d319 Fix PR1335 and Transforms/Inline/2007-04-15-InlineEH.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36090 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-15 21:38:06 +00:00
Owen Anderson
3dc6776b33 Remove ImmediateDominator analysis. The same information can be obtained from DomTree. A lot of code for
constructing ImmediateDominator is now folded into DomTree construction.

This is part of the ongoing work for PR217.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36063 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-15 08:47:27 +00:00
Chris Lattner
d6b7a1648c avoid copying sets and vectors around.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36017 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-14 22:10:17 +00:00
Lauro Ramos Venancio
c763552299 Implement the "thread_local" keyword.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35950 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-12 18:32:50 +00:00
Owen Anderson
cc221cdf0c Re-constify things that don't break the build. Last patch in this
series, I promise.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35848 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 23:38:18 +00:00
Owen Anderson
f7c83188cd Unconst-ify stuff that broke the build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35843 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 23:08:26 +00:00
Owen Anderson
ad19014591 Const-ify some parameters, and some cosmetic cleanups. No functionality
change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35842 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 22:54:50 +00:00
Owen Anderson
0cd0461873 Tabs -> Spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35841 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 22:31:43 +00:00
Owen Anderson
17cba6d232 Improve some _slow_ behavior introduced in my patches the last few days.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35839 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 22:25:09 +00:00
Owen Anderson
558fc740da Cleanup some from my DomSet-removal changes. Add a new
isReachableFromEntry
test to ETForest to factor a common test out of code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35786 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 00:52:49 +00:00
Nick Lewycky
a397ce1cc2 Remove DominatorSet usage from LoopSimplify. Patch from Owen Anderson.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35757 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-08 01:04:30 +00:00
Owen Anderson
e9ed4452bc Add DomSet back, and revert the changes to LoopSimplify. Apparently the
ETForest updating mechanisms don't work as I thought they did.  These changes
will be reapplied once the issue is worked out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35741 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 18:23:27 +00:00
Owen Anderson
4f9e58ecdf Completely purge DomSet from LoopSimplify. This is part of the
continuing work on PR1171.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35730 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 06:56:47 +00:00
Owen Anderson
a3ca0b648c BreakCriticalEdges does still preserve DominatorTree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35729 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 05:57:09 +00:00
Owen Anderson
2d43519454 Expunge DomSet from BreakCriticalEdges. This is part of the continuing
work for PR 1171.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35728 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 05:49:29 +00:00
Owen Anderson
c6fcf29e81 Expunge DomSet from CodeExtractor. This is part of the continuing work
on PR1171.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35726 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 05:31:27 +00:00
Owen Anderson
d44008ae40 Expunge a bunch of uses of DomSet from LoopSimplify. Many more remain.
This is the beginning of work for PR1171.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35720 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 04:37:14 +00:00
Chris Lattner
c995123182 reduce use of std::set
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35576 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-02 01:44:59 +00:00
Devang Patel
d64d3a1d28 Reduce malloc/free traffic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-26 23:19:29 +00:00
Dan Gohman
ecb7a77885 Change uses of Function::front to Function::getEntryBlock for readability.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35265 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-22 16:38:57 +00:00
Devang Patel
3b57b6f36e LoopSimplify::FindPHIToPartitionLoops()
Use ETForest instead of DominatorSet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35221 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-20 20:18:12 +00:00
Jeff Cohen
c4558fde76 Unbreak VC++ build. Do not use identifiers starting with _ as they are reserved and
can collide with system defined names.  Windows defines _BB, for example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35066 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-12 17:56:27 +00:00
Anton Korobeynikov
e2ff29c17c Use range tests in LowerSwitch, where possible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35057 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-10 16:46:28 +00:00
Devang Patel
f7543fe35a Remove dead comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35053 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-09 23:41:03 +00:00
Devang Patel
a5b7dc5ef8 Avoid recursion. Use iterative algorithm for RenamePass().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35052 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-09 23:39:14 +00:00
Reid Spencer
e8391e039e Make sure debug code is not evaluated in non-debug case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34856 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:15:21 +00:00
Reid Spencer
f1bed4c720 1. Sort switch cases using APInt safe comparison.
2. Make sure debug output of APInt values is safe for all bit widths.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34855 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:05:28 +00:00
Reid Spencer
4cf735b47e Use APInt safe isOne() method on ConstantInt instead of getZExtValue()==1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34854 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:03:17 +00:00
Reid Spencer
e1c99d4c69 Make sorting of ConstantInt be APInt clean through use of ult function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34853 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 23:01:14 +00:00
Chris Lattner
67ef241f45 switch the inliner from being recursive to being iterative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34832 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 03:11:20 +00:00
Chris Lattner
cae0a193e3 fix an obscure and tricky bug the inliner can hit sometimes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34531 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-23 19:54:30 +00:00
Jim Laskey
7d4853896c Revert changes for a simplier solution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34495 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-22 16:21:18 +00:00
Jim Laskey
c518ccfeb5 Itanium ABI exception handing support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34480 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-21 22:49:50 +00:00
Dan Gohman
e26bff22db Fix typos in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34456 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 20:52:03 +00:00
Chris Lattner
ec1f752ae4 eliminate use of deprecated apis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34417 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-19 07:34:47 +00:00
Reid Spencer
9d6565a5b1 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 02:26:10 +00:00
Chris Lattner
93e985f1b1 Eliminate use of ctors that take vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34219 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-13 02:10:56 +00:00
Chris Lattner
1ccd185cb4 stop using methods that take vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34205 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-12 22:56:41 +00:00
Chris Lattner
86cc423555 simplify code by using Value::takeName
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34177 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-11 01:37:51 +00:00
Chris Lattner
dfb22c3521 redesign the primary datastructure used by mem2reg to eliminate an
std::map of std::vector's (ouch!).  This speeds up mem2reg by 10% on 176.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33974 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-07 01:15:04 +00:00
Chris Lattner
d3874049a5 With the last change, we no longer need both directions of mapping from
BBNumbers.  Instead of using a bi-directional mapping, just use a single
densemap.  This speeds up mem2reg on 176.gcc by 8%, from  1.3489 to
1.2485s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33940 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 23:37:20 +00:00
Reid Spencer
9133fe2895 Apply the VISIBILITY_HIDDEN field to the remaining anonymous classes in
the Transforms library. This reduces debug library size by 132 KB, debug
binary size by 376 KB, and reduces link time for llvm tools slightly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33939 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 23:32:05 +00:00
Chris Lattner
a0d1548d0d Simplify use of DFBlocks, this makes no noticable performance difference,
but paves the way to eliminate BBNumbers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33938 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 23:31:26 +00:00
Chris Lattner
6a1a28dedd Switch InsertedPHINodes back to SmallPtrSet now that the SmallPtrSet::erase
bug is fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33932 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 23:11:37 +00:00
Chris Lattner
fc7d13d898 switch a SmallPtrSet back to an std::set for now, this caused problems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33930 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 22:28:52 +00:00
Chris Lattner
c670f3da72 switch an std::set over to a SmallPtrSet, speeding up mem2reg 6% on 176.gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33929 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 22:15:21 +00:00
Chris Lattner
c837615cf0 switch an std::set over to SmallPtrSet, speeding up mem2reg 3.4% on 176.gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33928 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 22:13:11 +00:00
Chris Lattner
40b6555561 eliminate some malloc traffic, this speeds up mem2reg by 3.4%.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33927 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 21:58:48 +00:00
Reid Spencer
ef9b9a7939 For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33918 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 20:47:22 +00:00
Reid Spencer
0974ea0911 For PR1177:
Revert last patch which caused iteration invalidation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33901 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 05:23:32 +00:00
Owen Anderson
93235181d6 Use DenseMap for pointer->pointer maps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33897 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 02:39:47 +00:00
Reid Spencer
6734b57d1b For PR1163:
Make the Module's dependent library use a std::vector instead of SetVector
adjust #includes in .cpp files because SetVector.h is no longer included.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33855 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-04 00:40:42 +00:00
Chris Lattner
5e665f5594 Switch inliner over to use DenseMap instead of std::map for ValueMap. This
speeds up the inliner 16%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33801 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-03 00:08:31 +00:00
Chris Lattner
8e8eda78cc Fix bugs in the inliner having to do with single-entry phi nodes and valuemap
updating.  These were exposed by Devang's recent passmgr changes (with
non-default passorderings) because now the inliner can be interleved with
the LCSSA pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33760 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-01 18:48:38 +00:00
Chris Lattner
20066f936c eliminate temporary vectors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33713 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 20:07:32 +00:00
Chris Lattner
79066fa6ac Adjust #includes to match movement of constant folding code from transformutils to libanalysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33680 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:46:24 +00:00
Chris Lattner
5520732b24 move a bunch of constant folding code f rom Transforms/Utils/Local.cpp into
libanalysis/ConstantFolding.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33679 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:45:45 +00:00
Chris Lattner
4973190b07 remove now-dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33678 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:29:47 +00:00
Chris Lattner
1dfdf8255e The inliner/cloner can now optionally take TargetData info, which can be
used by constant folding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33676 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:22:39 +00:00
Chris Lattner
9fa038dc21 Change constant folding APIs to take an optional TargetData, and change
ConstantFoldInstOperands/ConstantFoldCall to take a pointer to an array
of operands + size, instead of an std::vector.

In some cases, switch to using a SmallVector instead of a vector.
This allows us to get rid of some special case gross code that was there
to avoid the cost of constructing a vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33670 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:13:49 +00:00
Reid Spencer
5cbf985dcb For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 20:08:39 +00:00
Reid Spencer
26f238589f For PR761:
The Module::setEndianness and Module::setPointerSize methods have been
removed. Instead you can get/set the DataLayout. Adjust thise accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33530 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 08:11:39 +00:00
Devang Patel
4d447f5121 Inherit BasicBlockPass directly from Pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33511 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-25 23:23:25 +00:00
Reid Spencer
c10305743c For PR1043:
This is the final patch for this PR. It implements some minor cleanup
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask -> IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120.

Patch by Sheng Zhou.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-19 21:13:56 +00:00
Chris Lattner
42a7551725 rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.
rename Type::getIntegralTypeMask to Type::getIntegerTypeMask.

This makes naming much more consistent.  For example, there are now no longer any
instances of IntegerType that are not considered isInteger! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33225 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 02:27:26 +00:00
Chris Lattner
4d5f508318 Eliminate calls to isInteger, generalizing code and tightening checks as needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33218 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 01:55:30 +00:00
Chris Lattner
caed0e3d71 Fix Analysis/Dominators/2006-10-02-BreakCritEdges.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33210 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 00:15:09 +00:00
Chris Lattner
9fa58b5f66 Fix PR1110 and Analysis/Dominators/2007-01-14-BreakCritEdges.ll by being
more careful about unreachable code when updating dominator info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33204 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-14 18:33:35 +00:00
Reid Spencer
579dca12c2 Implement review feedback for the ConstantBool->ConstantInt merge. Chris
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33110 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 04:24:46 +00:00
Reid Spencer
4fe16d607d Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 18:21:29 +00:00
Zhou Sheng
6b6b6ef167 For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 12:24:14 +00:00
Chris Lattner
b76efb71d4 Change the interface to Module::getOrInsertFunction to be easier to use,to resolve PR1088, and to help PR411.
This simplifies many clients also


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32989 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 08:12:01 +00:00
Chris Lattner
a121fddf3c prepare for adjustment to getOrInsertFunction method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32985 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 07:54:34 +00:00
Reid Spencer
78d033e086 For PR411:
Take an incremental step towards type plane elimination. This change
separates types from values in the symbol tables by finally making use
of the TypeSymbolTable class. This yields more natural interfaces for
dealing with types and unclutters the SymbolTable class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32956 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 07:24:44 +00:00
Reid Spencer
c5b206b6be For PR950:
This patch replaces signed integer types with signless ones:
1. [US]Byte -> Int8
2. [U]Short -> Int16
3. [U]Int   -> Int32
4. [U]Long  -> Int64.
5. Removal of isSigned, isUnsigned, getSignedVersion, getUnsignedVersion
   and other methods related to signedness. In a few places this warranted
   identifying the signedness information from other sources.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32785 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-31 05:48:39 +00:00
Reid Spencer
e4d87aa2de For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-23 06:05:41 +00:00
Chris Lattner
d216e8ba60 switch more statistics over to STATISTIC, eliminating static ctors. Also,
delete some dead ones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32694 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 22:17:40 +00:00
Bill Wendling
5c7e326585 Added an automatic cast to "std::ostream*" etc. from OStream. We then can
rework the hacks that had us passing OStream in. We pass in std::ostream*
instead, check for null, and then dispatch to the correct print() method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32636 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-17 05:15:13 +00:00
Reid Spencer
7b06bd532d Replace CastInst::createInferredCast calls with more accurate cast
creation calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32521 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-13 00:50:17 +00:00
Reid Spencer
daa8e3c263 Fix the casting for the computation of the Malloc size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32477 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 09:17:08 +00:00
Reid Spencer
4da49122f3 Change inferred getCast into specific getCast. Passes all tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32469 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 05:05:00 +00:00
Bill Wendling
e81561909d Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32298 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-07 01:30:32 +00:00
Chris Lattner
ac0b6ae358 Detemplatize the Statistic class. The only type it is instantiated with
is 'unsigned'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32279 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 17:46:33 +00:00
Reid Spencer
3da59db637 For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31931 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-27 01:05:10 +00:00
Bill Wendling
0d45a096cf Remove #include <iostream> and use llvm_* streams instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31925 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-26 10:17:54 +00:00
Chris Lattner
822a879983 Do not convert massive blocks on phi nodes into select statements. Instead
only do these transformations if there are a small number of phi's.
This speeds up Ptrdist/ks from 2.35s to 2.19s on my mac pro.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31853 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-18 19:19:36 +00:00
Jim Laskey
d6c3422e31 Remove redundant <cmath>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31561 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-08 19:16:44 +00:00
Reid Spencer
3822ff5c71 For PR950:
This patch converts the old SHR instruction into two instructions,
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31542 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-08 06:47:33 +00:00
Jeff Cohen
d41b30def3 Unbreak VC++ build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31464 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-05 19:31:28 +00:00
Reid Spencer
3ed469ccd7 For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31380 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-02 20:25:50 +00:00
Chris Lattner
cbea67f55b generalize the fix for PR977 to also fix
Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31317 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-31 18:56:48 +00:00
Chris Lattner
1753faee81 Fix PR977 and Transforms/LCSSA/2006-10-31-UnreachableBlock.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31315 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-31 17:52:18 +00:00
Chris Lattner
120bc21576 Fix SimplifyCFG/2006-10-29-InvokeCrash.ll, a crash compiling QT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31284 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-29 21:21:20 +00:00
Chris Lattner
b57de3328d add option to isCriticalEdge
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31258 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-28 06:58:17 +00:00
Chris Lattner
27e1f90d85 Expose a smarter way to break critical edges.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31256 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-28 06:44:56 +00:00
Reid Spencer
b83eb6447b For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-20 07:07:24 +00:00
Chris Lattner
b74b181630 Fix SimplifyCFG/2006-10-19-UncondDiv.ll by disabling a bad xform.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31061 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-20 00:42:07 +00:00
Chris Lattner
3a15503c82 This case isn't implemented yet. It seems unlikely to be needed, but if it
ever is, we want to get an assert instead of silent bad codegen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30716 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-04 04:58:58 +00:00
Chris Lattner
86f7b2100c Fix PR932 and Analysis/Dominators/2006-10-02-BreakCritEdges.ll:
The critical edge block dominates the dest block if the destblock dominates
all edges other than the one incoming from the critical edge.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30696 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-03 07:02:02 +00:00
Chris Lattner
40d31ecb29 simplify code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30656 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-28 22:58:25 +00:00
Chris Lattner
120fce5540 Be far more careful when splitting a loop header, either to form a preheader
or when splitting loops with a common header into multiple loops.  In particular
the old code would always insert the preheader before the old loop header.  This
is disasterous in cases where the loop hasn't been rotated.  For example, it can
produce code like:

        .. outside the loop...
        jmp LBB1_2      #bb13.outer
LBB1_1: #bb1
        movsd 8(%esp,%esi,8), %xmm1
        mulsd (%edi), %xmm1
        addsd %xmm0, %xmm1
        addl $24, %edi
        incl %esi
        jmp LBB1_3      #bb13
LBB1_2: #bb13.outer
        leal (%edx,%eax,8), %edi
        pxor %xmm1, %xmm1
        xorl %esi, %esi
LBB1_3: #bb13
        movapd %xmm1, %xmm0
        cmpl $4, %esi
        jl LBB1_1       #bb1

Note that the loop body is actually LBB1_1 + LBB1_3, which means that the
loop now contains an uncond branch WITHIN it to jump around the inserted
loop header (LBB1_2).  Doh.

This patch changes the preheader insertion code to insert it in the right
spot, producing this code:

        ... outside the loop, fall into the header ...
LBB1_1: #bb13.outer
        leal (%edx,%eax,8), %esi
        pxor %xmm0, %xmm0
        xorl %edi, %edi
        jmp LBB1_3      #bb13
LBB1_2: #bb1
        movsd 8(%esp,%edi,8), %xmm0
        mulsd (%esi), %xmm0
        addsd %xmm1, %xmm0
        addl $24, %esi
        incl %edi
LBB1_3: #bb13
        movapd %xmm0, %xmm1
        cmpl $4, %edi
        jl LBB1_2       #bb1

Totally crazy, no branch in the loop! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30587 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-23 08:19:21 +00:00
Chris Lattner
c3984578be Teach UpdateDomInfoForRevectoredPreds to handle revectored preds that are not
reachable, making it general purpose enough for use by InsertPreheaderForLoop.
Eliminate custom dominfo updating code in InsertPreheaderForLoop, using
UpdateDomInfoForRevectoredPreds instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30586 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-23 07:40:52 +00:00
Chris Lattner
a4646b61e4 Second half of the fix for Transforms/Inline/inline_cleanup.ll
This folds unconditional branches that are often produced by code
specialization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30307 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-13 21:27:00 +00:00
Chris Lattner
33bb3c8be3 Implement the first half of Transforms/Inline/inline_cleanup.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30303 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-13 19:23:57 +00:00
Chris Lattner
97d2dbd100 Fix Duraid's changes to work when TLI is null. This fixes the failing
lowerinvoke regtests.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30115 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-05 17:48:07 +00:00
Duraid Madina
2a0013f59f add setJumpBufSize() and setJumpBufAlignment() to target-lowering.
Call these from your backend to enjoy setjmp/longjmp goodness, see
lib/Target/IA64/IA64ISelLowering.cpp for an example


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30095 91177308-0d34-0410-b5e6-96231b3b80d8
2006-09-04 06:21:35 +00:00
Chris Lattner
7f8897f22e eliminate RegisterOpt. It does the same thing as RegisterPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29925 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-27 22:42:52 +00:00
Chris Lattner
a4f0b3a084 s|llvm/Support/Visibility.h|llvm/Support/Compiler.h|
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29911 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-27 12:54:02 +00:00
Chris Lattner
3bb4657488 Don't attempt to split subloops out of a loop with a huge number of backedges.
Not only will this take huge amounts of compile time, the resultant loop nests
won't be useful for optimization.  This reduces loopsimplify time on
Transforms/LoopSimplify/2006-08-11-LoopSimplifyLongTime.ll from ~32s to ~0.4s
with a debug build of llvm on a 2.7Ghz G5.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29647 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-12 05:25:00 +00:00
Chris Lattner
fa78946482 Reimplement the loopsimplify code which deletes edges from unreachable
blocks that target loop blocks.

Before, the code was run once per loop, and depended on the number of
predecessors each block in the loop had.  Unfortunately, scanning preds can
be really slow when huge numbers of phis exist or when phis with huge numbers
of inputs exist.

Now, the code is run once per function and scans successors instead of preds,
which is far faster.  In addition, the new code is simpler and is goto free,
woo.

This change speeds up a nasty testcase Duraid provided me from taking hours to
taking ~72s with a debug build.  The functionality this implements is already
tested in the testsuite as Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29644 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-12 04:51:20 +00:00
Chris Lattner
8cfe6335e4 Fix PR867 (and maybe 868) and testcsae:
Transforms/SimplifyCFG/2006-08-03-Crash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29515 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-03 21:40:24 +00:00
Chris Lattner
f9ba401bf5 Add special check to avoid isLoop call. Simple, but doesn't seem to speed
up lcssa much in practice.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29465 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-02 00:16:47 +00:00
Chris Lattner
d41ae8bc0c Replace the SSA update code in LCSSA with a bottom-up approach instead of a top
down approach, inspired by discussions with Tanya.

This approach is significantly faster, because it does not need dominator
frontiers and it does not insert extraneous unused PHI nodes.  For example, on
252.eon, in a release-asserts build, this speeds up LCSSA (which is the slowest
pass in gccas) from 9.14s to 0.74s on my G5.  This code is also slightly smaller
and significantly simpler than the old code.

Amusingly, in a normal Release build (which includes the
"assert(L->isLCSSAForm());" assertion), asserting that the result of LCSSA
is in LCSSA form is actually slower than the LCSSA transformation pass
itself on 252.eon.  I will see if Loop::isLCSSAForm can be sped up next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29463 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-02 00:06:09 +00:00
Chris Lattner
21ba23d0d8 silence warnings in a release build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29189 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-18 21:48:57 +00:00
Chris Lattner
27d672136a eliminate some ugly code, using ConstantExpr::getWithOperands instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29149 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-14 22:21:31 +00:00
Chris Lattner
981418bf15 Handle instructions in the map, but that map to a null pointer.
This unbreaks smg2000.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29127 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-12 21:37:11 +00:00
Chris Lattner
1bb3a40257 In addition to deleting calls, the inliner can constant fold them as well.
Handle this case, which doesn't require a new callgraph edge.  This fixes
a crash compiling MallocBench/gs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29121 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-12 18:37:18 +00:00
Chris Lattner
d85340f4ec Change the callgraph representation to store the callsite along with the
target CG node.  This allows the inliner to properly update the callgraph
when using the pruning inliner.  The pruning inliner may not copy over all
call sites from a callee to a caller, so the edges corresponding to those
call sites should not be copied over either.

This fixes PR827 and Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29120 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-12 18:29:36 +00:00
Owen Anderson
f8dad7a926 Fix typo in the comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29078 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-09 21:35:40 +00:00
Owen Anderson
e4e1ecd37c Add a fix for an issue where LCSSA would fail to insert undef's in some corner
cases.  Ideally, this issue will go away in the future as LCSSA gets smarter
about which Phi nodes it inserts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29076 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-09 08:14:06 +00:00
Chris Lattner
9525528a7d Use hidden visibility to make symbols in an anonymous namespace get
dropped.  This shrinks libllvmgcc.dylib another 67K


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28975 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-28 23:17:24 +00:00
Chris Lattner
f4b546110c Shrink libllvmgcc.dylib by another 23K
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28972 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-28 22:08:15 +00:00
Chris Lattner
13a68e4257 Use the PotDoms map to memoize 'dominating value' lookup. With this patch,
LCSSA is still the slowest pass when gccas'ing 252.eon, but now it only takes
39s instead of 289s. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28776 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-14 01:13:57 +00:00
Owen Anderson
8b92d0cae1 Fix another instance where PHI nodes need special treatment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28774 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-13 20:50:09 +00:00
Owen Anderson
7be3f1e078 Fix a bug that was causing major slowdowns in povray. This was due to LCSSA
not handling PHI nodes correctly when determining if a value was live-out.

This patch reduces the number of detected live-out variables in the testcase
from 6565 to 485.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28771 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-13 19:37:18 +00:00
Chris Lattner
7f2e1dd5d4 Fix an infinite loop on Transforms/SimplifyCFG/2006-06-12-InfLoop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28758 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-12 20:18:01 +00:00
Owen Anderson
3d2aa47bd3 Fix for 2006-06-26-MultipleExitsSingleBlock.
If a single exit block has multiple predecessors within the loop, it will
appear in the exit blocks list more than once.  LCSSA needs to take that into
account so that it doesn't double process that exit block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28750 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-12 07:10:16 +00:00
Owen Anderson
c2cc15cf9d Re-commit the safe parts of my 6/9 patch. Still working on fixing the unsafe parts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28748 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-11 19:22:28 +00:00
Evan Cheng
b9b2b309d3 Back out Owen's 6/9 changes. They broke MultiSource/Benchmarks/Prolangs-C/bison (and perhaps others).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28747 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-11 09:32:57 +00:00
Owen Anderson
f25c19c6b5 Make Loop able to verify that it is in LCSSA-form, and have the LCSSA pass assert
on this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28738 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-09 18:33:30 +00:00
Owen Anderson
a452932171 Update some comments, and expose LCSSAID in preparation for having other passes
require LCSSA.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28734 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-08 20:02:53 +00:00
Owen Anderson
e9d93d5d70 Fix some formatting, and use inLoop() when appropriate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28694 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-06 04:36:36 +00:00
Owen Anderson
92deacf2f7 Stop a memory leak, and update some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28693 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-06 04:28:30 +00:00
Owen Anderson
c14c1d472a Some more clean-up, and squash an IDF-Phi related bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28680 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-04 00:55:19 +00:00
Owen Anderson
9e1c1ddd4b Various clean-ups suggested by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28678 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-04 00:02:23 +00:00
Owen Anderson
30019c88f4 Fix a bug in Phi-noded insertion. Also, update some comments to reflect what's
actually going on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28677 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-03 23:22:50 +00:00
Chris Lattner
191b0ba97e Force anything that #includes llvm/Transforms/Utils/UnifyFunctionExitNodes.h
to link in the implementation.  Thanks to Anton Korobeynikov for figuring out
what was going on here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28660 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-02 18:40:06 +00:00
Chris Lattner
ecf626fedf Remove dead #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28642 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-01 20:02:28 +00:00
Chris Lattner
35033efd08 Make the "pruning cloner" smarter. As it propagates constants through the
code (while cloning) it often gets the branch/switch instructions.  Since it
knows that edges of the CFG are dead, it need not clone (or even look) at
the obviously dead blocks.  This should speed up the inliner substantially on
code where there are lots of inlinable calls to functions with constant
arguments.  On C++ code in particular, this kicks in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28641 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-01 19:19:23 +00:00
Owen Anderson
ff99366919 Remove a FIXME that was fixed with my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28619 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-01 06:07:40 +00:00
Owen Anderson
2824da4738 More cleanups. Also, add a special case for updating PHI nodes, and
reimplement getValueDominatingFunction to walk the DominanceTree rather than
just searching blindly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28618 91177308-0d34-0410-b5e6-96231b3b80d8
2006-06-01 06:05:47 +00:00
Owen Anderson
408a4061d8 Extract a huge loop into a helper method. Fix a few iterator-invalidation bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28599 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-31 20:55:06 +00:00
Owen Anderson
00ea74c27e Add Use replacement. Assuming there is nothing horribly wrong with this, LCSSA
is now theoretically feature-complete.  It has not, however, been thoroughly
test, and is still considered experimental.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28529 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-29 01:00:00 +00:00
Owen Anderson
bd82277cbb Major think-o. Iterate over all live out-of-loop values, and perform the
other calculations on each individually, rather than trying to delay it and do
them all at the end.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28527 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-28 19:33:28 +00:00
Owen Anderson
2f21e07915 Make LCSSA insert proper Phi nodes throughout the rest of the CFG by computing
the iterated Dominance Frontier of the loop-closure Phi's.  This is the
second phase of the LCSSA pass.  The third phase (coming soon) will be to
update all uses of loop variables to use the loop-closure Phi's instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28524 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-27 18:47:11 +00:00
Chris Lattner
8d8d6530b1 Fix some regression from the inliner patch I committed last night. This fixes
ldecod, lencod, and SPASS.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28523 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-27 17:28:13 +00:00
Chris Lattner
5b5bc3032f Switch the inliner over to using CloneAndPruneFunctionInto. This effectively
makes it so that it constant folds instructions on the fly.  This is good
for several reasons:

0. Many instructions are constant foldable after inlining, particularly if
   inlining a call with constant arguments.
1. Without this, the inliner has to allocate memory for all of the instructions
   that can be constant folded, then a subsequent pass has to delete them.  This
   gets the job done without this extra work.
2. This makes the inliner *pass* a bit more aggressive: in particular, it
   partially solves a phase order issue where the inliner would inline lots
   of code that folds away to nothing, but think that the resultant function
   is big because of this code that will be gone.  Now the code never exists.

This is the first part of a 2-step process.  The second part will be smart
enough to see when this implicit constant folding propagates a constant into
a branch or switch instruction, making CFG edges dead.

This implements Transforms/Inline/inline_constprop.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28521 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-27 01:28:04 +00:00
Chris Lattner
83f03bfc3f Implement a new method, CloneAndPruneFunctionInto, as documented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28519 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-27 01:22:24 +00:00
Chris Lattner
4b30fcb5f5 Refactor some code to expose an interface to constant fold and instruction given it's opcode, typeand operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28517 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-27 01:18:04 +00:00
Owen Anderson
a90b2c7240 A few small clean-ups, and the addition of an LCSSA statistic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28512 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-27 00:31:37 +00:00
Owen Anderson
fc3a3bc64b Fix a copy-and-paste-o that would break some compilers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28507 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-26 21:19:17 +00:00
Owen Anderson
2480737211 Clean up and refactor LCSSA a bunch. It should also run faster now, though
there's still a lot of work to be done on it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28506 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-26 21:11:53 +00:00
Owen Anderson
11f510b577 Skeletal LCSSA pass. This is currently non-functional. Expect functionality
and documentation updates soo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28495 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-26 13:58:26 +00:00
Chris Lattner
99f2af2dee Revert a patch that is unsafe, due to out of range array accesses in inner
array scopes possibly accessing valid memory in outer subscripts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28478 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-25 21:25:12 +00:00
Chris Lattner
a04c0c417b Patch for a new instcombine xform, patch contributed by Nick Lewycky!
This implements Transforms/InstCombine/2006-05-10-InvalidIndexUndef.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28450 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-24 17:34:30 +00:00
Reid Spencer
bc2eba1ca2 Fix a doxygen problem and break lines at 80 columns
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28395 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-19 19:09:46 +00:00
Chris Lattner
ed96fe8c79 Declare that lowerinvoke doesn't interact with other lowering passes.
Patch written by Domagoj Babic!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28367 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-17 21:05:27 +00:00
Chris Lattner
782e60150e Add a CloneModule call that exposes the mapping of values from the old module
to the new module.  Patch provided by Nick Lewycky!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28349 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-17 18:05:35 +00:00
Chris Lattner
a0fcc3ee3f remove some dead code identified by coverity
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28289 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-14 18:45:44 +00:00
Chris Lattner
36a169e1a3 remove dead variables
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28286 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-14 18:33:57 +00:00
Chris Lattner
8d89e7bdbc Patch to make some xforms preserve each other. Patch contributed by
Domagoj Babic!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28181 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-09 04:13:41 +00:00
Chris Lattner
b3674e4753 Add pass ID's for various passes, so they can be AddRequiredID. Patch by
Domagoj Babic!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28048 91177308-0d34-0410-b5e6-96231b3b80d8
2006-05-02 04:24:36 +00:00
Chris Lattner
634c76c08c Fix some nondeterminstic behavior in the mem2reg pass that (in addition to
nondeterminism being bad) could cause some trivial missed optimizations (dead
phi nodes being left around for later passes to clean up).

With this, llvm-gcc4 now bootstraps and correctly compares.  I don't know
why I never tried to do it before... :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27984 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-27 01:14:43 +00:00