Fix Polly
[polly-mirror.git] / test / ScopInfo / phi_conditional_simple_1.ll
blobac7a5ffc4c28f0c32a56d394262b32c05774d244
1 ; RUN: opt %loadPolly -analyze -polly-scops < %s | FileCheck %s
3 ;    void jd(int *A, int c) {
4 ;      for (int i = 0; i < 1024; i++) {
5 ;        if (c)
6 ;          A[i] = 1;
7 ;        else
8 ;          A[i] = 2;
9 ;      }
10 ;    }
12 ; CHECK:    Statements {
13 ; CHECK-LABEL:      Stmt_if_else
14 ; CHECK-NOT: Access
15 ; CHECK:            MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]
16 ; CHECK:                [c] -> { Stmt_if_else[i0] -> MemRef_phi__phi[] };
17 ; CHECK-NOT: Access
18 ; CHECK-LABEL:      Stmt_if_then
19 ; CHECK-NOT: Access
20 ; CHECK:            MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]
21 ; CHECK:                [c] -> { Stmt_if_then[i0] -> MemRef_phi__phi[] };
22 ; CHECK-NOT: Access
23 ; CHECK-LABEL:      Stmt_if_end
24 ; CHECK-NOT: Access
25 ; CHECK:            ReadAccess := [Reduction Type: NONE] [Scalar: 1]
26 ; CHECK:                [c] -> { Stmt_if_end[i0] -> MemRef_phi__phi[] };
27 ; CHECK-NOT: Access
28 ; CHECK:            MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
29 ; CHECK:                [c] -> { Stmt_if_end[i0] -> MemRef_A[i0] };
30 ; CHECK-NOT: Access
31 ; CHECK:    }
33 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
35 define void @jd(i32* %A, i32 %c) {
36 entry:
37   br label %for.cond
39 for.cond:                                         ; preds = %for.inc, %entry
40   %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
41   %exitcond = icmp ne i64 %indvars.iv, 1024
42   br i1 %exitcond, label %for.body, label %for.end
44 for.body:                                         ; preds = %for.cond
45   %tobool = icmp eq i32 %c, 0
46   br i1 %tobool, label %if.else, label %if.then
48 if.then:                                          ; preds = %for.body
49   br label %if.end
51 if.else:                                          ; preds = %for.body
52   br label %if.end
54 if.end:                                           ; preds = %if.else, %if.then
55   %phi = phi i32 [ 1, %if.then], [ 2, %if.else ]
56   %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
57   store i32 %phi, i32* %arrayidx, align 4
58   br label %for.inc
60 for.inc:                                          ; preds = %if.end
61   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
62   br label %for.cond
64 for.end:                                          ; preds = %for.cond
65   ret void