summaryrefslogtreecommitdiff
path: root/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
commit03e896bd6073efc4523d8bcd0239d6ed62126db7 (patch)
tree940b395910c450d7c9e00a014e1592e4982bdca8 /lib/Transforms/Scalar/LoopUnswitch.cpp
parent7040d6e2f5d503e9948b9caff940a66238a0c605 (diff)
downloadllvm-03e896bd6073efc4523d8bcd0239d6ed62126db7.tar.gz
llvm-03e896bd6073efc4523d8bcd0239d6ed62126db7.tar.bz2
llvm-03e896bd6073efc4523d8bcd0239d6ed62126db7.tar.xz
Update various Loop optimization passes to cope with the possibility that
LoopSimplify form may not be available. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86175 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index c7b00da159..be8366d98c 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/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)) {