Add support for cross block dse.
authorKarthik Bhat <kv.bhat@samsung.com>
Fri, 14 Aug 2015 04:17:23 +0000 (04:17 +0000)
committerKarthik Bhat <kv.bhat@samsung.com>
Fri, 14 Aug 2015 04:17:23 +0000 (04:17 +0000)
commit20c78979303fa130b35a95387d0f23dcbfcc6006
tree84cc6efc6fd8859fdde87d3798c0a4e596cd76f0
parent41bdb7ca96347b56769dc996aabd23d771a22c39
Add support for cross block dse.
This patch enables dead stroe elimination across basicblocks.

Example:
define void @test_02(i32 %N) {
  %1 = alloca i32
  store i32 %N, i32* %1
  store i32 10, i32* @x
  %2 = load i32, i32* %1
  %3 = icmp ne i32 %2, 0
  br i1 %3, label %4, label %5

; <label>:4
  store i32 5, i32* @x
  br label %7

; <label>:5
  %6 = load i32, i32* @x
  store i32 %6, i32* @y
  br label %7

; <label>:7
  store i32 15, i32* @x
  ret void
}
In the above example dead store "store i32 5, i32* @x" is now eliminated.

Differential Revision: http://reviews.llvm.org/D11143

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245025 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/DeadStoreElimination.cpp
test/Transforms/DeadStoreElimination/cross_block_dse.ll [new file with mode: 0644]
test/Transforms/DeadStoreElimination/cross_block_dse_loop.ll [new file with mode: 0644]