From: Chris Lattner Date: Sat, 28 Feb 2004 04:57:37 +0000 (+0000) Subject: Turn 'free null' into nothing X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6160e85201aa13dd5bc0ef4d09e3c28ea1e63580;p=oota-llvm.git Turn 'free null' into nothing git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11940 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 0bf785360e8..3054e13dfa6 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -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(Op)) { + FI.getParent()->getInstList().erase(&FI); + removeFromWorkList(&FI); + return 0; // Don't do anything with FI + } + return 0; }