1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-print-ast -disable-output < %s | FileCheck %s --check-prefix=AST
4 ; The SCoP contains a loop with multiple exit blocks (BBs after leaving
5 ; the loop). The current implementation of deriving their domain derives
6 ; only a common domain for all of the exit blocks. We disabled loops with
7 ; multiple exit blocks until this is fixed.
10 ; void f(int *A, int *B, int N) {
11 ; for (int i = 0; i < N; i++) {
24 ; CHECK-NEXT: Stmt_for_body
25 ; CHECK-NEXT: Domain :=
26 ; CHECK-NEXT: [N] -> { Stmt_for_body[0] : N > 0 };
27 ; CHECK-NEXT: Schedule :=
28 ; CHECK-NEXT: [N] -> { Stmt_for_body[i0] -> [0] };
29 ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
30 ; CHECK-NEXT: [N] -> { Stmt_for_body[i0] -> MemRef_A[0] };
31 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
32 ; CHECK-NEXT: [N] -> { Stmt_for_body[i0] -> MemRef_A[0] };
38 ; AST-NEXT: Stmt_for_body(0);
41 ; AST-NEXT: { /* original code */ }
43 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
45 define void @f(ptr %A, ptr %B, i32 %N) {
47 %tmp = sext i32 %N to i64
50 for.cond: ; preds = %for.inc, %entry
51 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
52 %cmp = icmp slt i64 %indvars.iv, %tmp
53 br i1 %cmp, label %for.body, label %for.end.loopexit
55 for.body: ; preds = %for.cond
56 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
57 %tmp1 = load i32, ptr %arrayidx, align 4
58 %inc = add nsw i32 %tmp1, 1
59 store i32 %inc, ptr %arrayidx, align 4
60 switch i32 %N, label %sw.default [
64 sw.bb: ; preds = %for.body
65 %arrayidx2 = getelementptr inbounds i32, ptr %B, i64 %indvars.iv
66 %tmp2 = load i32, ptr %arrayidx2, align 4
67 %inc3 = add nsw i32 %tmp2, 1
68 store i32 %inc3, ptr %arrayidx2, align 4
71 sw.default: ; preds = %for.body
74 sw.epilog: ; preds = %sw.bb
77 for.inc: ; preds = %sw.epilog
78 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
81 for.end.loopexit: ; preds = %for.cond
84 for.end: ; preds = %for.end.loopexit, %sw.default