brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 4964a12 Raw
82 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2;3; This checks that the no-wraps checks will be computed fast as some example4; already showed huge slowdowns even though the inbounds and nsw flags were5; all in place.6;7;    // Inspired by itrans8x8 in transform8x8.c from the ldecode benchmark.8;    void fast(char *A, char N, char M) {9;      for (char i = 0; i < 8; i++) {10;        short index0 = (short)(i + N);11;        #ifdef fast12;          short index1 = (index0 *  1) + (short)M;13;        #else14;          short index1 = (index0 * 16) + (short)M;15;        #endif16;        A[index1]++;17;      }18;    }19;20; CHECK: Function: fast21; CHECK: Function: slow22;23target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"24 25define void @fast(ptr %A, i8 %N, i8 %M) {26entry:27  br label %for.cond28 29for.cond:                                         ; preds = %for.inc, %entry30  %indvars.iv = phi i8 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]31  %exitcond = icmp ne i8 %indvars.iv, 832  br i1 %exitcond, label %for.body, label %for.end33 34for.body:                                         ; preds = %for.cond35  %tmp3 = add nsw i8 %indvars.iv, %N36  %tmp3ext = sext i8 %tmp3 to i1637  ;%mul = mul nsw i16 %tmp3ext, 1638  %Mext = sext i8 %M to i1639  %add2 = add nsw i16 %tmp3ext, %Mext40  %arrayidx = getelementptr inbounds i8, ptr %A, i16 %add241  %tmp4 = load i8, ptr %arrayidx, align 442  %inc = add nsw i8 %tmp4, 143  store i8 %inc, ptr %arrayidx, align 444  br label %for.inc45 46for.inc:                                          ; preds = %for.body47  %indvars.iv.next = add nuw nsw i8 %indvars.iv, 148  br label %for.cond49 50for.end:                                          ; preds = %for.cond51  ret void52}53 54define void @slow(ptr %A, i8 %N, i8 %M) {55entry:56  br label %for.cond57 58for.cond:                                         ; preds = %for.inc, %entry59  %indvars.iv = phi i8 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]60  %exitcond = icmp ne i8 %indvars.iv, 861  br i1 %exitcond, label %for.body, label %for.end62 63for.body:                                         ; preds = %for.cond64  %tmp3 = add nsw i8 %indvars.iv, %N65  %tmp3ext = sext i8 %tmp3 to i1666  %mul = mul nsw i16 %tmp3ext, 1667  %Mext = sext i8 %M to i1668  %add2 = add nsw i16 %mul, %Mext69  %arrayidx = getelementptr inbounds i8, ptr %A, i16 %add270  %tmp4 = load i8, ptr %arrayidx, align 471  %inc = add nsw i8 %tmp4, 172  store i8 %inc, ptr %arrayidx, align 473  br label %for.inc74 75for.inc:                                          ; preds = %for.body76  %indvars.iv.next = add nuw nsw i8 %indvars.iv, 177  br label %for.cond78 79for.end:                                          ; preds = %for.cond80  ret void81}82