brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.7 KiB · 0bd99ea Raw
123 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: [M, N] -> {  : N <= 2147483647 - M }6; CHECK-NEXT: remark: <unknown>:0:0: Use user assumption: [M, N] -> {  : -2147483648 - M <= N <= 2147483647 - M }7; CHECK-NEXT: remark: <unknown>:0:0: Use user assumption: [M, N, Debug] -> {  : Debug = 0 and 0 < M <= 100 and -2147483648 - M <= N <= 2147483647 - M }8; CHECK-NEXT: remark: <unknown>:0:0: Use user assumption: [M, N, Debug] -> {  : Debug = 0 and 0 < M <= 100 and 0 < N <= 2147483647 - M }9; CHECK-NEXT: remark: <unknown>:0:0: SCoP ends here.10 11; SCOP:      Context:12; SCOP-NEXT: [N, M, Debug] -> { : Debug = 0 and N > 0 and 0 < M <= 2147483647 - N and M <= 100 }13; SCOP:      Assumed Context:14; SCOP-NEXT: [N, M, Debug] -> {  :  }15; SCOP:      Invalid Context:16; SCOP-NEXT: [N, M, Debug] -> {  : false }17;18;    #include <stdio.h>19;20;    void valid(int * restrict A, int * restrict B, int N, int M, int C[100][100], int Debug) {21;      __builtin_assume(M <= 2147483647 - N);22;      __builtin_assume(M >= -2147483648 - N);23;      __builtin_assume(Debug == 0 && M <= 100 && M >= 1 && N >= 1);24;      if (N + M == -1)25;        C[0][0] = 0;26;27;      for (int i = 0; i < N; i++) {28;        for (int j = 0; j != M; j++) {29;          C[i][j] += A[i * M + j] + B[i + j];30;        }31;32;        if (Debug)33;          printf("Printf!");34;      }35;    }36;37target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"38 39@.str = private unnamed_addr constant [8 x i8] c"Printf!\00", align 140 41define void @valid(ptr noalias %A, ptr noalias %B, i32 %N, i32 %M, ptr %C, i32 %Debug) {42entry:43  %sub = sub nsw i32 2147483647, %N44  %cmp = icmp sge i32 %sub, %M45  call void @llvm.assume(i1 %cmp)46  %conv = sext i32 %M to i6447  %conv1 = sext i32 %N to i6448  %sub2 = sub nsw i64 -2147483648, %conv149  %cmp3 = icmp sge i64 %conv, %sub250  call void @llvm.assume(i1 %cmp3)51  %cmp5 = icmp eq i32 %Debug, 052  %cmp7 = icmp slt i32 %M, 10153  %or.cond = and i1 %cmp5, %cmp754  %cmp10 = icmp sgt i32 %M, 055  %or.cond1 = and i1 %or.cond, %cmp1056  %cmp12 = icmp sgt i32 %N, 057  call void @llvm.assume(i1 %or.cond1)58  call void @llvm.assume(i1 %cmp12)59  %add = add nsw i32 %N, %M60  %cmp14 = icmp eq i32 %add, -161  br label %entry.split62 63entry.split:64  br i1 %cmp14, label %if.then, label %if.end65 66if.then:                                          ; preds = %entry67  store i32 0, ptr %C, align 468  br label %if.end69 70if.end:                                           ; preds = %if.then, %entry71  %M64 = sext i32 %M to i6472  %N64 = sext i32 %N to i6473  br label %for.cond74 75for.cond:                                         ; preds = %for.inc.36, %if.end76  %indvars.iv3 = phi i64 [ %indvars.iv.next4, %for.inc.36 ], [ 0, %if.end ]77  %cmp17 = icmp slt i64 %indvars.iv3, %N6478  br i1 %cmp17, label %for.cond.19, label %for.end.3879 80for.cond.19:                                      ; preds = %for.cond, %for.body.2281  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body.22 ], [ 0, %for.cond ]82  %cmp20 = icmp eq i64 %indvars.iv, %M6483  br i1 %cmp20, label %for.end, label %for.body.2284 85for.body.22:                                      ; preds = %for.cond.1986  %tmp9 = mul nsw i64 %indvars.iv3, %M6487  %tmp10 = add nsw i64 %tmp9, %indvars.iv88  %arrayidx24 = getelementptr inbounds i32, ptr %A, i64 %tmp1089  %tmp11 = load i32, ptr %arrayidx24, align 490  %tmp12 = add nuw nsw i64 %indvars.iv3, %indvars.iv91  %arrayidx27 = getelementptr inbounds i32, ptr %B, i64 %tmp1292  %tmp13 = load i32, ptr %arrayidx27, align 493  %add28 = add nsw i32 %tmp11, %tmp1394  %arrayidx32 = getelementptr inbounds [100 x i32], ptr %C, i64 %indvars.iv3, i64 %indvars.iv95  %tmp14 = load i32, ptr %arrayidx32, align 496  %add33 = add nsw i32 %tmp14, %add2897  store i32 %add33, ptr %arrayidx32, align 498  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 199  br label %for.cond.19100 101for.end:                                          ; preds = %for.cond.19102  %tobool = icmp eq i32 %Debug, 0103  br i1 %tobool, label %for.inc.36, label %if.then.34104 105if.then.34:                                       ; preds = %for.end106  %call = call i32 (ptr, ...) @printf(ptr nonnull @.str)107  br label %for.inc.36108 109for.inc.36:                                       ; preds = %for.end, %if.then.34110  %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 1111  br label %for.cond112 113for.end.38:                                       ; preds = %for.cond114  ret void115}116 117; Function Attrs: nounwind118declare void @llvm.assume(i1) #0119 120declare i32 @printf(ptr, ...)121 122attributes #0 = { nounwind }123