diff --git a/llvm/test/CodeGen/X86/machine-function-splitter.ll b/llvm/test/CodeGen/Generic/machine-function-splitter.ll rename from llvm/test/CodeGen/X86/machine-function-splitter.ll rename to llvm/test/CodeGen/Generic/machine-function-splitter.ll --- a/llvm/test/CodeGen/X86/machine-function-splitter.ll +++ b/llvm/test/CodeGen/Generic/machine-function-splitter.ll @@ -1,18 +1,21 @@ -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s -check-prefix=MFS-DEFAULTS -; 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-prefix=MFS-OPTS1 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions -mfs-psi-cutoff=950000 | FileCheck %s -check-prefix=MFS-OPTS2 -; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions -mfs-split-ehcode | FileCheck %s -check-prefix=MFS-EH-SPLIT +; COM: Machine function splitting with FDO profiles on X86 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s -check-prefix=MFS-X86-DEFAULTS +; 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-prefix=MFS-X86-OPTS1 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions -mfs-psi-cutoff=950000 | FileCheck %s -check-prefix=MFS-X86-OPTS2 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions -mfs-split-ehcode | FileCheck %s -check-prefix=MFS-X86-EH-SPLIT + ; RUN: sed 's/InstrProf/SampleProfile/g' %s > %t.ll -; RUN: llc < %t.ll -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s --check-prefix=FSAFDO-MFS -; RUN: llc < %t.ll -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s --check-prefix=FSAFDO-MFS2 +; COM: Machine function splitting with AFDO profiles on X86 +; RUN: llc < %t.ll -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s --check-prefix=FSAFDO-X86-MFS +; RUN: llc < %t.ll -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s --check-prefix=FSAFDO-X86-MFS2 define void @foo1(i1 zeroext %0) nounwind !prof !14 !section_prefix !15 { ;; Check that cold block is moved to .text.split. -; MFS-DEFAULTS-LABEL: foo1 -; MFS-DEFAULTS: .section .text.split.foo1 -; MFS-DEFAULTS-NEXT: foo1.cold: -; MFS-DEFAULTS-NOT: callq bar -; MFS-DEFAULTS-NEXT: callq baz +; MFS-X86-DEFAULTS-LABEL: foo1 +; MFS-X86-DEFAULTS: .section .text.split.foo1 +; MFS-X86-DEFAULTS-NEXT: foo1.cold: +; MFS-X86-DEFAULTS-NOT: callq bar +; MFS-X86-DEFAULTS-NEXT: callq baz br i1 %0, label %2, label %4, !prof !17 2: ; preds = %1 @@ -30,8 +33,8 @@ define void @foo2(i1 zeroext %0) nounwind !prof !23 !section_prefix !16 { ;; Check that function marked unlikely is not split. -; MFS-DEFAULTS-LABEL: foo2 -; MFS-DEFAULTS-NOT: foo2.cold: +; MFS-X86-DEFAULTS-LABEL: foo2 +; MFS-X86-DEFAULTS-NOT: foo2.cold: br i1 %0, label %2, label %4, !prof !17 2: ; preds = %1 @@ -49,8 +52,8 @@ define void @foo3(i1 zeroext %0) nounwind !section_prefix !15 { ;; Check that function without profile data is not split. -; MFS-DEFAULTS-LABEL: foo3 -; MFS-DEFAULTS-NOT: foo3.cold: +; MFS-X86-DEFAULTS-LABEL: foo3 +; MFS-X86-DEFAULTS-NOT: foo3.cold: br i1 %0, label %2, label %4 2: ; preds = %1 @@ -68,12 +71,12 @@ define void @foo4(i1 zeroext %0, i1 zeroext %1) nounwind !prof !20 { ;; Check that count threshold works. -; MFS-OPTS1-LABEL: foo4 -; MFS-OPTS1: .section .text.split.foo4 -; MFS-OPTS1-NEXT: foo4.cold: -; MFS-OPTS1-NOT: callq bar -; MFS-OPTS1-NOT: callq baz -; MFS-OPTS1-NEXT: callq bam +; MFS-X86-OPTS1-LABEL: foo4 +; MFS-X86-OPTS1: .section .text.split.foo4 +; MFS-X86-OPTS1-NEXT: foo4.cold: +; MFS-X86-OPTS1-NOT: callq bar +; MFS-X86-OPTS1-NOT: callq baz +; MFS-X86-OPTS1-NEXT: callq bam br i1 %0, label %3, label %7, !prof !18 3: @@ -102,12 +105,12 @@ define void @foo5(i1 zeroext %0, i1 zeroext %1) nounwind !prof !20 { ;; Check that profile summary info cutoff works. -; MFS-OPTS2-LABEL: foo5 -; MFS-OPTS2: .section .text.split.foo5 -; MFS-OPTS2-NEXT: foo5.cold: -; MFS-OPTS2-NOT: callq bar -; MFS-OPTS2-NOT: callq baz -; MFS-OPTS2-NEXT: callq bam +; MFS-X86-OPTS2-LABEL: foo5 +; MFS-X86-OPTS2: .section .text.split.foo5 +; MFS-X86-OPTS2-NEXT: foo5.cold: +; MFS-X86-OPTS2-NOT: callq bar +; MFS-X86-OPTS2-NOT: callq baz +; MFS-X86-OPTS2-NEXT: callq bam br i1 %0, label %3, label %7, !prof !21 3: @@ -136,8 +139,8 @@ define void @foo6(i1 zeroext %0) nounwind section "nosplit" !prof !14 { ;; Check that function with section attribute is not split. -; MFS-DEFAULTS-LABEL: foo6 -; MFS-DEFAULTS-NOT: foo6.cold: +; MFS-X86-DEFAULTS-LABEL: foo6 +; MFS-X86-DEFAULTS-NOT: foo6.cold: br i1 %0, label %2, label %4, !prof !17 2: ; preds = %1 @@ -155,11 +158,11 @@ define i32 @foo7(i1 zeroext %0) personality ptr @__gxx_personality_v0 !prof !14 { ;; Check that a single cold ehpad is split out. -; MFS-DEFAULTS-LABEL: foo7 -; MFS-DEFAULTS: .section .text.split.foo7,"ax",@progbits -; MFS-DEFAULTS-NEXT: foo7.cold: -; MFS-DEFAULTS: callq baz -; MFS-DEFAULTS: callq _Unwind_Resume@PLT +; MFS-X86-DEFAULTS-LABEL: foo7 +; MFS-X86-DEFAULTS: .section .text.split.foo7,"ax",@progbits +; MFS-X86-DEFAULTS-NEXT: foo7.cold: +; MFS-X86-DEFAULTS: callq baz +; MFS-X86-DEFAULTS: callq _Unwind_Resume@PLT entry: invoke void @_Z1fv() to label %try.cont unwind label %lpad @@ -188,20 +191,20 @@ define i32 @foo8(i1 zeroext %0) personality ptr @__gxx_personality_v0 !prof !14 { ;; Check that all ehpads are treated as hot if one of them is hot. -; MFS-DEFAULTS-LABEL: foo8 -; MFS-DEFAULTS: callq _Unwind_Resume@PLT -; MFS-DEFAULTS: callq _Unwind_Resume@PLT -; MFS-DEFAULTS: .section .text.split.foo8,"ax",@progbits -; MFS-DEFAULTS-NEXT: foo8.cold: -; MFS-DEFAULTS: callq baz +; MFS-X86-DEFAULTS-LABEL: foo8 +; MFS-X86-DEFAULTS: callq _Unwind_Resume@PLT +; MFS-X86-DEFAULTS: callq _Unwind_Resume@PLT +; MFS-X86-DEFAULTS: .section .text.split.foo8,"ax",@progbits +; MFS-X86-DEFAULTS-NEXT: foo8.cold: +; MFS-X86-DEFAULTS: callq baz ;; Check that all ehpads are by default treated as cold with -mfs-split-ehcode. -; MFS-EH-SPLIT-LABEL: foo8 -; MFS-EH-SPLIT: callq baz -; MFS-EH-SPLIT: .section .text.split.foo8,"ax",@progbits -; MFS-EH-SPLIT-NEXT: foo8.cold: -; MFS-EH-SPLIT: callq _Unwind_Resume@PLT -; MFS-EH-SPLIT: callq _Unwind_Resume@PLT +; MFS-X86-EH-SPLIT-LABEL: foo8 +; MFS-X86-EH-SPLIT: callq baz +; MFS-X86-EH-SPLIT: .section .text.split.foo8,"ax",@progbits +; MFS-X86-EH-SPLIT-NEXT: foo8.cold: +; MFS-X86-EH-SPLIT: callq _Unwind_Resume@PLT +; MFS-X86-EH-SPLIT: callq _Unwind_Resume@PLT entry: invoke void @_Z1fv() to label %try.cont unwind label %lpad1 @@ -237,8 +240,8 @@ define void @foo9(i1 zeroext %0) nounwind #0 !prof !14 { ;; Check that function with section attribute is not split. -; MFS-DEFAULTS-LABEL: foo9 -; MFS-DEFAULTS-NOT: foo9.cold: +; MFS-X86-DEFAULTS-LABEL: foo9 +; MFS-X86-DEFAULTS-NOT: foo9.cold: br i1 %0, label %2, label %4, !prof !17 2: ; preds = %1 @@ -256,12 +259,12 @@ define i32 @foo10(i1 zeroext %0) personality ptr @__gxx_personality_v0 !prof !14 { ;; Check that nop is inserted just before the EH pad if it's beginning a section. -; MFS-DEFAULTS-LABEL: foo10 -; MFS-DEFAULTS-LABEL: callq baz -; MFS-DEFAULTS: .section .text.split.foo10,"ax",@progbits -; MFS-DEFAULTS-NEXT: foo10.cold: -; MFS-DEFAULTS: nop -; MFS-DEFAULTS: callq _Unwind_Resume@PLT +; MFS-X86-DEFAULTS-LABEL: foo10 +; MFS-X86-DEFAULTS-LABEL: callq baz +; MFS-X86-DEFAULTS: .section .text.split.foo10,"ax",@progbits +; MFS-X86-DEFAULTS-NEXT: foo10.cold: +; MFS-X86-DEFAULTS: nop +; MFS-X86-DEFAULTS: callq _Unwind_Resume@PLT entry: invoke void @_Z1fv() to label %try.cont unwind label %lpad, !prof !17 @@ -280,11 +283,11 @@ define void @foo11(i1 zeroext %0) personality ptr @__gxx_personality_v0 { ;; Check that function having landing pads are split with mfs-split-ehcode ;; even in the absence of profile data -; MFS-EH-SPLIT-LABEL: foo11 -; MFS-EH-SPLIT: .section .text.split.foo11,"ax",@progbits -; MFS-EH-SPLIT-NEXT: foo11.cold: -; MFS-EH-SPLIT: nop -; MFS-EH-SPLIT: callq _Unwind_Resume@PLT +; MFS-X86-EH-SPLIT-LABEL: foo11 +; MFS-X86-EH-SPLIT: .section .text.split.foo11,"ax",@progbits +; MFS-X86-EH-SPLIT-NEXT: foo11.cold: +; MFS-X86-EH-SPLIT: nop +; MFS-X86-EH-SPLIT: callq _Unwind_Resume@PLT entry: invoke void @_Z1fv() to label %2 unwind label %lpad @@ -302,12 +305,12 @@ define i32 @foo12(i1 zeroext %0) personality ptr @__gxx_personality_v0 !prof !14 { ;; Check that all code reachable from ehpad is split out with cycles. -; MFS-EH-SPLIT-LABEL: foo12 -; MFS-EH-SPLIT: .section .text.split.foo12,"ax",@progbits -; MFS-EH-SPLIT-NEXT: foo12.cold: -; MFS-EH-SPLIT: callq bar -; MFS-EH-SPLIT: callq baz -; MFS-EH-SPLIT: callq qux +; MFS-X86-EH-SPLIT-LABEL: foo12 +; MFS-X86-EH-SPLIT: .section .text.split.foo12,"ax",@progbits +; MFS-X86-EH-SPLIT-NEXT: foo12.cold: +; MFS-X86-EH-SPLIT: callq bar +; MFS-X86-EH-SPLIT: callq baz +; MFS-X86-EH-SPLIT: callq qux entry: invoke void @_Z1fv() to label %8 unwind label %lpad @@ -338,13 +341,13 @@ ;; Check that all code reachable from EH ;; that is also reachable from outside EH pad ;; is not touched. -; MFS-EH-SPLIT-LABEL: foo13 -; MFS-EH-SPLIT: callq bam -; MFS-EH-SPLIT: .section .text.split.foo13,"ax",@progbits -; MFS-EH-SPLIT-NEXT: foo13.cold: -; MFS-EH-SPLIT: callq baz -; MFS-EH-SPLIT: callq bar -; MFS-EH-SPLIT: callq qux +; MFS-X86-EH-SPLIT-LABEL: foo13 +; MFS-X86-EH-SPLIT: callq bam +; MFS-X86-EH-SPLIT: .section .text.split.foo13,"ax",@progbits +; MFS-X86-EH-SPLIT-NEXT: foo13.cold: +; MFS-X86-EH-SPLIT: callq baz +; MFS-X86-EH-SPLIT: callq bar +; MFS-X86-EH-SPLIT: callq qux entry: invoke void @_Z1fv() to label %try.cont unwind label %lpad, !prof !17 @@ -373,8 +376,8 @@ } define void @foo14(i1 zeroext %0, i1 zeroext %1) nounwind !prof !24 { -; FSAFDO-MFS: .section .text.split.foo14,"ax" -; FSAFDO-MFS: foo14.cold: +; FSAFDO-X86-MFS: .section .text.split.foo14,"ax" +; FSAFDO-X86-MFS: foo14.cold: br i1 %0, label %3, label %7, !prof !25 3: @@ -404,8 +407,8 @@ define void @foo15(i1 zeroext %0, i1 zeroext %1) nounwind !prof !27 { ;; HasAccurateProfile is false, foo15 is hot, but no profile data for ;; blocks, no split should happen. -; FSAFDO-MFS2-NOT: .section .text.split.foo15,"ax" -; FSAFDO-MFS2-NOT: foo15.cold: +; FSAFDO-X86-MFS2-NOT: .section .text.split.foo15,"ax" +; FSAFDO-X86-MFS2-NOT: foo15.cold: br i1 %0, label %3, label %7 3: