Turn 'free null' into nothing

llvm-svn: 11940
This commit is contained in:
Chris Lattner 2004-02-28 04:57:37 +00:00
parent 8a2c28fdda
commit f3a366062c
1 changed files with 8 additions and 0 deletions

View File

@ -2287,6 +2287,14 @@ Instruction *InstCombiner::visitFreeInst(FreeInst &FI) {
return &FI;
}
// If we have 'free null' delete the instruction. This can happen in stl code
// when lots of inlining happens.
if (isa<ConstantPointerNull>(Op)) {
FI.getParent()->getInstList().erase(&FI);
removeFromWorkList(&FI);
return 0; // Don't do anything with FI
}
return 0;
}