brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · 66e509d Raw
100 lines · plain
1; RUN: opt < %s -passes=loop-interchange -cache-line-size=64 -pass-remarks-missed='loop-interchange' \2; RUN:   -pass-remarks-output=%t -verify-loop-info -verify-dom-info -S | FileCheck -check-prefix=IR %s3; RUN: FileCheck --input-file=%t %s4 5; RUN: opt < %s -passes=loop-interchange -cache-line-size=64 -pass-remarks-missed='loop-interchange' \6; RUN:   -da-disable-delinearization-checks -pass-remarks-output=%t             \7; RUN:   -verify-loop-info -verify-dom-info -S | FileCheck -check-prefix=IR %s8; RUN: FileCheck --check-prefix=DELIN --input-file=%t %s9 10target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"11 12@A = common global [100 x [100 x i32]] zeroinitializer13@B = common global [100 x [100 x [100 x i32]]] zeroinitializer14@C = common global [100 x [100 x i64]] zeroinitializer15 16;;--------------------------------------Test case 01------------------------------------17;; This loop can be interchanged with -da-disable-delinearization-checks, otherwise it cannot18;; be interchanged due to dependence.19;;  for(int i=0;i<N-1;i++)20;;    for(int j=1;j<N-1;j++)21;;      A[j+1][i+1] = A[j+1][i+1] + k;22 23; CHECK:      Name:            Dependence24; CHECK-NEXT: Function:        interchange_0125 26; DELIN:      Name:            Interchanged27; DELIN-NEXT: Function:        interchange_0128define void @interchange_01(i32 %k, i32 %N) {29 entry:30   %sub = add nsw i32 %N, -131   %cmp26 = icmp sgt i32 %N, 132   br i1 %cmp26, label %for.cond1.preheader.lr.ph, label %for.end1733 34 for.cond1.preheader.lr.ph:35   %cmp324 = icmp sgt i32 %sub, 136   %0 = add i32 %N, -237   %1 = sext i32 %sub to i6438   br label %for.cond1.preheader39 40 for.cond.loopexit:41   %cmp = icmp slt i64 %indvars.iv.next29, %142   br i1 %cmp, label %for.cond1.preheader, label %for.end1743 44 for.cond1.preheader:45   %indvars.iv28 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next29, %for.cond.loopexit ]46   %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 147   br i1 %cmp324, label %for.body4, label %for.cond.loopexit48 49 for.body4:50   %indvars.iv = phi i64 [ %indvars.iv.next, %for.body4 ], [ 1, %for.cond1.preheader ]51   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 152   %arrayidx7 = getelementptr inbounds [100 x [100 x i32]], ptr @A, i64 0, i64 %indvars.iv.next, i64 %indvars.iv.next2953   %2 = load i32, ptr %arrayidx754   %add8 = add nsw i32 %2, %k55   store i32 %add8, ptr %arrayidx756   %lftr.wideiv = trunc i64 %indvars.iv to i3257   %exitcond = icmp eq i32 %lftr.wideiv, %058   br i1 %exitcond, label %for.cond.loopexit, label %for.body459 60 for.end17:61   ret void62}63 64; When currently cannot interchange this loop, because transform currently65; expects the latches to be the exiting blocks too.66 67; IR-LABEL: @interchange_0268; IR-NOT: split69;70; CHECK:      Name:            ExitingNotLatch71; CHECK-NEXT: Function:        interchange_0272define void @interchange_02(i64 %k, i64 %N) {73entry:74  br label %for1.header75 76for1.header:77  %j23 = phi i64 [ 0, %entry ], [ %j.next24, %for1.inc10 ]78  br label %for279 80for2:81  %j = phi i64 [ %j.next, %latch ], [ 0, %for1.header ]82  %arrayidx5 = getelementptr inbounds [100 x [100 x i64]], ptr @C, i64 0, i64 %j, i64 %j2383  %lv = load i64, ptr %arrayidx584  %add = add nsw i64 %lv, %k85  store i64 %add, ptr %arrayidx586  %exitcond = icmp eq i64 %j, 9987  br i1 %exitcond, label %for1.inc10, label %latch88latch:89  %j.next = add nuw nsw i64 %j, 190  br label %for291 92for1.inc10:93  %j.next24 = add nuw nsw i64 %j23, 194  %exitcond26 = icmp eq i64 %j23, 9995  br i1 %exitcond26, label %for.end12, label %for1.header96 97for.end12:98  ret void99}100