Turn 'free null' into nothing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11940 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-02-28 04:57:37 +00:00
parent 9e4a642c03
commit 6160e85201

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