diff options
author | Duncan Sands <baldrick@free.fr> | 2010-05-27 19:09:06 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2010-05-27 19:09:06 +0000 |
commit | f162eace49c2e155d32e20f6d224df3d3efe555a (patch) | |
tree | 2e66a8a4e18c7f99e4c826943ddf7544079239f6 /llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | |
parent | b68dfb45f5c9712e44329871bfc989b67ff687de (diff) | |
download | bcm5719-llvm-f162eace49c2e155d32e20f6d224df3d3efe555a.tar.gz bcm5719-llvm-f162eace49c2e155d32e20f6d224df3d3efe555a.zip |
Teach instCombine to remove malloc+free if malloc's only uses are comparisons
to null. Patch by Matti Niemenmaa.
llvm-svn: 104871
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 38e7b6ec2d1..08a6ff41ebb 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -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. |