aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopUnswitch.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-05-24 23:47:50 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-05-24 23:47:50 +0000
commit21d378d73563034b7ca3d8995699b886b2c68719 (patch)
tree4e4e74998baac4c0b873191930643adf93f3b68b /lib/Transforms/Scalar/LoopUnswitch.cpp
parent4db7dec70b06a1d50a265c3666e126065e09f396 (diff)
Forgot dyn_cast check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132025 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index 9761d68297..a33e795643 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -881,8 +881,8 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
for (Value::use_iterator UI = LIC->use_begin(), E = LIC->use_end();
UI != E; ++UI) {
- Instruction *U = cast<Instruction>(*UI);
- if (!L->contains(U))
+ Instruction *U = dyn_cast<Instruction>(*UI);
+ if (!U || !L->contains(U))
continue;
U->replaceUsesOfWith(LIC, Replacement);
Worklist.push_back(U);
@@ -896,8 +896,8 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
// can. This case occurs when we unswitch switch statements.
for (Value::use_iterator UI = LIC->use_begin(), E = LIC->use_end();
UI != E; ++UI) {
- Instruction *U = cast<Instruction>(*UI);
- if (!L->contains(U))
+ Instruction *U = dyn_cast<Instruction>(*UI);
+ if (!U || !L->contains(U))
continue;
Worklist.push_back(U);