brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · cc4e9e1 Raw
110 lines · plain
1# RUN: llc -mtriple=hexagon -run-pass pipeliner -debug-only=pipeliner %s -o /dev/null 2>&1 -pipeliner-experimental-cg=true | FileCheck %s2# REQUIRES: asserts3 4# Test that loop carried memory dependences are computed correctly.5# The original code is as follows.6#7# ```8# void f(int *a, int n) {9#   for (int i = 0; i < n-2; i++) {10#     a[i] += a[i+10];11#     a[i+2] += i;12#   }13# }14# ```15#16# Here is what each instruction does.17# SU(2): Load a[i+10]18# SU(3): Store it to a[i]19# SU(4): Load a[i+2], add i, then store it20#21# FIXME: Currently the following dependencies are missed.22#23 24# CHECK:      ===== Loop Carried Edges Begin =====25# CHECK-NEXT:   Loop carried edges from SU(2)26# CHECK-NEXT:     Order27# CHECK-NEXT:       SU(3)28# CHECK-NEXT:       SU(4)29# CHECK-NEXT:   Loop carried edges from SU(4)30# CHECK-NEXT:     Order31# CHECK-NEXT:       SU(3)32# CHECK-NEXT: ===== Loop Carried Edges End =====33 34--- |35  define dso_local void @f(ptr nocapture noundef %a, i32 noundef %n) {36  entry:37    %cmp13 = icmp sgt i32 %n, 238    br i1 %cmp13, label %for.body.preheader, label %for.cond.cleanup39 40  for.body.preheader:41    %0 = add i32 %n, -242    br label %for.body43 44  for.cond.cleanup:45    ret void46 47  for.body:48    %lsr.iv15 = phi ptr [ %a, %for.body.preheader ], [ %cgep19, %for.body ]49    %lsr.iv = phi i32 [ %0, %for.body.preheader ], [ %lsr.iv.next, %for.body ]50    %i.014 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]51    %cgep = getelementptr i8, ptr %lsr.iv15, i32 4052    %1 = load i32, ptr %cgep, align 4, !tbaa !553    %2 = load i32, ptr %lsr.iv15, align 4, !tbaa !554    %add2 = add nsw i32 %2, %155    store i32 %add2, ptr %lsr.iv15, align 4, !tbaa !556    %cgep18 = getelementptr i8, ptr %lsr.iv15, i32 857    %3 = load i32, ptr %cgep18, align 4, !tbaa !558    %4 = add i32 %i.014, %359    store i32 %4, ptr %cgep18, align 4, !tbaa !560    %inc = add nuw nsw i32 %i.014, 161    %lsr.iv.next = add i32 %lsr.iv, -162    %exitcond.not = icmp eq i32 %lsr.iv.next, 063    %cgep19 = getelementptr i8, ptr %lsr.iv15, i32 464    br i1 %exitcond.not, label %for.cond.cleanup, label %for.body65  }66 67  !5 = !{!6, !6, i64 0}68  !6 = !{!"int", !7, i64 0}69  !7 = !{!"omnipotent char", !8, i64 0}70  !8 = !{!"Simple C/C++ TBAA"}71 72...73---74name:            f75tracksRegLiveness: true76body:             |77  bb.0.entry:78    successors: %bb.1, %bb.279    liveins: $r0, $r180  81    %8:intregs = COPY $r182    %7:intregs = COPY $r083    %9:predregs = C2_cmpgti %8, 284    J2_jumpf %9, %bb.2, implicit-def dead $pc85    J2_jump %bb.1, implicit-def dead $pc86  87  bb.1.for.body.preheader:88    %0:intregs = A2_addi %8, -289    %11:intregs = A2_tfrsi 090    %14:intregs = COPY %091    J2_loop0r %bb.3, %14, implicit-def $lc0, implicit-def $sa0, implicit-def $usr92    J2_jump %bb.3, implicit-def dead $pc93  94  bb.2.for.cond.cleanup:95    PS_jmpret $r31, implicit-def dead $pc96  97  bb.3.for.body:98    successors: %bb.2, %bb.399  100    %1:intregs = PHI %7, %bb.1, %6, %bb.3101    %3:intregs = PHI %11, %bb.1, %4, %bb.3102    %12:intregs = L2_loadri_io %1, 40 :: (load (s32) from %ir.cgep, !tbaa !5)103    L4_add_memopw_io %1, 0, killed %12 :: (store (s32) into %ir.lsr.iv15, !tbaa !5), (load (s32) from %ir.lsr.iv15, !tbaa !5)104    L4_add_memopw_io %1, 8, %3 :: (store (s32) into %ir.cgep18, !tbaa !5), (load (s32) from %ir.cgep18, !tbaa !5)105    %4:intregs = nuw nsw A2_addi %3, 1106    %6:intregs = A2_addi %1, 4107    ENDLOOP0 %bb.3, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0108    J2_jump %bb.2, implicit-def $pc109...110