diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-05-24 23:47:50 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-05-24 23:47:50 +0000 |
commit | 73e6c09d5e09191d8a7d25608e15c33a6ee3028b (patch) | |
tree | 449c235a4a96d42afa3e318aea8c9ee7139263a6 /llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | |
parent | 1b724948e95648c2d8d68bffccb8e4d1a748086d (diff) | |
download | bcm5719-llvm-73e6c09d5e09191d8a7d25608e15c33a6ee3028b.tar.gz bcm5719-llvm-73e6c09d5e09191d8a7d25608e15c33a6ee3028b.zip |
Forgot dyn_cast check.
llvm-svn: 132025
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp index 9761d682978..a33e7956433 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/llvm/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); |