59 lines · plain
1; RUN: opt %loadNPMPolly -pass-remarks-analysis=polly-scops '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s --check-prefix=SCOP3;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 are17; not modeled. There is no benefit in knowing about parameters that are18; unused in the scop, and adding them will increase the complexity of our19; 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(ptr %A, i32 %N, i32 %M) {31entry:32 %cmp = icmp sgt i32 %M, 033 call void @llvm.assume(i1 %cmp)34 %tmp = sext i32 %N to i6435 br label %for.cond36 37for.cond: ; preds = %for.inc, %entry38 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]39 %cmp1 = icmp slt i64 %indvars.iv, %tmp40 br i1 %cmp1, label %for.body, label %for.end41 42for.body: ; preds = %for.cond43 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv44 %tmp1 = load i32, ptr %arrayidx, align 445 %inc = add nsw i32 %tmp1, 146 store i32 %inc, ptr %arrayidx, align 447 br label %for.inc48 49for.inc: ; preds = %for.body50 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 151 br label %for.cond52 53for.end: ; preds = %for.cond54 ret i32 %M55}56 57declare void @llvm.assume(i1) #158 59