summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LICM.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-11-05 21:11:53 +0000
committerDan Gohman <gohman@apple.com>2009-11-05 21:11:53 +0000
commita83ac2d9e7b990df6978598d9dec860b5ef13a9a (patch)
treea0ac873f025057cdce7b82ad870f52de16f6e107 /llvm/lib/Transforms/Scalar/LICM.cpp
parent87869bc435c1fb81ae0a3fd5c76becaaa0f90284 (diff)
downloadbcm5719-llvm-a83ac2d9e7b990df6978598d9dec860b5ef13a9a.tar.gz
bcm5719-llvm-a83ac2d9e7b990df6978598d9dec860b5ef13a9a.zip
Update various Loop optimization passes to cope with the possibility that
LoopSimplify form may not be available. llvm-svn: 86175
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LICM.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 756fbf3e7bd..104c8739c0e 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -263,7 +263,6 @@ bool LICM::runOnLoop(Loop *L, LPPassManager &LPM) {
// Get the preheader block to move instructions into...
Preheader = L->getLoopPreheader();
- assert(Preheader&&"Preheader insertion pass guarantees we have a preheader!");
// Loop over the body of this loop, looking for calls, invokes, and stores.
// Because subloops have already been incorporated into AST, we skip blocks in
@@ -286,12 +285,14 @@ bool LICM::runOnLoop(Loop *L, LPPassManager &LPM) {
// us to sink instructions in one pass, without iteration. After sinking
// instructions, we perform another pass to hoist them out of the loop.
//
- SinkRegion(DT->getNode(L->getHeader()));
- HoistRegion(DT->getNode(L->getHeader()));
+ if (L->hasDedicatedExits())
+ SinkRegion(DT->getNode(L->getHeader()));
+ if (Preheader)
+ HoistRegion(DT->getNode(L->getHeader()));
// Now that all loop invariants have been removed from the loop, promote any
// memory references to scalars that we can...
- if (!DisablePromotion)
+ if (!DisablePromotion && Preheader && L->hasDedicatedExits())
PromoteValuesInLoop();
// Clear out loops state information for the next iteration
OpenPOWER on IntegriCloud