brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · 7182e0a Raw
109 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 dependencies are added correctly.5# The original code is as follows.6#7# ```8# void f(int *a, int n) {9#   for (int i = 0; i < n-1; i++) {10#     a[i] += a[i];11#     a[i+1] += i;12#   }13# }14# ```15# 16# Loop-carried dependencies exist from store for a[i+1] to load/store for a[i], but not vice versa.17 18# CHECK:      ===== Loop Carried Edges Begin =====19# CHECK-NEXT:   Loop carried edges from SU(6)20# CHECK-NEXT:     Order21# CHECK-NEXT:       SU(4)22# CHECK-NEXT:   Loop carried edges from SU(8)23# CHECK-NEXT:     Order24# CHECK-NEXT:       SU(4)25# CHECK-NEXT: ===== Loop Carried Edges End =====26 27--- |28  define dso_local void @f(ptr nocapture noundef %a, i32 noundef %n) local_unnamed_addr {29  entry:30    %cmp12 = icmp sgt i32 %n, 131    br i1 %cmp12, label %for.body.preheader, label %for.cond.cleanup32 33  for.body.preheader:34    %.pre = load i32, ptr %a, align 4, !tbaa !535    %0 = add i32 %n, -136    %cgep = getelementptr i8, ptr %a, i32 437    br label %for.body38 39  for.cond.cleanup:40    ret void41 42  for.body:43    %lsr.iv14 = phi ptr [ %cgep, %for.body.preheader ], [ %cgep18, %for.body ]44    %lsr.iv = phi i32 [ %0, %for.body.preheader ], [ %lsr.iv.next, %for.body ]45    %1 = phi i32 [ %add4, %for.body ], [ %.pre, %for.body.preheader ]46    %i.013 = phi i32 [ %add2, %for.body ], [ 0, %for.body.preheader ]47    %add = shl nsw i32 %1, 148    %cgep17 = getelementptr i8, ptr %lsr.iv14, i32 -449    store i32 %add, ptr %cgep17, align 4, !tbaa !550    %add2 = add nuw nsw i32 %i.013, 151    %2 = load i32, ptr %lsr.iv14, align 4, !tbaa !552    %add4 = add nsw i32 %2, %i.01353    %3 = add i32 %i.013, %254    store i32 %3, ptr %lsr.iv14, align 4, !tbaa !555    %lsr.iv.next = add i32 %lsr.iv, -156    %exitcond.not = icmp eq i32 %lsr.iv.next, 057    %cgep18 = getelementptr i8, ptr %lsr.iv14, i32 458    br i1 %exitcond.not, label %for.cond.cleanup, label %for.body59  }60 61  !5 = !{!6, !6, i64 0}62  !6 = !{!"int", !7, i64 0}63  !7 = !{!"omnipotent char", !8, i64 0}64  !8 = !{!"Simple C/C++ TBAA"}65 66...67---68name:            f69tracksRegLiveness: true70machineFunctionInfo: {}71body:             |72  bb.0.entry:73    successors: %bb.1, %bb.274    liveins: $r0, $r175  76    %12:intregs = COPY $r177    %11:intregs = COPY $r078    %13:predregs = C2_cmpgti %12, 179    J2_jumpf %13, %bb.2, implicit-def dead $pc80    J2_jump %bb.1, implicit-def dead $pc81  82  bb.1.for.body.preheader:83    %0:intregs, %2:intregs = L2_loadri_pi %11, 4 :: (load (s32) from %ir.a, !tbaa !5)84    %1:intregs = A2_addi %12, -185    %15:intregs = A2_tfrsi 086    %19:intregs = COPY %187    J2_loop0r %bb.3, %19, implicit-def $lc0, implicit-def $sa0, implicit-def $usr88    J2_jump %bb.3, implicit-def dead $pc89  90  bb.2.for.cond.cleanup:91    PS_jmpret $r31, implicit-def dead $pc92  93  bb.3.for.body:94    successors: %bb.2, %bb.395  96    %3:intregs = PHI %2, %bb.1, %10, %bb.397    %5:intregs = PHI %0, %bb.1, %8, %bb.398    %6:intregs = PHI %15, %bb.1, %7, %bb.399    %16:intregs = nsw S2_asl_i_r %5, 1100    S2_storeri_io %3, -4, killed %16 :: (store (s32) into %ir.cgep17, !tbaa !5)101    %7:intregs = nuw nsw A2_addi %6, 1102    %17:intregs = L2_loadri_io %3, 0 :: (load (s32) from %ir.lsr.iv14, !tbaa !5)103    %8:intregs = A2_add killed %17, %6104    S2_storeri_io %3, 0, %8 :: (store (s32) into %ir.lsr.iv14, !tbaa !5)105    %10:intregs = A2_addi %3, 4106    ENDLOOP0 %bb.3, implicit-def $pc, implicit-def $lc0, implicit $sa0, implicit $lc0107    J2_jump %bb.2, implicit-def $pc108...109