diff options
author | Dan Gohman <gohman@apple.com> | 2009-12-09 22:55:01 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-12-09 22:55:01 +0000 |
commit | f68d0c1bbe96ccbe7f695471536862dcd047fe59 (patch) | |
tree | a8efc9d65fcc1972a83dedc381d7b007ed6529df /lib/Transforms/Scalar/LoopUnswitch.cpp | |
parent | ce72f3fbdf369240b7790ee77c4f7cb2e6a9a024 (diff) |
Dereference loopHeader after checking for null rather than before.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90990 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopUnswitch.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 38d267aa6b..b7adfdc68e 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/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)) { |