[DeadStoreElimination] Add support for non-local DSE.
[oota-llvm.git] / test / Transforms / DeadStoreElimination / cycle.ll
1 ; RUN: opt < %s -basicaa -dse -S | FileCheck %s
2
3 @Table = global [535 x i32] zeroinitializer, align 4
4
5 ; The store in for.inc block should NOT be removed by non-local DSE.
6 ; CHECK: store i32 64, i32* %arrayidx
7 ;
8 define void @foo() {
9 entry:
10   br label %for.body
11
12 for.body:
13   %i = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
14   %arrayidx = getelementptr inbounds [535 x i32], [535 x i32]* @Table, i32 0, i32 %i
15   store i32 %i, i32* %arrayidx, align 4
16   %cmp1 = icmp slt i32 %i, 64
17   br i1 %cmp1, label %for.inc, label %for.end
18
19 for.inc:
20   store i32 64, i32* %arrayidx, align 4
21   %inc = add nsw i32 %i, 1
22   br label %for.body
23
24 for.end:
25   ret void
26 }