1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2;
3;    void f(int *A, int c, int d) {
4;      for (int i = 0; i < 1024; i++)
5;        if (c < i)
6;          A[i]++;
7;    }
8;
9; Verify that we do not generate a value write access for the use of %cmp1 in
10; the branch condition. As _affine_ branches are fully modeled and regenerated
11; from the polyhedral information we do not need this value to be available
12; during code generation.
13;
14; CHECK-NOT:  Stmt_for_cond[i0] -> MemRef_cmp1[] }
15;
16target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
17
18define void @f(i32* %A, i64 %c) {
19entry:
20  br label %for.cond
21
22for.cond:                                         ; preds = %for.inc, %entry
23  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
24  %exitcond = icmp ne i64 %indvars.iv, 1024
25  %cmp1 = icmp slt i64 %c, %indvars.iv
26  br i1 %exitcond, label %for.body, label %for.end
27
28for.body:                                         ; preds = %for.cond
29  br i1 %cmp1, label %if.then, label %if.end
30
31if.then:                                          ; preds = %for.body
32  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
33  %tmp = load i32, i32* %arrayidx, align 4
34  %inc = add nsw i32 %tmp, 1
35  store i32 %inc, i32* %arrayidx, align 4
36  br label %if.end
37
38if.end:                                           ; preds = %if.then, %for.body
39  br label %for.inc
40
41for.inc:                                          ; preds = %if.end
42  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
43  br label %for.cond
44
45for.end:                                          ; preds = %for.cond
46  ret void
47}
48