Teach instCombine to remove malloc+free if malloc's only uses are comparisons
[oota-llvm.git] / lib / Transforms / InstCombine / InstCombineCalls.cpp
index 38e7b6ec2d1f98bb9e6f914c5a236d7bbe4dcf5f..08a6ff41ebb23b1c9b82c06de95046ac3da26f4e 100644 (file)
@@ -250,6 +250,8 @@ Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) {
 Instruction *InstCombiner::visitCallInst(CallInst &CI) {
   if (isFreeCall(&CI))
     return visitFree(CI);
+  if (isMalloc(&CI))
+    return visitMalloc(CI);
 
   // If the caller function is nounwind, mark the call as nounwind, even if the
   // callee isn't.