summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-12-09 22:55:01 +0000
committerDan Gohman <gohman@apple.com>2009-12-09 22:55:01 +0000
commit72c367fb529bf6165b0972a3923f85a24fe14b6c (patch)
tree5b9b167a0e85c0e70ced67ade3b725479150535e /llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
parent2262909b2012efb34b9c4ebe3b37cb35d4ac799c (diff)
downloadbcm5719-llvm-72c367fb529bf6165b0972a3923f85a24fe14b6c.tar.gz
bcm5719-llvm-72c367fb529bf6165b0972a3923f85a24fe14b6c.zip
Dereference loopHeader after checking for null rather than before.
llvm-svn: 90990
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index 38d267aa6b8..b7adfdc68e4 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -404,12 +404,13 @@ bool LoopUnswitch::IsTrivialUnswitchCondition(Value *Cond, Constant **Val,
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;
+ Function *F = loopHeader->getParent();
+
// If the condition is trivial, always unswitch. There is no code growth for
// this case.
if (!IsTrivialUnswitchCondition(LoopCond)) {
OpenPOWER on IntegriCloud