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: { : }
6; CHECK-NEXT: remark: <unknown>:0:0: SCoP ends here.
7
8; SCOP:      Context:
9; SCOP-NEXT: [N, M] -> { : -2147483648 <= 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;
16; This test checks that assumptions over parameters not used in the Scop are
17; not modeled. There is no benefit in knowing about parameters that are
18; unused in the scop, and adding them will increase the complexity of our
19; model.
20;
21;    int f(int *A, int N, int M) {
22;      __builtin_assume(M > 0);
23;      for (int i = 0; i < N; i++)
24;        A[i]++;
25;      return M;
26;    }
27;
28target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
29
30define i32 @f(i32* %A, i32 %N, i32 %M) {
31entry:
32  %cmp = icmp sgt i32 %M, 0
33  call void @llvm.assume(i1 %cmp)
34  %tmp = sext i32 %N to i64
35  br label %for.cond
36
37for.cond:                                         ; preds = %for.inc, %entry
38  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
39  %cmp1 = icmp slt i64 %indvars.iv, %tmp
40  br i1 %cmp1, label %for.body, label %for.end
41
42for.body:                                         ; preds = %for.cond
43  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
44  %tmp1 = load i32, i32* %arrayidx, align 4
45  %inc = add nsw i32 %tmp1, 1
46  store i32 %inc, i32* %arrayidx, align 4
47  br label %for.inc
48
49for.inc:                                          ; preds = %for.body
50  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
51  br label %for.cond
52
53for.end:                                          ; preds = %for.cond
54  ret i32 %M
55}
56
57declare void @llvm.assume(i1) #1
58
59