summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/DeadStoreElimination/ifthen.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/DeadStoreElimination/ifthen.ll')
-rw-r--r--llvm/test/Transforms/DeadStoreElimination/ifthen.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/DeadStoreElimination/ifthen.ll b/llvm/test/Transforms/DeadStoreElimination/ifthen.ll
new file mode 100644
index 00000000000..5fb1d3e7e51
--- /dev/null
+++ b/llvm/test/Transforms/DeadStoreElimination/ifthen.ll
@@ -0,0 +1,22 @@
+; RUN: opt < %s -basicaa -dse -S | FileCheck %s
+
+; The store and add in if.then block should be removed by non-local DSE.
+; CHECK-NOT: %stval = add
+; CHECK-NOT: store i32 %stval
+;
+define void @foo(i32* noalias nocapture %a, i32* noalias nocapture readonly %b, i32 %c) {
+entry:
+ %cmp = icmp sgt i32 %c, 0
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then:
+ %0 = load i32, i32* %b, align 4
+ %stval = add nsw i32 %0, 1
+ store i32 %stval, i32* %a, align 4
+ br label %if.end
+
+if.end:
+ %m.0 = phi i32 [ 13, %if.then ], [ 10, %entry ]
+ store i32 %m.0, i32* %a, align 4
+ ret void
+}
OpenPOWER on IntegriCloud