Don't bind a reference to a dereferenced null pointer (for return value of WeakVH::operator*).

llvm-svn: 162309
This commit is contained in:
Richard Smith 2012-08-21 20:35:14 +00:00
parent 393fbf6c53
commit ad9c8e839e
1 changed files with 2 additions and 1 deletions

View 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;