From: Evan Cheng Date: Tue, 24 May 2011 23:47:50 +0000 (+0000) Subject: Forgot dyn_cast check. X-Git-Tag: android-x86-6.0-r1~964^2~547 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=21d378d73563034b7ca3d8995699b886b2c68719;p=android-x86%2Fexternal-llvm.git Forgot dyn_cast check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132025 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 9761d682978..a33e7956433 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(*UI); - if (!L->contains(U)) + Instruction *U = dyn_cast(*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(*UI); - if (!L->contains(U)) + Instruction *U = dyn_cast(*UI); + if (!U || !L->contains(U)) continue; Worklist.push_back(U);