From 6160e85201aa13dd5bc0ef4d09e3c28ea1e63580 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 28 Feb 2004 04:57:37 +0000 Subject: [PATCH] Turn 'free null' into nothing git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11940 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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; } -- 2.34.1