1; RUN: opt %loadPolly -pass-remarks-analysis="polly-scops" -polly-scops -disable-output < %s 2>&1 | FileCheck %s
2; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s --check-prefix=SCOP
3;
4; CHECK:      remark: <unknown>:0:0: SCoP begins here.
5; CHECK-NEXT: remark: <unknown>:0:0: Use user assumption: [N] -> { : N >= 2 }
6; CHECK-NEXT: remark: <unknown>:0:0: SCoP ends here.
7
8; SCOP:      Context:
9; SCOP-NEXT: [N, M] -> { : 2 <= N <= 2147483647 and -2147483648 <= M <= 2147483647 }
10; SCOP:      Assumed Context:
11; SCOP-NEXT: [N, M] -> { : }
12; SCOP:      Invalid Context:
13; SCOP-NEXT: [N, M] -> { : false }
14;
15;    int f(int *A, int N, int M) {
16;      __builtin_assume(M > 0 && N > M);
17;      for (int i = 0; i < N; i++)
18;        A[i]++;
19;      return M;
20;    }
21;
22target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23
24define i32 @f(i32* %A, i32 %N, i32 %M) {
25entry:
26  %cmp = icmp sgt i32 %M, 0
27  %cmp1 = icmp sgt i32 %N, %M
28  %and = and i1 %cmp, %cmp1
29  call void @llvm.assume(i1 %and)
30  %tmp1 = sext i32 %N to i64
31  br label %for.cond
32
33for.cond:                                         ; preds = %for.inc, %land.end
34  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
35  %cmp2 = icmp slt i64 %indvars.iv, %tmp1
36  br i1 %cmp2, label %for.body, label %for.end
37
38for.body:                                         ; preds = %for.cond
39  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
40  %tmp2 = load i32, i32* %arrayidx, align 4
41  %inc = add nsw i32 %tmp2, 1
42  store i32 %inc, i32* %arrayidx, align 4
43  br label %for.inc
44
45for.inc:                                          ; preds = %for.body
46  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
47  br label %for.cond
48
49for.end:                                          ; preds = %for.cond
50  ret i32 %M
51}
52
53declare void @llvm.assume(i1) #1
54
55