[llvm-commits] [llvm] r132025 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Evan Cheng
evan.cheng at apple.com
Tue May 24 16:47:50 PDT 2011
Author: evancheng
Date: Tue May 24 18:47:50 2011
New Revision: 132025
URL: http://llvm.org/viewvc/llvm-project?rev=132025&view=rev
Log:
Forgot dyn_cast check.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=132025&r1=132024&r2=132025&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Tue May 24 18:47:50 2011
@@ -881,8 +881,8 @@
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 @@
// 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);
More information about the llvm-commits
mailing list