|
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
|
@@ -610,6 +619,61 @@ cold_asm_target:
|
610 | 619 | ret void
|
611 | 620 | }
|
612 | 621 |
|
| 622 | +define void @foo21(i1 zeroext %0) { |
| 623 | +;; Check that a function with basic-block-sections profile (but no pgo profile) |
| 624 | +;; is properly split when the profile is used along with mfs. |
| 625 | +; MFS-BBSECTIONS: .section .text.hot.foo21 |
| 626 | +; MFS-NOBBSECTIONS-NOT: .section .text.hot.foo21 |
| 627 | +; MFS-BBSECTIONS-LABEL: foo21: |
| 628 | +; MFS-NOBBSECTIONS-NOT: foo21.cold: |
| 629 | +; MFS-BBSECTIONS: .section .text.split.foo21 |
| 630 | +; MFS-BBSECTIONS: foo21.cold |
| 631 | + %2 = alloca i8, align 1 |
| 632 | + %3 = zext i1 %0 to i8 |
| 633 | + store i8 %3, ptr %2, align 1 |
| 634 | + %4 = load i8, ptr %2, align 1 |
| 635 | + %5 = trunc i8 %4 to i1 |
| 636 | + br i1 %5, label %6, label %8 |
| 637 | + |
| 638 | +6: ; preds = %1 |
| 639 | + %7 = call i32 @bar() |
| 640 | + br label %10 |
| 641 | + |
| 642 | +8: ; preds = %1 |
| 643 | + %9 = call i32 @baz() |
| 644 | + br label %10 |
| 645 | + |
| 646 | +10: ; preds = %8, %6 |
| 647 | + ret void |
| 648 | +} |
| 649 | + |
| 650 | +define void @foo22(i1 zeroext %0) nounwind !prof !14 !section_prefix !15 { |
| 651 | +;; Check that when a function has both basic-block-section and pgo profiles |
| 652 | +;; only the basic-block-section profile is used for splitting. |
| 653 | + |
| 654 | +;; Check that we create two hot sections with -basic-block-sections. |
| 655 | +; MFS-BBSECTIONS: .section .text.hot.foo22 |
| 656 | +; MFS-BBSECTIONS-LABEL: foo22: |
| 657 | +; MFS-BBSECTIONS: callq bar |
| 658 | +; MFS-BBSECTIONS: .section .text.hot.foo22 |
| 659 | +; MFS-BBSECTIONS-NEXT: foo22.__part.1: |
| 660 | +; MFS-BBSECTIONS: callq baz |
| 661 | +; MFS-BBSECTIONS-NOT: .section .text.split.foo22 |
| 662 | + br i1 %0, label %2, label %4, !prof !17 |
| 663 | + |
| 664 | +2: ; preds = %1 |
| 665 | + %3 = call i32 @bar() |
| 666 | + br label %6 |
| 667 | + |
| 668 | +4: ; preds = %1 |
| 669 | + %5 = call i32 @baz() |
| 670 | + br label %6 |
| 671 | + |
| 672 | +6: ; preds = %4, %2 |
| 673 | + %7 = tail call i32 @qux() |
| 674 | + ret void |
| 675 | +} |
| 676 | + |
613 | 677 | declare i32 @bar()
|
614 | 678 | declare i32 @baz()
|
615 | 679 | declare i32 @bam()
|
|
0 commit comments