[llvm] 1670e0e - [CodeGen] Move function splitting tests from X86 to Generic (NFC)
Daniel Hoekwater via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 15 18:33:00 PDT 2023
Author: Daniel Hoekwater
Date: 2023-08-16T01:25:54Z
New Revision: 1670e0ea076b12b3fcea2ea63f01bc09e0e7f3b2
URL: https://github.com/llvm/llvm-project/commit/1670e0ea076b12b3fcea2ea63f01bc09e0e7f3b2
DIFF: https://github.com/llvm/llvm-project/commit/1670e0ea076b12b3fcea2ea63f01bc09e0e7f3b2.diff
LOG: [CodeGen] Move function splitting tests from X86 to Generic (NFC)
Machine function splitting will become available for AArch64; since MFS
is no longer X86-only, the tests for generic behavior should live
somewhere other than tests/CodeGen/X86.
MFS implementation doesn't vary much across platforms, and most tests
should be identical between X86 and AArch64 besides instruction
selection, so the tests can live together in tests/CodeGen/Generic.
Differential Revision: https://reviews.llvm.org/D157563
Added:
llvm/test/CodeGen/Generic/machine-function-splitter.ll
Modified:
Removed:
llvm/test/CodeGen/X86/machine-function-splitter.ll
################################################################################
diff --git a/llvm/test/CodeGen/X86/machine-function-splitter.ll b/llvm/test/CodeGen/Generic/machine-function-splitter.ll
similarity index 76%
rename from llvm/test/CodeGen/X86/machine-function-splitter.ll
rename to llvm/test/CodeGen/Generic/machine-function-splitter.ll
index 03c0f93b342d70..e65f74210baf44 100644
--- 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 @foo3(i1 zeroext %0) nounwind !section_prefix !15 {
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 @foo4(i1 zeroext %0, i1 zeroext %1) nounwind !prof !20 {
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 void @foo6(i1 zeroext %0) nounwind section "nosplit" !prof !14 {
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", at progbits
-; MFS-DEFAULTS-NEXT: foo7.cold:
-; MFS-DEFAULTS: callq baz
-; MFS-DEFAULTS: callq _Unwind_Resume at PLT
+; MFS-DEFAULTS-LABEL: foo7
+; MFS-DEFAULTS: .section .text.split.foo7,"ax", at progbits
+; MFS-DEFAULTS-NEXT: foo7.cold:
+; MFS-DEFAULTS-X86: callq baz
+; MFS-DEFAULTS-X86: callq _Unwind_Resume at PLT
entry:
invoke void @_Z1fv()
to label %try.cont unwind label %lpad
@@ -188,20 +191,20 @@ try.cont:
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 at PLT
-; MFS-DEFAULTS: callq _Unwind_Resume at PLT
-; MFS-DEFAULTS: .section .text.split.foo8,"ax", at progbits
-; MFS-DEFAULTS-NEXT: foo8.cold:
-; MFS-DEFAULTS: callq baz
+; MFS-DEFAULTS-LABEL: foo8
+; MFS-DEFAULTS-X86: callq _Unwind_Resume at PLT
+; MFS-DEFAULTS-X86: callq _Unwind_Resume at PLT
+; MFS-DEFAULTS: .section .text.split.foo8,"ax", at 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", at progbits
-; MFS-EH-SPLIT-NEXT: foo8.cold:
-; MFS-EH-SPLIT: callq _Unwind_Resume at PLT
-; MFS-EH-SPLIT: callq _Unwind_Resume at PLT
+; MFS-EH-SPLIT-LABEL: foo8
+; MFS-EH-SPLIT-X86: callq baz
+; MFS-EH-SPLIT: .section .text.split.foo8,"ax", at progbits
+; MFS-EH-SPLIT-NEXT: foo8.cold:
+; MFS-EH-SPLIT-X86: callq _Unwind_Resume at PLT
+; MFS-EH-SPLIT-X86: callq _Unwind_Resume at PLT
entry:
invoke void @_Z1fv()
to label %try.cont unwind label %lpad1
@@ -256,12 +259,12 @@ define void @foo9(i1 zeroext %0) nounwind #0 !prof !14 {
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", at progbits
-; MFS-DEFAULTS-NEXT: foo10.cold:
-; MFS-DEFAULTS: nop
-; MFS-DEFAULTS: callq _Unwind_Resume at PLT
+; MFS-DEFAULTS-LABEL: foo10
+; MFS-DEFAULTS-X86-LABEL: callq baz
+; MFS-DEFAULTS: .section .text.split.foo10,"ax", at progbits
+; MFS-DEFAULTS-NEXT: foo10.cold:
+; MFS-DEFAULTS-X86: nop
+; MFS-DEFAULTS-X86: callq _Unwind_Resume at PLT
entry:
invoke void @_Z1fv()
to label %try.cont unwind label %lpad, !prof !17
@@ -280,11 +283,11 @@ try.cont:
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", at progbits
-; MFS-EH-SPLIT-NEXT: foo11.cold:
-; MFS-EH-SPLIT: nop
-; MFS-EH-SPLIT: callq _Unwind_Resume at PLT
+; MFS-EH-SPLIT-LABEL: foo11
+; MFS-EH-SPLIT: .section .text.split.foo11,"ax", at progbits
+; MFS-EH-SPLIT-NEXT: foo11.cold:
+; MFS-EH-SPLIT-X86: nop
+; MFS-EH-SPLIT-X86: callq _Unwind_Resume at PLT
entry:
invoke void @_Z1fv()
to label %2 unwind label %lpad
@@ -302,12 +305,12 @@ lpad:
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", at 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", at 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 @@ define i32 @foo13(i1 zeroext %0) personality ptr @__gxx_personality_v0 !prof !14
;; 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", at 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", at 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
More information about the llvm-commits
mailing list