5ebbff887f7e77c65d006cbeca4802b72b7d9eb4
[oota-llvm.git] / test / Transforms / DeadStoreElimination / ifthenelse.ll
1 ; RUN: opt < %s -basicaa -dse -S | FileCheck %s
2
3 ; The add and store in entry block should be removed by non-local DSE.
4 ; CHECK-NOT: %stval = add
5 ; CHECK-NOT: store i32 %stval
6 ;
7 define void @foo(i32* noalias nocapture %a, i32* noalias nocapture readonly %b, i32 %c) {
8 entry:
9   %0 = load i32, i32* %b, align 4
10   %stval = add nsw i32 %0, 1
11   store i32 %stval, i32* %a, align 4
12   %cmp = icmp sgt i32 %c, 0
13   br i1 %cmp, label %if.then, label %if.else
14
15 if.then:
16   %1 = add nsw i32 %c, 10
17   br label %if.end
18
19 if.else:
20   %2 = add nsw i32 %c, 13
21   br label %if.end
22
23 if.end:
24   %3 = phi i32 [ %1, %if.then ], [ %2, %if.else ]
25   store i32 %3, i32* %a, align 4
26   ret void
27 }