109 lines · plain
1; RUN: opt %loadNPMPolly -pass-remarks-analysis=polly-scops '-passes=polly-custom<scops>' -polly-print-scops -polly-precise-inbounds -disable-output < %s 2>&1 | FileCheck %s2;3; CHECK: remark: <unknown>:0:0: SCoP begins here.4; CHECK-NEXT: remark: <unknown>:0:0: Use user assumption: [i, N, M] -> { : N <= i or (N > i and N >= 0) }5; CHECK-NEXT: remark: <unknown>:0:0: Inbounds assumption: [i, N, M] -> { : N <= i or (N > i and M <= 100) }6; CHECK-NEXT: remark: <unknown>:0:0: SCoP ends here.7;8; void f(int *restrict A, int *restrict B, int i, int N, int M, int C[100][100]) {9; for (; i < N; i++) {10; __builtin_assume(N >= 0);11; for (int j = 0; j != M; j++) {12; __builtin_assume(N >= 0);13; C[i][j] += A[i * M + j] + B[i + j];14; }15; }16; }17;18 19 20; RUN: opt %loadNPMPolly -pass-remarks-analysis=polly-scops '-passes=polly-custom<scops>' -polly-print-scops -polly-precise-inbounds -disable-output -pass-remarks-output=%t.yaml < %s 2>&121; RUN: cat %t.yaml | FileCheck -check-prefix=YAML %s22; YAML: --- !Analysis23; YAML: Pass: polly-scops24; YAML: Name: ScopEntry25; YAML: Function: f26; YAML: Args:27; YAML: - String: SCoP begins here.28; YAML: ...29; YAML: --- !Analysis30; YAML: Pass: polly-scops31; YAML: Name: UserAssumption32; YAML: Function: f33; YAML: Args:34; YAML: - String: 'Use user assumption: '35; YAML: - String: '[i, N, M] -> { : N <= i or (N > i and N >= 0) }'36; YAML: ...37; YAML: --- !Analysis38; YAML: Pass: polly-scops39; YAML: Name: AssumpRestrict40; YAML: Function: f41; YAML: Args:42; YAML: - String: 'Inbounds assumption: [i, N, M] -> { : N <= i or (N > i and M <= 100) }'43; YAML: ...44; YAML: --- !Analysis45; YAML: Pass: polly-scops46; YAML: Name: ScopEnd47; YAML: Function: f48; YAML: Args:49; YAML: - String: SCoP ends here.50; YAML: ...51 52target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"53 54define void @f(ptr noalias %A, ptr noalias %B, i32 %i, i32 %N, i32 %M, ptr %C) {55entry:56 %tmp = zext i32 %M to i6457 %tmp6 = sext i32 %i to i6458 %tmp7 = sext i32 %N to i6459 %tmp8 = sext i32 %M to i6460 br label %for.cond61 62for.cond: ; preds = %for.inc.15, %entry63 %indvars.iv3 = phi i64 [ %indvars.iv.next4, %for.inc.15 ], [ %tmp6, %entry ]64 %cmp = icmp slt i64 %indvars.iv3, %tmp765 br i1 %cmp, label %for.body, label %for.end.1766 67for.body: ; preds = %for.cond68 %cmp1 = icmp sgt i32 %N, -169 call void @llvm.assume(i1 %cmp1)70 br label %for.cond.271 72for.cond.2: ; preds = %for.inc, %for.body73 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.body ]74 %cmp3 = icmp eq i64 %indvars.iv, %tmp75 br i1 %cmp3, label %for.end, label %for.body.476 77for.body.4: ; preds = %for.cond.278 %tmp9 = mul nsw i64 %indvars.iv3, %tmp879 %tmp10 = add nsw i64 %tmp9, %indvars.iv80 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %tmp1081 %tmp11 = load i32, ptr %arrayidx, align 482 %tmp12 = add nsw i64 %indvars.iv3, %indvars.iv83 %arrayidx8 = getelementptr inbounds i32, ptr %B, i64 %tmp1284 %tmp13 = load i32, ptr %arrayidx8, align 485 %add9 = add nsw i32 %tmp11, %tmp1386 %arrayidx13 = getelementptr inbounds [100 x i32], ptr %C, i64 %indvars.iv3, i64 %indvars.iv87 %tmp14 = load i32, ptr %arrayidx13, align 488 %add14 = add nsw i32 %tmp14, %add989 store i32 %add14, ptr %arrayidx13, align 490 br label %for.inc91 92for.inc: ; preds = %for.body.493 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 194 br label %for.cond.295 96for.end: ; preds = %for.cond.297 br label %for.inc.1598 99for.inc.15: ; preds = %for.end100 %indvars.iv.next4 = add nsw i64 %indvars.iv3, 1101 br label %for.cond102 103for.end.17: ; preds = %for.cond104 ret void105}106 107declare void @llvm.assume(i1) #1108 109