Dan Gohman
ea0bb8f555
Fix this code so that it doesn't try to iterate through a std::vector
...
while calling changeImmediateDominator, which removes elements from the
vector. This fixes PR5097.
llvm-svn: 83166
2009-09-30 20:54:16 +00:00
Dan Gohman
9a7320c711
Convert LoopSimplify and LoopExtractor from FunctionPass to LoopPass.
...
llvm-svn: 82990
2009-09-28 14:37:51 +00:00
Dan Gohman
3ddbc242fb
Re-apply r80926, with fixes: keep the domtree informed of new blocks
...
that get created during loop unswitching, and fix SplitBlockPredecessors'
LCSSA updating code to create new PHIs instead of trying to just move
existing ones.
Also, optimize Loop::verifyLoop, since it gets called a lot. Use
searches on a sorted list of blocks instead of calling the "contains"
function, as is done in other places in the Loop class, since "contains"
does a linear search. Also, don't call verifyLoop from LoopSimplify or
LCSSA, as the PassManager is already calling verifyLoop as part of
LoopInfo's verifyAnalysis.
llvm-svn: 81221
2009-09-08 15:45:00 +00:00
Evan Cheng
904199547b
Revert r80926. It causes loop unswitch assertion and slow down some JIT tests significantly.
...
llvm-svn: 81101
2009-09-06 02:26:10 +00:00
Dan Gohman
4c1bdcf5d7
Add a verifyAnalysis to LoopInfo, LoopSimplify, and LCSSA form that verify
...
that these passes are properly preserved.
Fix several transformation passes that claimed to preserve LoopSimplify
form but weren't.
llvm-svn: 80926
2009-09-03 16:31:42 +00:00
Dan Gohman
22571485b3
Change PHINode::hasConstantValue to have a DominatorTree argument
...
instead of a bool argument, and to do the dominator check itself.
This makes it eaiser to use when DominatorTree information is
available.
llvm-svn: 80920
2009-09-03 15:34:35 +00:00
Owen Anderson
55f1c09e31
Push LLVMContexts through the IntegerType APIs.
...
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Owen Anderson
b292b8ce70
Move more code back to 2.5 APIs.
...
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Owen Anderson
47db941fd3
Get rid of the Pass+Context magic.
...
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Dan Gohman
c43e47938a
Make makeLoopInvariant report whether it made any changes or not,
...
and use this to simplify more code.
llvm-svn: 75722
2009-07-15 01:25:43 +00:00
Dan Gohman
4d6149f356
Update LoopSimplify and LoopUnswitch to use the new makeLoopInvariant
...
function.
llvm-svn: 75584
2009-07-14 01:37:59 +00:00
Owen Anderson
e70b637033
More LLVMContext-ification.
...
llvm-svn: 74807
2009-07-05 22:41:43 +00:00
Dan Gohman
4dfc680059
Minor code simplification.
...
llvm-svn: 74491
2009-06-30 01:24:43 +00:00
Dan Gohman
ffdcba3dbd
Remove the block from the LoopInfo, rather than just the Loop.
...
LoopInfo will handle removing it from the Loop, as well as updating
its own tables.
llvm-svn: 74398
2009-06-27 22:32:36 +00:00
Dan Gohman
c8ca49659a
Teach LoopSimplify how to merge multiple loop exits into a single exit,
...
when one of them can be converted to a trivial icmp and conditional
branch.
This addresses what is essentially a phase ordering problem.
SimplifyCFG knows how to do this transformation, but it doesn't do so
if the primary block has any instructions in it other than an icmp and
a branch. In the given testcase, the block contains other instructions,
however they are loop-invariant and can be hoisted. SimplifyCFG doesn't
have LoopInfo though, so it can't hoist them. And, it's important that
the blocks be merged before LoopRotation, as it doesn't support
multiple-exit loops.
llvm-svn: 74396
2009-06-27 21:30:38 +00:00
Duncan Sands
5a913d61e3
Rename getAnalysisToUpdate to getAnalysisIfAvailable.
...
llvm-svn: 63198
2009-01-28 13:14:17 +00:00
Dan Gohman
a79db30d28
Tidy up several unbeseeming casts from pointer to intptr_t.
...
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Dan Gohman
90071075e2
Use Loop::block_iterator.
...
llvm-svn: 52616
2008-06-22 20:18:58 +00:00
Devang Patel
8549e4ca07
LoopSimplify preserves AA.
...
llvm-svn: 52053
2008-06-06 17:50:58 +00:00
Dan Gohman
0479aa5c0b
Change class' public PassInfo variables to by initialized with the
...
address of the PassInfo directly instead of calling getPassInfo.
This eliminates a bunch of dynamic initializations of static data.
Also, fold RegisterPassBase into PassInfo, make a bunch of its
data members const, and rearrange some code to initialize data
members in constructors instead of using setter member functions.
llvm-svn: 51022
2008-05-13 02:05:11 +00:00
Dan Gohman
d78c400b5b
Clean up the use of static and anonymous namespaces. This turned up
...
several things that were neither in an anonymous namespace nor static
but not intended to be global.
llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Nick Lewycky
4d43d3c72c
Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
...
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.
llvm-svn: 50265
2008-04-25 16:53:59 +00:00
Chris Lattner
a5b11705b6
Move SplitBlockPredecessors out of loopsimplify into BasicBlockUtils.h
...
as a global helper function. At the same type, switch it from taking
a vector of predecessors to an arbitrary sequential input. This allows
us to switch LoopSimplify to use a SmallVector for various temporary
vectors that it passed into SplitBlockPredecessors.
llvm-svn: 50020
2008-04-21 01:28:02 +00:00
Chris Lattner
d418b06abf
Move domtree/frontier updating earlier, allowing us to use it to update phi
...
nodes, removing a hack.
llvm-svn: 50019
2008-04-21 01:05:08 +00:00
Chris Lattner
96e9e22269
Factor dominator tree and frontier updating into SplitBlockPredecessors
...
instead of doing it after every call.
llvm-svn: 50018
2008-04-21 00:54:38 +00:00
Chris Lattner
aca912d793
simplify code, fit in 80 cols.
...
llvm-svn: 50015
2008-04-21 00:23:14 +00:00
Gabor Greif
e9ecc68d8f
API changes for class Use size reduction, wave 1.
...
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.
llvm-svn: 49277
2008-04-06 20:25:17 +00:00
Nick Lewycky
11fc6f8765
Update the block cloner which fixes bugpoint on code using unwind_to (phew!)
...
and also update the cloning interface's major user, the loop optimizations.
llvm-svn: 48088
2008-03-09 05:24:34 +00:00
Chris Lattner
f3ebc3f3d2
Remove attribution from file headers, per discussion on llvmdev.
...
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Owen Anderson
b0dd27ee91
Make LoopInfoBase more generic, in preparation for having MachineLoopInfo. This involves a small interface change.
...
llvm-svn: 44348
2007-11-27 03:43:35 +00:00
Chris Lattner
4a15e04aee
Fix PR1752 and LoopSimplify/2007-10-28-InvokeCrash.ll: terminators
...
can have uses too. Wouldn't it be nice if invoke didn't exist? :)
llvm-svn: 43426
2007-10-29 02:30:37 +00:00
Owen Anderson
ca831a829d
Move Split<...>() into DomTreeBase. This should make the #include's of DominatorInternals.h
...
in CodeExtractor and LoopSimplify unnecessary.
Hartmut, could you confirm that this fixes the issues you were seeing?
llvm-svn: 43115
2007-10-18 05:13:52 +00:00
Hartmut Kaiser
2f842e613f
Fixed linker errors (unresolved externals: split<>(...)) when compiling with VC++. Please review.
...
llvm-svn: 43081
2007-10-17 18:37:09 +00:00
Devang Patel
b5933bbbd5
Use SmallVector instead of std::vector.
...
llvm-svn: 41207
2007-08-21 00:31:24 +00:00
Chris Lattner
c7ba225705
remove some dead lines
...
llvm-svn: 40859
2007-08-06 06:21:06 +00:00
Devang Patel
a273d1cd3a
Verify loop info.
...
llvm-svn: 40062
2007-07-19 18:02:32 +00:00
David Greene
1e2a12019f
Fix reference to iterator invalidated by an erase operation. Uncovered
...
by _GLIBCXX_DEBUG.
llvm-svn: 37796
2007-06-29 02:53:16 +00:00
Devang Patel
d5258a23a5
Move code to update dominator information after basic block is split
...
from LoopSimplify.cpp to Dominator.cpp
llvm-svn: 37689
2007-06-21 17:23:45 +00:00
Devang Patel
78b9c68164
Add and use DominatorTreeBase::findNearestCommonDominator().
...
llvm-svn: 37545
2007-06-11 23:31:22 +00:00
Devang Patel
536ac4dca7
Simplify.
...
llvm-svn: 37542
2007-06-11 21:45:31 +00:00
Devang Patel
d18054afcf
simplify
...
llvm-svn: 37541
2007-06-11 21:25:31 +00:00
Devang Patel
ab2eee89a4
Simplify. Dominator Tree is required so always available.
...
llvm-svn: 37540
2007-06-11 21:18:00 +00:00
Devang Patel
becc466451
Update LoopSimplify to require and preserve DominatorTree only.
...
Now LoopSimplify does not require nor preserve ETForest.
llvm-svn: 37512
2007-06-08 01:50:32 +00:00
Devang Patel
ebc5b96735
s/DominatorTree::createNewNode/DominatorTree::addNewBlock/g
...
llvm-svn: 37415
2007-06-04 16:43:25 +00:00
Devang Patel
bdd1aaef10
s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g
...
llvm-svn: 37407
2007-06-04 00:32:22 +00:00
Devang Patel
0e8aa7b69a
s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g
...
llvm-svn: 37403
2007-06-03 06:26:14 +00:00
Nick Lewycky
e7da2d6ac3
Fix typo in comment.
...
llvm-svn: 36873
2007-05-06 13:37:16 +00:00
Devang Patel
8c78a0bff0
Drop 'const'
...
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel
e95c6ad802
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.
llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Devang Patel
09f162ca6a
Do not use typeinfo to identify pass in pass manager.
...
llvm-svn: 36632
2007-05-01 21:15:47 +00:00