aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-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;
}