Make sure the caller doesn't use freed memory.

Fixes PR1935.

llvm-svn: 46203
This commit is contained in:
Duncan Sands 2008-01-20 16:51:46 +00:00
parent da19b1c875
commit afa84da4e0
1 changed files with 3 additions and 1 deletions

View File

@ -401,8 +401,10 @@ static bool OptimizeNoopCopyExpression(CastInst *CI, const TargetLowering &TLI){
}
// If we removed all uses, nuke the cast.
if (CI->use_empty())
if (CI->use_empty()) {
CI->eraseFromParent();
MadeChange = true;
}
return MadeChange;
}