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 +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -split-machine-functions | FileCheck %s -check-prefixes=MFS-DEFAULTS,MFS-DEFAULTS-X86 +; 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 +; 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 +; 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 + +; COM: Machine function splitting with AFDO profiles ; 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 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-DEFAULTS-LABEL: foo1 +; MFS-DEFAULTS: .section .text.split.foo1 +; MFS-DEFAULTS-NEXT: foo1.cold: +; MFS-DEFAULTS-X86-NOT: callq bar +; MFS-DEFAULTS-X86-NEXT: callq baz br i1 %0, label %2, label %4, !prof !17 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-OPTS1-LABEL: foo4 +; MFS-OPTS1: .section .text.split.foo4 +; MFS-OPTS1-NEXT: foo4.cold: +; MFS-OPTS1-X86-NOT: callq bar +; MFS-OPTS1-X86-NOT: callq baz +; MFS-OPTS1-X86-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-OPTS2-LABEL: foo5 +; MFS-OPTS2: .section .text.split.foo5 +; MFS-OPTS2-NEXT: foo5.cold: +; MFS-OPTS2-X86-NOT: callq bar +; MFS-OPTS2-X86-NOT: callq baz +; MFS-OPTS2-X86-NEXT: callq bam br i1 %0, label %3, label %7, !prof !21 3: @@ -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-DEFAULTS-LABEL: foo7 +; MFS-DEFAULTS: .section .text.split.foo7,"ax",@progbits +; MFS-DEFAULTS-NEXT: foo7.cold: +; MFS-DEFAULTS-X86: callq baz +; MFS-DEFAULTS-X86: 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-DEFAULTS-LABEL: foo8 +; MFS-DEFAULTS-X86: callq _Unwind_Resume@PLT +; MFS-DEFAULTS-X86: callq _Unwind_Resume@PLT +; MFS-DEFAULTS: .section .text.split.foo8,"ax",@progbits +; MFS-DEFAULTS-NEXT: foo8.cold: +; MFS-DEFAULTS-X86: 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-EH-SPLIT-LABEL: foo8 +; MFS-EH-SPLIT-X86: callq baz +; MFS-EH-SPLIT: .section .text.split.foo8,"ax",@progbits +; MFS-EH-SPLIT-NEXT: foo8.cold: +; MFS-EH-SPLIT-X86: callq _Unwind_Resume@PLT +; MFS-EH-SPLIT-X86: callq _Unwind_Resume@PLT entry: invoke void @_Z1fv() to label %try.cont unwind label %lpad1 @@ -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-DEFAULTS-LABEL: foo10 +; MFS-DEFAULTS-X86-LABEL: callq baz +; MFS-DEFAULTS: .section .text.split.foo10,"ax",@progbits +; MFS-DEFAULTS-NEXT: foo10.cold: +; MFS-DEFAULTS-X86: nop +; MFS-DEFAULTS-X86: 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-EH-SPLIT-LABEL: foo11 +; MFS-EH-SPLIT: .section .text.split.foo11,"ax",@progbits +; MFS-EH-SPLIT-NEXT: foo11.cold: +; MFS-EH-SPLIT-X86: nop +; MFS-EH-SPLIT-X86: 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-EH-SPLIT-LABEL: foo12 +; MFS-EH-SPLIT: .section .text.split.foo12,"ax",@progbits +; MFS-EH-SPLIT-NEXT: foo12.cold: +; MFS-EH-SPLIT-X86: callq bar +; MFS-EH-SPLIT-X86: callq baz +; MFS-EH-SPLIT-X86: 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-EH-SPLIT-LABEL: foo13 +; MFS-EH-SPLIT-X86: callq bam +; MFS-EH-SPLIT: .section .text.split.foo13,"ax",@progbits +; MFS-EH-SPLIT-NEXT: foo13.cold: +; MFS-EH-SPLIT-X86: callq baz +; MFS-EH-SPLIT-X86: callq bar +; MFS-EH-SPLIT-X86: callq qux entry: invoke void @_Z1fv() to label %try.cont unwind label %lpad, !prof !17