1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/test/CodeGen/X86/tail-merge-after-mbp.mir
Guozhi Wei 2be00d9e54 [MBP] Avoid tail duplication if it can't bring benefit
Current tail duplication integrated in bb layout is designed to increase the fallthrough from a BB's predecessor to its successor, but we have observed cases that duplication doesn't increase fallthrough, or it brings too much size overhead.

To overcome these two issues in function canTailDuplicateUnplacedPreds I add two checks:

  make sure there is at least one duplication in current work set.
  the number of duplication should not exceed the number of successors.

The modification in hasBetterLayoutPredecessor fixes a bug that potential predecessor must be at the bottom of a chain.

Differential Revision: https://reviews.llvm.org/D64376
2019-12-06 09:53:53 -08:00

119 lines
3.9 KiB
YAML

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=x86_64-linux -run-pass=block-placement -o - %s | FileCheck %s
---
# check loop bb.7 is not merged with bb.10, bb.13
# check loop bb.9 is not merged with bb.12
name: foo
body: |
; CHECK-LABEL: name: foo
; CHECK: bb.0:
; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
; CHECK: TEST8ri $dl, 1, implicit-def $eflags, implicit killed $edx
; CHECK: JCC_1 %bb.1, 5, implicit $eflags
; CHECK: bb.2:
; CHECK: successors: %bb.1(0x30000000), %bb.3(0x50000000)
; CHECK: $rax = MOV64rm $r14, 1, $noreg, 0, $noreg :: (load 8)
; CHECK: TEST64rr $rax, $rax, implicit-def $eflags
; CHECK: JCC_1 %bb.1, 4, implicit $eflags
; CHECK: bb.3:
; CHECK: successors: %bb.6(0x30000000), %bb.4(0x50000000)
; CHECK: CMP64mi8 killed $rax, 1, $noreg, 8, $noreg, 0, implicit-def $eflags :: (load 8)
; CHECK: JCC_1 %bb.6, 4, implicit $eflags
; CHECK: bb.4:
; CHECK: $ebp = XOR32rr undef $ebp, undef $ebp, implicit-def dead $eflags
; CHECK: dead $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $al
; CHECK: RETQ $eax
; CHECK: bb.6:
; CHECK: successors: %bb.1(0x30000000), %bb.7(0x50000000)
; CHECK: $rax = MOV64rm $r14, 1, $noreg, 0, $noreg :: (load 8)
; CHECK: TEST64rr $rax, $rax, implicit-def $eflags
; CHECK: JCC_1 %bb.1, 4, implicit $eflags
; CHECK: bb.7 (align 16):
; CHECK: successors: %bb.8(0x71555555), %bb.4(0x0eaaaaab)
; CHECK: CMP64mi8 killed $rax, 1, $noreg, 8, $noreg, 0, implicit-def $eflags :: (load 8), (load 8)
; CHECK: JCC_1 %bb.4, 5, implicit $eflags
; CHECK: bb.8:
; CHECK: successors: %bb.1(0x04000000), %bb.7(0x7c000000)
; CHECK: $rax = MOV64rm $r14, 1, $noreg, 0, $noreg :: (load 8)
; CHECK: TEST64rr $rax, $rax, implicit-def $eflags
; CHECK: JCC_1 %bb.7, 5, implicit $eflags
; CHECK: bb.1:
; CHECK: $ebp = XOR32rr undef $ebp, undef $ebp, implicit-def dead $eflags
; CHECK: RETQ $eax
bb.0:
successors: %bb.1(0x40000000), %bb.7(0x40000000)
TEST8ri $dl, 1, implicit-def $eflags, implicit killed $edx
JCC_1 %bb.7, 4, implicit $eflags
bb.1:
successors: %bb.16(0x80000000)
$ebp = XOR32rr undef $ebp, undef $ebp, implicit-def dead $eflags
JMP_1 %bb.16
bb.7:
successors: %bb.8(0x30000000), %bb.9(0x50000000)
$rax = MOV64rm $r14, 1, $noreg, 0, $noreg :: (load 8)
TEST64rr $rax, $rax, implicit-def $eflags
JCC_1 %bb.9, 5, implicit killed $eflags
bb.8:
successors: %bb.16(0x80000000)
$ebp = XOR32rr undef $ebp, undef $ebp, implicit-def dead $eflags
JMP_1 %bb.16
bb.9:
successors: %bb.10(0x30000000), %bb.15(0x50000000)
CMP64mi8 killed $rax, 1, $noreg, 8, $noreg, 0, implicit-def $eflags :: (load 8)
JCC_1 %bb.15, 5, implicit $eflags
bb.10:
successors: %bb.11(0x30000000), %bb.12(0x50000000)
$rax = MOV64rm $r14, 1, $noreg, 0, $noreg :: (load 8)
TEST64rr $rax, $rax, implicit-def $eflags
JCC_1 %bb.12, 5, implicit $eflags
bb.11:
successors: %bb.16(0x80000000)
$ebp = XOR32rr undef $ebp, undef $ebp, implicit-def dead $eflags
JMP_1 %bb.16
bb.12:
successors: %bb.13(0x71555555), %bb.15(0x0eaaaaab)
CMP64mi8 killed $rax, 1, $noreg, 8, $noreg, 0, implicit-def $eflags :: (load 8), (load 8)
JCC_1 %bb.15, 5, implicit $eflags
bb.13:
successors: %bb.14(0x04000000), %bb.12(0x7c000000)
$rax = MOV64rm $r14, 1, $noreg, 0, $noreg :: (load 8)
TEST64rr $rax, $rax, implicit-def $eflags
JCC_1 %bb.12, 5, implicit $eflags
bb.14:
successors: %bb.16(0x80000000)
$ebp = XOR32rr undef $ebp, undef $ebp, implicit-def dead $eflags
JMP_1 %bb.16
bb.15:
successors: %bb.16(0x80000000)
$ebp = XOR32rr undef $ebp, undef $ebp, implicit-def dead $eflags
dead $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $al
bb.16:
RETQ $eax
...