Don't bind a reference to a dereferenced null pointer (for return value of WeakVH...
[oota-llvm.git] / lib / Transforms / Scalar / LoopStrengthReduce.cpp
index b14a713ce47ac415e61df48113c79c0a586601db..0ae7a5151e7004f99061d5facaa8b6639f6b20c8 100644 (file)
@@ -738,7 +738,8 @@ DeleteTriviallyDeadInstructions(SmallVectorImpl<WeakVH> &DeadInsts) {
   bool Changed = false;
 
   while (!DeadInsts.empty()) {
-    Instruction *I = dyn_cast_or_null<Instruction>(&*DeadInsts.pop_back_val());
+    Value *V = DeadInsts.pop_back_val();
+    Instruction *I = dyn_cast_or_null<Instruction>(V);
 
     if (I == 0 || !isInstructionTriviallyDead(I))
       continue;