Fix Polly
[polly-mirror.git] / test / ScopInfo / scalar_dependence_cond_br.ll
blobe32a3541bf50551a987c8b91e11b37f5622e781d
1 ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
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 ;    }
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.
14 ; CHECK-NOT:  Stmt_for_cond[i0] -> MemRef_cmp1[] }
16 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
18 define void @f(i32* %A, i64 %c) {
19 entry:
20   br label %for.cond
22 for.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
28 for.body:                                         ; preds = %for.cond
29   br i1 %cmp1, label %if.then, label %if.end
31 if.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
38 if.end:                                           ; preds = %if.then, %for.body
39   br label %for.inc
41 for.inc:                                          ; preds = %if.end
42   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
43   br label %for.cond
45 for.end:                                          ; preds = %for.cond
46   ret void