aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/DeadStoreElimination
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-07-28 16:14:26 +0000
committerOwen Anderson <resistor@mac.com>2008-07-28 16:14:26 +0000
commit8aa895b19a64796a4c1f7cd0cb0750ad34263ea0 (patch)
tree73966641c6815ec06eb4828f602e77ccc8d8ed3a /test/Transforms/DeadStoreElimination
parentd4310a5d41cc13f109890f5efbb19e084fecb27a (diff)
downloadexternal_llvm-8aa895b19a64796a4c1f7cd0cb0750ad34263ea0.zip
external_llvm-8aa895b19a64796a4c1f7cd0cb0750ad34263ea0.tar.gz
external_llvm-8aa895b19a64796a4c1f7cd0cb0750ad34263ea0.tar.bz2
Add support for eliminating stores that store the same value that was just loaded.
This fixes PR2599. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54133 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/DeadStoreElimination')
-rw-r--r--test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll b/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll
new file mode 100644
index 0000000..0ba8479
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/2008-07-28-load-store.ll
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep tmp5
+; PR2599
+
+define void @foo({ i32, i32 }* %x) nounwind {
+entry:
+ %tmp4 = getelementptr { i32, i32 }* %x, i32 0, i32 0 ; <i32*> [#uses=2]
+ %tmp5 = load i32* %tmp4, align 4 ; <i32> [#uses=1]
+ %tmp7 = getelementptr { i32, i32 }* %x, i32 0, i32 1 ; <i32*> [#uses=2]
+ %tmp8 = load i32* %tmp7, align 4 ; <i32> [#uses=1]
+ %tmp17 = sub i32 0, %tmp8 ; <i32> [#uses=1]
+ store i32 %tmp5, i32* %tmp4, align 4
+ store i32 %tmp17, i32* %tmp7, align 4
+ ret void
+}