teach instcombine to remove allocated buffers even if there are stores, memcpy/memmov...
authorNuno Lopes <nunoplopes@sapo.pt>
Fri, 6 Jul 2012 23:09:25 +0000 (23:09 +0000)
committerNuno Lopes <nunoplopes@sapo.pt>
Fri, 6 Jul 2012 23:09:25 +0000 (23:09 +0000)
commit9969458b1673648394fce3f50f3f4a84071c7ca7
tree253c1ee0feb6cc68ff421a433088fba1eb227f3d
parenteb54603ddd4fb9fc255372c7904dc0dd6a162968
teach instcombine to remove allocated buffers even if there are stores, memcpy/memmove/memset, and objectsize users.
This means we can do cheap DSE for heap memory.
Nothing is done if the pointer excapes or has a load.

The churn in the tests is mostly due to objectsize, since we want to make sure we
don't delete the malloc call before evaluating the objectsize (otherwise it becomes -1/0)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159876 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstructionCombining.cpp
test/Transforms/InstCombine/badmalloc.ll
test/Transforms/InstCombine/invoke.ll
test/Transforms/InstCombine/malloc-free-delete.ll
test/Transforms/InstCombine/objsize-64.ll
test/Transforms/InstCombine/objsize.ll