Don't bind a reference to a dereferenced null pointer (for return value of WeakVH...
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 21 Aug 2012 20:35:14 +0000 (20:35 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 21 Aug 2012 20:35:14 +0000 (20:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162309 91177308-0d34-0410-b5e6-96231b3b80d8

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;