aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-28 04:57:37 +0000
committerChris Lattner <sabre@nondot.org>2004-02-28 04:57:37 +0000
commit6160e85201aa13dd5bc0ef4d09e3c28ea1e63580 (patch)
tree7dccde4d52c22542ae518faa4f01c50359ad5037 /lib/Transforms
parent9e4a642c0395b17b771940636c5967348bd1c133 (diff)
Turn 'free null' into nothing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11940 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 0bf785360e..3054e13dfa 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<ConstantPointerNull>(Op)) {
+ FI.getParent()->getInstList().erase(&FI);
+ removeFromWorkList(&FI);
+ return 0; // Don't do anything with FI
+ }
+
return 0;
}