Skip to content

Commit

Permalink
[AIEX] Trim unnecessary empty bundles in TopInsert
Browse files Browse the repository at this point in the history
  • Loading branch information
andcarminati committed Dec 11, 2024
1 parent 4a4f73d commit cc37cc3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
7 changes: 7 additions & 0 deletions llvm/lib/Target/AIE/AIEInterBlockScheduling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,13 @@ void InterBlockScheduling::emitInterBlockTop(BlockState &BS) {
if (LBS.isPipelined()) {
auto *DedicatedExit = makeDedicatedLoopExit(Loop, BB);
if (DedicatedExit == BB) {

// Trim excedent empty bundles.
while (BS.TopInsert.back().empty()) {
assert(BS.TopInsert.back().getMetaInstrs().empty());
BS.TopInsert.pop_back();
}

// If we are in the same BB, just emit.
emitBundles(BS.TopInsert, DedicatedExit, DedicatedExit->begin(),
/*Move=*/false, /*EmitNops=*/false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
; CHECK-NEXT: .L_LEnd0:
; CHECK-NEXT: nopb ; nopa ; vst wh6, [p2, #32]; nopx ; vbneg_ltz.s8 x3, r25:r24, x1; nopv
; CHECK-NEXT: // %bb.3: // %for.cond.cleanup
; CHECK-NEXT: vst wl6, [p2], #64; nopx ; vband x4, x0, x3
; CHECK-NEXT: nopb ; nopa ; vst wl6, [p2], #64; nopx ; vband x4, x0, x3; nopv
; CHECK-NEXT: vband x5, x1, x2
; CHECK-NEXT: vbor x6, x4, x5
; CHECK-NEXT: vbneg_ltz.s8 x2, r25:r24, x0
Expand All @@ -63,9 +63,6 @@
; CHECK-NEXT: vst wh6, [p2, #32]
; CHECK-NEXT: vst wl6, [p2], #64
; CHECK-NEXT: nop
; CHECK-NEXT: nop
; CHECK-NEXT: nop
; CHECK-NEXT: nop
; CHECK-NEXT: .p2align 4
; CHECK-NEXT: .LBB0_4: // %for.cond.cleanup
; CHECK-NEXT: nopa ; ret lr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,14 @@
; CHECK-NEXT: .L_LEnd0:
; CHECK-NEXT: nopb ; lda r7, [p0], #4; st r0, [p1], #4; nopxm ; nopv
; CHECK-NEXT: // %bb.3: // %for.cond.cleanup
; CHECK-NEXT: st r1, [p1], #4
; CHECK-NEXT: st r1, [p1], #4; nopx
; CHECK-NEXT: st r2, [p1], #4
; CHECK-NEXT: st r3, [p1], #4
; CHECK-NEXT: st r4, [p1], #4
; CHECK-NEXT: st r5, [p1], #4
; CHECK-NEXT: st r6, [p1], #4
; CHECK-NEXT: st r7, [p1], #4
; CHECK-NEXT: nop
; CHECK-NEXT: nop
; CHECK-NEXT: .p2align 4
; CHECK-NEXT: .LBB0_4: // %for.cond.cleanup
; CHECK-NEXT: nopa ; ret lr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@
; CHECK-NEXT: .L_LEnd0:
; CHECK-NEXT: nopb ; nopa ; nops ; add r0, r0, #1; nopm ; nopv
; CHECK-NEXT: // %bb.3: // %for.cond.cleanup
; CHECK-NEXT: st r0, [p0], #4
; CHECK-NEXT: st r0, [p0], #4; nopx
; CHECK-NEXT: add r0, r0, #1
; CHECK-NEXT: st r0, [p0], #4
; CHECK-NEXT: add r0, r0, #1
; CHECK-NEXT: st r0, [p0], #4
; CHECK-NEXT: add r0, r0, #1
; CHECK-NEXT: st r0, [p0], #4
; CHECK-NEXT: nop
; CHECK-NEXT: nop
; CHECK-NEXT: .p2align 4
; CHECK-NEXT: .LBB0_4: // %for.cond.cleanup
; CHECK-NEXT: nopa ; ret lr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@
; CHECK-NEXT: .L_LEnd0:
; CHECK-NEXT: nopb ; nopa ; nops ; add r0, r0, #1; nopm ; nopv
; CHECK-NEXT: // %bb.3: // %for.cond.cleanup
; CHECK-NEXT: st r0, [p0], #4
; CHECK-NEXT: st r0, [p0], #4; nopx
; CHECK-NEXT: add r0, r0, #1
; CHECK-NEXT: st r0, [p0], #4
; CHECK-NEXT: add r0, r0, #1
; CHECK-NEXT: st r0, [p0], #4
; CHECK-NEXT: add r0, r0, #1
; CHECK-NEXT: st r0, [p0], #4
; CHECK-NEXT: nop
; CHECK-NEXT: nop
; CHECK-NEXT: .p2align 4
; CHECK-NEXT: .LBB0_4: // %for.cond.cleanup
; CHECK-NEXT: nopa ; ret lr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,14 @@
; CHECK-NEXT: .L_LEnd0:
; CHECK-NEXT: nopb ; lda r3, [p0], #4; st r0, [p1], #4; nopxm ; nopv
; CHECK-NEXT: // %bb.3: // %for.cond.cleanup
; CHECK-NEXT: st r1, [p1], #4
; CHECK-NEXT: st r1, [p1], #4; nopx
; CHECK-NEXT: st r2, [p1], #4
; CHECK-NEXT: st r3, [p1], #4
; CHECK-NEXT: st r0, [p1], #4
; CHECK-NEXT: st r1, [p1], #4
; CHECK-NEXT: st r2, [p1], #4
; CHECK-NEXT: st r3, [p1], #4
; CHECK-NEXT: nop
; CHECK-NEXT: nop
; CHECK-NEXT: .p2align 4
; CHECK-NEXT: .LBB0_4: // %for.cond.cleanup
; CHECK-NEXT: nopa ; ret lr
Expand Down

0 comments on commit cc37cc3

Please sign in to comment.