|
2 | 2 | ; REQUIRES: x86-registered-target |
3 | 3 |
|
4 | 4 | ; COM: Machine function splitting with FDO profiles |
5 | | -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s -check-prefixes=MFS-DEFAULTS,MFS-DEFAULTS-X86 |
| 5 | +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s -check-prefixes=MFS-DEFAULTS,MFS-DEFAULTS-X86,MFS-NOBBSECTIONS |
6 | 6 | ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions -mfs-psi-cutoff=0 -mfs-count-threshold=2000 | FileCheck %s --dump-input=always -check-prefixes=MFS-OPTS1,MFS-OPTS1-X86 |
7 | 7 | ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions -mfs-psi-cutoff=950000 | FileCheck %s -check-prefixes=MFS-OPTS2,MFS-OPTS2-X86 |
8 | 8 | ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions -mfs-split-ehcode | FileCheck %s -check-prefixes=MFS-EH-SPLIT,MFS-EH-SPLIT-X86 |
9 | 9 | ; RUN: llc < %s -mtriple=x86_64 -split-machine-functions -O0 -mfs-psi-cutoff=0 -mfs-count-threshold=10000 | FileCheck %s -check-prefixes=MFS-O0,MFS-O0-X86 |
10 | 10 |
|
| 11 | +; COM: Machine function splitting along with -basic-block-sections profile |
| 12 | +; RUN: echo 'v1' > %t |
| 13 | +; RUN: echo 'ffoo21' >> %t |
| 14 | +; RUN: echo 'c0' >> %t |
| 15 | +; RUN: echo 'ffoo22' >> %t |
| 16 | +; RUN: echo 'c0 1' >> %t |
| 17 | +; RUN: echo 'c2' >> %t |
| 18 | +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -basic-block-sections=%t -split-machine-functions | FileCheck %s --check-prefixes=MFS-BBSECTIONS |
| 19 | + |
11 | 20 | ; RUN: llc < %s -mtriple=aarch64-unknown-linux-gnu -aarch64-min-jump-table-entries=4 -enable-split-machine-functions | FileCheck %s -check-prefixes=MFS-DEFAULTS,MFS-DEFAULTS-AARCH64 |
12 | 21 | ; RUN: llc < %s -mtriple=aarch64-unknown-linux-gnu -aarch64-min-jump-table-entries=4 -enable-split-machine-functions -mfs-psi-cutoff=0 -mfs-count-threshold=2000 | FileCheck %s --dump-input=always -check-prefixes=MFS-OPTS1,MFS-OPTS1-AARCH64 |
13 | 22 | ; RUN: llc < %s -mtriple=aarch64-unknown-linux-gnu -aarch64-min-jump-table-entries=4 -enable-split-machine-functions -mfs-psi-cutoff=950000 | FileCheck %s -check-prefixes=MFS-OPTS2,MFS-OPTS2-AARCH64 |
|
20 | 29 | ; RUN: llc < %t.ll -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s --check-prefix=FSAFDO-MFS |
21 | 30 | ; RUN: llc < %t.ll -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s --check-prefix=FSAFDO-MFS2 |
22 | 31 |
|
| 32 | + |
23 | 33 | define void @foo1(i1 zeroext %0) nounwind !prof !14 !section_prefix !15 { |
24 | 34 | ;; Check that cold block is moved to .text.split. |
25 | 35 | ; MFS-DEFAULTS-LABEL: foo1 |
@@ -610,6 +620,63 @@ cold_asm_target: |
610 | 620 | ret void |
611 | 621 | } |
612 | 622 |
|
| 623 | +define void @foo21(i1 zeroext %0) { |
| 624 | +;; Check that a function with basic-block-sections profile (but no pgo profile) |
| 625 | +;; is properly split when the profile is used along with mfs. |
| 626 | +; MFS-BBSECTIONS: .section .text.hot.foo21 |
| 627 | +; MFS-NOBBSECTIONS-NOT: .section .text.hot.foo21 |
| 628 | +; MFS-BBSECTIONS-LABEL: foo21: |
| 629 | +; MFS-NOBBSECTIONS-NOT: foo21.cold: |
| 630 | +; MFS-BBSECTIONS: .section .text.split.foo21 |
| 631 | +; MFS-BBSECTIONS: foo21.cold |
| 632 | + %2 = alloca i8, align 1 |
| 633 | + %3 = zext i1 %0 to i8 |
| 634 | + store i8 %3, ptr %2, align 1 |
| 635 | + %4 = load i8, ptr %2, align 1 |
| 636 | + %5 = trunc i8 %4 to i1 |
| 637 | + br i1 %5, label %6, label %8 |
| 638 | + |
| 639 | +6: ; preds = %1 |
| 640 | + %7 = call i32 @bar() |
| 641 | + br label %10 |
| 642 | + |
| 643 | +8: ; preds = %1 |
| 644 | + %9 = call i32 @baz() |
| 645 | + br label %10 |
| 646 | + |
| 647 | +10: ; preds = %8, %6 |
| 648 | + ret void |
| 649 | +} |
| 650 | + |
| 651 | +define void @foo22(i1 zeroext %0) nounwind !prof !14 !section_prefix !15 { |
| 652 | +;; Check that when a function has both basic-block-section and pgo profiles |
| 653 | +;; only the basic-block-section profile is used for splitting. |
| 654 | + |
| 655 | +;; Check that we create two hot sections with -basic-block-sections. |
| 656 | +; MFS-BBSECTIONS: .section .text.hot.foo22 |
| 657 | +; MFS-BBSECTIONS-LABEL: foo22: |
| 658 | +; MFS-BBSECTIONS: callq bar |
| 659 | +; MFS-BBSECTIONS: .section .text.hot.foo22 |
| 660 | +; MFS-BBSECTIONS-NEXT: foo22.__part.1: |
| 661 | +; MFS-BBSECTIONS: callq baz |
| 662 | +; MFS-BBSECTIONS-NOT: .section .text.split.foo22 |
| 663 | + br i1 %0, label %2, label %4, !prof !17 |
| 664 | + |
| 665 | +2: ; preds = %1 |
| 666 | + %3 = call i32 @bar() |
| 667 | + br label %6 |
| 668 | + |
| 669 | +4: ; preds = %1 |
| 670 | + %5 = call i32 @baz() |
| 671 | + br label %6 |
| 672 | + |
| 673 | +6: ; preds = %4, %2 |
| 674 | + %7 = tail call i32 @qux() |
| 675 | + ret void |
| 676 | +} |
| 677 | + |
| 678 | + |
| 679 | + |
613 | 680 | declare i32 @bar() |
614 | 681 | declare i32 @baz() |
615 | 682 | declare i32 @bam() |
|
0 commit comments