Commit Graph

135 Commits

Author SHA1 Message Date
Duncan Sands e5ac78e16e Fix typo pointed out by Trevor Harmon.
llvm-svn: 119001
2010-11-13 12:16:27 +00:00
Owen Anderson 8ac477ffb5 Begin adding static dependence information to passes, which will allow us to
perform initialization without static constructors AND without explicit initialization
by the client.  For the moment, passes are required to initialize both their
(potential) dependencies and any passes they preserve.  I hope to be able to relax
the latter requirement in the future.

llvm-svn: 116334
2010-10-12 19:48:12 +00:00
Owen Anderson df7a4f2515 Now with fewer extraneous semicolons!
llvm-svn: 115996
2010-10-07 22:25:06 +00:00
Chris Lattner da24b9a49a pull a simple method out of LICM into a new
Loop::hasLoopInvariantOperands method. Remove
a useless and confusing Loop::isLoopInvariant(Instruction)
method, which didn't do what you thought it did.

No functionality change.

llvm-svn: 113133
2010-09-06 01:05:37 +00:00
Dan Gohman 7038bd5c1a Eliminate getCanonicalInductionVariableIncrement's last user and
eliminate it.

llvm-svn: 109270
2010-07-23 21:34:51 +00:00
Dan Gohman acafc61023 Simplify this code; it can use the regular CFG utlities rather than
the BlockTraits abstractions.

llvm-svn: 109268
2010-07-23 21:25:16 +00:00
Owen Anderson a57b97e7e7 Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Gabor Greif 2732561be9 cache result of operator*
llvm-svn: 107967
2010-07-09 14:28:41 +00:00
Dan Gohman b29cda9b3c Fix a bunch of namespace polution.
llvm-svn: 101376
2010-04-15 17:08:50 +00:00
Dan Gohman 2734ebd37f Add a DominatorTree argument to isLCSSA so that it doesn't have to
compute a set of reachable blocks for itself each time it is called, which
is fairly frequently.

llvm-svn: 98179
2010-03-10 19:38:49 +00:00
Dan Gohman 93452cebda Make isLCSSA ignore uses in blocks not reachable from the entry block,
as LCSSA no longer transforms such uses.

llvm-svn: 98033
2010-03-09 01:53:33 +00:00
Dan Gohman c3f2137c06 Restore dump() methods to Loop and MachineLoop.
llvm-svn: 92772
2010-01-05 21:08:02 +00:00
Dan Gohman 18fa5686f6 Add Loop contains utility methods for testing whether a loop
contains another loop, or an instruction. The loop form is
substantially more efficient on large loops than the typical
code it replaces.

llvm-svn: 91654
2009-12-18 01:24:09 +00:00
Dan Gohman 84ba039cf2 Make getUniqueExitBlocks's precondition assert more precise, to
avoid spurious failures. This fixes PR5758.

llvm-svn: 91147
2009-12-11 20:05:23 +00:00
Dan Gohman 62167b9516 Teach getSmallConstantTripMultiple about Shl operators.
llvm-svn: 89426
2009-11-20 01:09:34 +00:00
Dan Gohman 5196e415ad Minor tidiness fixes.
llvm-svn: 86565
2009-11-09 18:19:43 +00:00
Dan Gohman e3a1706e33 Factor out the predicate code for loopsimplify form exit blocks into
a separate helper function.

llvm-svn: 86159
2009-11-05 19:21:41 +00:00
Dan Gohman 83f5c835ff Fix another place that calls Loop::contains a lot to construct a sorted
container of the blocks and do efficient lookups. This makes
isLoopSimplifyForm much faster on large loops, fixing a significant
compile-time issue in builds with assertions enabled.

llvm-svn: 84673
2009-10-20 20:41:13 +00:00
Dan Gohman 4dbb301f17 Move the dominator verification code out of special code embedded within
the PassManager code into a regular verifyAnalysis method.

Also, reorganize loop verification. Make the LoopPass infrastructure
call verifyLoop as needed instead of having LoopInfo::verifyAnalysis
check every loop in the function after each looop pass. Add a new
command-line argument, -verify-loop-info, to enable the expensive
full checking.

llvm-svn: 82952
2009-09-28 00:27:48 +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 ed8f32022e Smallvectorize switchExitBlocks.
llvm-svn: 80942
2009-09-03 20:36:13 +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 3a0ce3e639 Move getUniqueExitBlocks from LoopBase to Loop, since they depend on
LoopSimplify form, which is currently only available on Loops (and
not MachineLoops). Also, move the code out of the header file.

llvm-svn: 80923
2009-09-03 16:10:48 +00:00
Chris Lattner 91922253c5 remove uses of llvm/Support/Streams.h.
llvm-svn: 79838
2009-08-23 07:33:14 +00:00
Chris Lattner 1362602eb2 Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects.

llvm-svn: 79830
2009-08-23 06:03:38 +00:00
Chris Lattner b1d782bec9 eliminate the std::ostream form of WriteAsOperand and update clients.
This also updates dominator related stuff.

llvm-svn: 79825
2009-08-23 05:17:37 +00:00
Eli Friedman b8f6a4fc8e Replace isTrapping with a new, similar method called
isSafeToSpeculativelyExecute. The new method is a bit closer to what 
the callers actually care about in that it rejects more things callers 
don't want.  It also adds more precise handling for integer 
division, and unifies code for analyzing the legality of a speculative 
load.

llvm-svn: 76150
2009-07-17 04:28:42 +00:00
Dan Gohman 1511f701e7 Add an isLoopSimplifyForm() predicate, following the example of
isLCSSAForm(), to test whether a loop is in the form guaranteed
by the LoopSimplify pass.

llvm-svn: 76077
2009-07-16 16:16:23 +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 6f6d864815 Introduce a new LoopInfo utility function makeLoopInvariant, which
works similar to isLoopInvariant, except that it will do trivial
hoisting to try to make the value loop invariant if it isn't already.
This makes it easier for transformation passes to clear trivial
instructions out of the way (the regular LICM pass doesn't run
until relatively late). This is code factored out of LoopSimplify
and other places.

llvm-svn: 75578
2009-07-14 01:06:29 +00:00
Dan Gohman 80a9942593 Move isLCSSAForm, isLoopInvariant, getCanonicalInductionVariable,
and related functions out of LoopBase and into Loop, since they
are specific to BasicBlock-based loops. This also allows the code
to be moved out-of-line.

llvm-svn: 75523
2009-07-13 22:02:44 +00:00
Dan Gohman 4f16a2923c Eliminate a layer of indirection in LoopInfo and MachineLoopInfo.
llvm-svn: 74394
2009-06-27 21:22:48 +00:00
Dan Gohman d9ef48a73e Remove some unnecessary #includes.
llvm-svn: 72948
2009-06-05 16:32:58 +00:00
Dan Gohman 410b4fdceb Change the description string of the LoopInfo pass.
"Construction" makes it sound like a pass that might
modify the CFG to construct natural loops.

llvm-svn: 70580
2009-05-01 21:58:05 +00:00
Evan Cheng 8e0f6f272f Remove dead comments.
llvm-svn: 61201
2008-12-18 09:01:18 +00:00
Dan Gohman a8b7e78f54 Remove uses of llvm/System/IncludeFile.h that are no longer needed.
llvm-svn: 50695
2008-05-06 01:32:53 +00:00
Devang Patel 4d638f1a42 These passes preserve CFG.
This patch fixes Benchmarks/Trimaran/enc-pc1/enc-pc1 failure reported by Grawp-PIC i386 nightly tester

llvm-svn: 48623
2008-03-20 23:27:18 +00:00
Devang Patel 80e43fa744 Restore isCFGOnly property of various analysis passes.
llvm-svn: 48579
2008-03-20 02:25:21 +00:00
Devang Patel 718da668ab PassInfo keep tracks whether a pass is an analysis pass or not.
llvm-svn: 48554
2008-03-19 21:56:59 +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
Owen Anderson 1b74a9a628 More templatization.
llvm-svn: 44158
2007-11-15 05:00:15 +00:00
Owen Anderson 9306de0727 Start the process of making MachineLoopInfo possible by templating Loop.
llvm-svn: 44097
2007-11-14 02:33:58 +00:00
Devang Patel f5e520d892 Use SmallVector.
llvm-svn: 41230
2007-08-21 16:54:51 +00:00
Devang Patel a9e7c4f827 No need to hardcode SmallVector size.
llvm-svn: 41228
2007-08-21 16:39:43 +00:00
Devang Patel b5933bbbd5 Use SmallVector instead of std::vector.
llvm-svn: 41207
2007-08-21 00:31:24 +00:00
Devang Patel a273d1cd3a Verify loop info.
llvm-svn: 40062
2007-07-19 18:02:32 +00:00
Devang Patel aee309e353 Use DominatorTree instead of ETForest.
llvm-svn: 37507
2007-06-08 00:17:13 +00:00
Devang Patel 8c78a0bff0 Drop 'const'
llvm-svn: 36662
2007-05-03 01:11:54 +00:00