1 ; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa -polly-allow-nonaffine -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true '-passes=print<polly-detect>,print<polly-function-scops>' -disable-output < %s 2>&1 | FileCheck %s -check-prefix=SCALAR
2 ; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa -polly-allow-nonaffine -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -polly-process-unprofitable=false '-passes=print<polly-detect>,print<polly-function-scops>' -disable-output < %s 2>&1 | FileCheck %s -check-prefix=PROFIT
5 ; SCALAR-NEXT: Region: %bb1---%bb13
6 ; SCALAR-NEXT: Max Loop Depth: 1
7 ; SCALAR-NEXT: Invariant Accesses: {
9 ; SCALAR-NEXT: Context:
11 ; SCALAR-NEXT: Assumed Context:
13 ; SCALAR-NEXT: Invalid Context:
14 ; SCALAR-NEXT: { : false }
16 ; SCALAR-NEXT: i32 MemRef_C[*]; // Element size 4
17 ; SCALAR-NEXT: i32 MemRef_A[*]; // Element size 4
19 ; SCALAR-NEXT: Arrays (Bounds as pw_affs) {
20 ; SCALAR-NEXT: i32 MemRef_C[*]; // Element size 4
21 ; SCALAR-NEXT: i32 MemRef_A[*]; // Element size 4
23 ; SCALAR-NEXT: Alias Groups (0):
25 ; SCALAR-NEXT: Statements {
26 ; SCALAR-NEXT: Stmt_bb3__TO__bb11
27 ; SCALAR-NEXT: Domain :=
28 ; SCALAR-NEXT: { Stmt_bb3__TO__bb11[i0] : 0 <= i0 <= 1023 };
29 ; SCALAR-NEXT: Schedule :=
30 ; SCALAR-NEXT: { Stmt_bb3__TO__bb11[i0] -> [i0] };
31 ; SCALAR-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
32 ; SCALAR-NEXT: { Stmt_bb3__TO__bb11[i0] -> MemRef_C[i0] };
33 ; SCALAR-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
34 ; SCALAR-NEXT: { Stmt_bb3__TO__bb11[i0] -> MemRef_A[o0] };
35 ; SCALAR-NEXT: MayWriteAccess := [Reduction Type: +] [Scalar: 0]
36 ; SCALAR-NEXT: { Stmt_bb3__TO__bb11[i0] -> MemRef_A[o0] };
39 ; PROFIT-NOT: Statements
41 ; void f(int * restrict A, int * restrict C) {
43 ; for (int i = 0; i < 1024; i++) {
44 ; while ((j = C[i++])) {
51 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
53 define void @f(ptr noalias %A, ptr noalias %C) {
57 bb1: ; preds = %bb12, %bb
58 %indvars.iv = phi i64 [ %indvars.iv.next, %bb12 ], [ 0, %bb ]
59 %exitcond = icmp ne i64 %indvars.iv, 1024
60 br i1 %exitcond, label %bb2, label %bb13
65 bb3: ; preds = %bb6, %bb2
66 %tmp = getelementptr inbounds i32, ptr %C, i64 %indvars.iv
67 %tmp4 = load i32, ptr %tmp, align 4
68 %tmp5 = icmp eq i32 %tmp4, 0
69 br i1 %tmp5, label %bb11, label %bb6
72 %tmp7 = sext i32 %tmp4 to i64
73 %tmp8 = getelementptr inbounds i32, ptr %A, i64 %tmp7
74 %tmp9 = load i32, ptr %tmp8, align 4
75 %tmp10 = add nsw i32 %tmp9, 1
76 store i32 %tmp10, ptr %tmp8, align 4
77 br i1 true, label %bb11, label %bb3
83 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1