summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopUnswitch.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/LoopUnswitch.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/LoopUnswitch.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index c7b00da159c..be8366d98c4 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -407,6 +407,10 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
initLoopData();
Function *F = loopHeader->getParent();
+ // If LoopSimplify was unable to form a preheader, don't do any unswitching.
+ if (!loopPreheader)
+ return false;
+
// If the condition is trivial, always unswitch. There is no code growth for
// this case.
if (!IsTrivialUnswitchCondition(LoopCond)) {
OpenPOWER on IntegriCloud