-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[NFC]In codegen pipeline, turn static-data-splitter pass on/off with its own option #134752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NFC]In codegen pipeline, turn static-data-splitter pass on/off with its own option #134752
Conversation
@llvm/pr-subscribers-backend-aarch64 Author: Mingming Liu (mingmingl-llvm) ChangesPer discussion in #129781 (comment), we'd like to refactor out the requirement of MFS. Full diff: https://github.com/llvm/llvm-project/pull/134752.diff 5 Files Affected:
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index fa1bb84ec5319..45fae653e4181 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1235,13 +1235,11 @@ void TargetPassConfig::addMachinePasses() {
addPass(createMIRAddFSDiscriminatorsPass(
sampleprof::FSDiscriminatorPass::PassLast));
- // Machine function splitter uses the basic block sections feature.
- // When used along with `-basic-block-sections=`, the basic-block-sections
- // feature takes precedence. This means functions eligible for
- // basic-block-sections optimizations (`=all`, or `=list=` with function
- // included in the list profile) will get that optimization instead.
- if (TM->Options.EnableMachineFunctionSplitter ||
- EnableMachineFunctionSplitter) {
+ bool MIRProfileLoaderPassEnabled = false;
+ auto EnableMIRProfileLoaderPass = [&]() {
+ if (MIRProfileLoaderPassEnabled)
+ return;
+
const std::string ProfileFile = getFSProfileFile(TM);
if (!ProfileFile.empty()) {
if (EnableFSDiscriminator) {
@@ -1256,14 +1254,25 @@ void TargetPassConfig::addMachinePasses() {
"performance.\n";
}
}
+ MIRProfileLoaderPassEnabled = true;
+ };
+ // Machine function splitter uses the basic block sections feature.
+ // When used along with `-basic-block-sections=`, the basic-block-sections
+ // feature takes precedence. This means functions eligible for
+ // basic-block-sections optimizations (`=all`, or `=list=` with function
+ // included in the list profile) will get that optimization instead.
+ if (TM->Options.EnableMachineFunctionSplitter ||
+ EnableMachineFunctionSplitter) {
+ EnableMIRProfileLoaderPass();
addPass(createMachineFunctionSplitterPass());
- if (SplitStaticData || TM->Options.EnableStaticDataPartitioning) {
- // The static data splitter pass is a machine function pass. and
- // static data annotator pass is a module-wide pass. See the file comment
- // in StaticDataAnnotator.cpp for the motivation.
- addPass(createStaticDataSplitterPass());
- addPass(createStaticDataAnnotatorPass());
- }
+ }
+ if (SplitStaticData || TM->Options.EnableStaticDataPartitioning) {
+ EnableMIRProfileLoaderPass();
+ // The static data splitter pass is a machine function pass. and
+ // static data annotator pass is a module-wide pass. See the file comment
+ // in StaticDataAnnotator.cpp for the motivation.
+ addPass(createStaticDataSplitterPass());
+ addPass(createStaticDataAnnotatorPass());
}
// We run the BasicBlockSections pass if either we need BB sections or BB
// address map (or both).
diff --git a/llvm/test/CodeGen/AArch64/constant-pool-partition.ll b/llvm/test/CodeGen/AArch64/constant-pool-partition.ll
index ab627b02a1bc7..d4447131e9de1 100644
--- a/llvm/test/CodeGen/AArch64/constant-pool-partition.ll
+++ b/llvm/test/CodeGen/AArch64/constant-pool-partition.ll
@@ -1,12 +1,10 @@
-; RUN: llc -mtriple=aarch64 -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true \
-; RUN: -unique-section-names=false \
+; RUN: llc -mtriple=aarch64 -partition-static-data-sections \
+; RUN: -function-sections -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --dump-input=always
; Repeat the RUN command above for big-endian systems.
-; RUN: llc -mtriple=aarch64_be -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true \
-; RUN: -unique-section-names=false \
+; RUN: llc -mtriple=aarch64_be -partition-static-data-sections \
+; RUN: -function-sections -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --dump-input=always
; Tests that constant pool hotness is aggregated across the module. The
diff --git a/llvm/test/CodeGen/X86/constant-pool-partition.ll b/llvm/test/CodeGen/X86/constant-pool-partition.ll
index d2c87b7b3fc14..515284fb2cf1a 100644
--- a/llvm/test/CodeGen/X86/constant-pool-partition.ll
+++ b/llvm/test/CodeGen/X86/constant-pool-partition.ll
@@ -10,18 +10,16 @@ target triple = "x86_64-grtev4-linux-gnu"
; 2. Similarly if a constant is accessed by both cold function and un-profiled
; function, constant pools for this constant should not have .unlikely suffix.
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true -data-sections=true \
-; RUN: -unique-section-names=false \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections -data-sections -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --dump-input=always
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true -data-sections=true \
-; RUN: -unique-section-names=true \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections -data-sections -unique-section-names \
; RUN: %s -o - 2>&1 | FileCheck %s --dump-input=always
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=false -data-sections=false \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections=false -data-sections=false \
; RUN: -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --dump-input=always
diff --git a/llvm/test/CodeGen/X86/global-variable-partition.ll b/llvm/test/CodeGen/X86/global-variable-partition.ll
index 91084d038cfe0..ce06d1712f840 100644
--- a/llvm/test/CodeGen/X86/global-variable-partition.ll
+++ b/llvm/test/CodeGen/X86/global-variable-partition.ll
@@ -11,22 +11,22 @@ target triple = "x86_64-unknown-linux-gnu"
; This RUN command sets `-data-sections=true -unique-section-names=true` so data
; sections are uniqufied by numbers.
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -data-sections=true \
-; RUN: -unique-section-names=true -relocation-model=pic \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic \
+; RUN: -partition-static-data-sections=true \
+; RUN: -data-sections=true -unique-section-names=true \
; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=SYM,COMMON --dump-input=always
; This RUN command sets `-data-sections=true -unique-section-names=false` so
; data sections are uniqufied by variable names.
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -data-sections=true \
-; RUN: -unique-section-names=false -relocation-model=pic \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic \
+; RUN: -partition-static-data-sections=true \
+; RUN: -data-sections=true -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=UNIQ,COMMON --dump-input=always
; This RUN command sets `-data-sections=false -unique-section-names=false`.
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -data-sections=false \
-; RUN: -unique-section-names=false -relocation-model=pic \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic \
+; RUN: -partition-static-data-sections=true \
+; RUN: -data-sections=false -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=AGG,COMMON --dump-input=always
; For @.str and @.str.1
@@ -42,19 +42,19 @@ target triple = "x86_64-unknown-linux-gnu"
; For @hot_relro_array
; COMMON: .type hot_relro_array,@object
; SYM-NEXT: .section .data.rel.ro.hot.hot_relro_array
-; UNIQ-NEXT: .section .data.rel.ro.hot.,"aw",@progbits,unique,3
+; UNIQ-NEXT: .section .data.rel.ro.hot.,"aw",@progbits,unique,1
; AGG-NEXT: .section .data.rel.ro.hot.,"aw",@progbits
; For @hot_data, which is accessed by {cold_func, unprofiled_func, hot_func}.
; COMMON: .type hot_data,@object
; SYM-NEXT: .section .data.hot.hot_data,"aw",@progbits
-; UNIQ-NEXT: .section .data.hot.,"aw",@progbits,unique,4
+; UNIQ-NEXT: .section .data.hot.,"aw",@progbits,unique,2
; AGG-NEXT: .section .data.hot.,"aw",@progbits
; For @hot_bss, which is accessed by {unprofiled_func, hot_func}.
; COMMON: .type hot_bss,@object
; SYM-NEXT: .section .bss.hot.hot_bss,"aw",@nobits
-; UNIQ-NEXT: .section .bss.hot.,"aw",@nobits,unique,5
+; UNIQ-NEXT: .section .bss.hot.,"aw",@nobits,unique,3
; AGG-NEXT: .section .bss.hot.,"aw",@nobits
; For @.str.2
@@ -68,13 +68,13 @@ target triple = "x86_64-unknown-linux-gnu"
; For @cold_bss
; COMMON: .type cold_bss,@object
; SYM-NEXT: .section .bss.unlikely.cold_bss,"aw",@nobits
-; UNIQ-NEXT: .section .bss.unlikely.,"aw",@nobits,unique,6
+; UNIQ-NEXT: .section .bss.unlikely.,"aw",@nobits,unique,4
; AGG-NEXT: .section .bss.unlikely.,"aw",@nobits
; For @cold_data
; COMMON: .type cold_data,@object
; SYM-NEXT: .section .data.unlikely.cold_data,"aw",@progbits
-; UNIQ-NEXT: .section .data.unlikely.,"aw",@progbits,unique,7
+; UNIQ-NEXT: .section .data.unlikely.,"aw",@progbits,unique,5
; AGG-NEXT: .section .data.unlikely.,"aw",@progbits
; For @cold_data_custom_foo_section
@@ -87,7 +87,7 @@ target triple = "x86_64-unknown-linux-gnu"
; For @cold_relro_array
; COMMON: .type cold_relro_array,@object
; SYM-NEXT: .section .data.rel.ro.unlikely.cold_relro_array,"aw",@progbits
-; UNIQ-NEXT: .section .data.rel.ro.unlikely.,"aw",@progbits,unique,8
+; UNIQ-NEXT: .section .data.rel.ro.unlikely.,"aw",@progbits,unique,6
; AGG-NEXT: .section .data.rel.ro.unlikely.,"aw",@progbits
; Currently static-data-splitter only analyzes access from code.
@@ -97,19 +97,19 @@ target triple = "x86_64-unknown-linux-gnu"
; For @bss2
; COMMON: .type bss2,@object
; SYM-NEXT: .section .bss.unlikely.bss2,"aw",@nobits
-; UNIQ-NEXT: .section .bss.unlikely.,"aw",@nobits,unique,9
+; UNIQ-NEXT: .section .bss.unlikely.,"aw",@nobits,unique,7
; AGG-NEXT: .section .bss.unlikely.,"aw",@nobits
; For @data3
; COMMON: .type data3,@object
; SYM-NEXT: .section .data.unlikely.data3,"aw",@progbits
-; UNIQ-NEXT: .section .data.unlikely.,"aw",@progbits,unique,10
+; UNIQ-NEXT: .section .data.unlikely.,"aw",@progbits,unique,8
; AGG-NEXT: .section .data.unlikely.,"aw",@progbits
; For @data_with_unknown_hotness
; SYM: .type .Ldata_with_unknown_hotness,@object # @data_with_unknown_hotness
; SYM: .section .data..Ldata_with_unknown_hotness,"aw",@progbits
-; UNIQ: .section .data,"aw",@progbits,unique,11
+; UNIQ: .section .data,"aw",@progbits,unique,9
; The `.section` directive is omitted for .data with -unique-section-names=false.
; See MCSectionELF::shouldOmitSectionDirective for the implementation details.
; AGG: .data
diff --git a/llvm/test/CodeGen/X86/jump-table-partition.ll b/llvm/test/CodeGen/X86/jump-table-partition.ll
index 0d76f8a5a91ed..40dbc8131e22b 100644
--- a/llvm/test/CodeGen/X86/jump-table-partition.ll
+++ b/llvm/test/CodeGen/X86/jump-table-partition.ll
@@ -13,19 +13,19 @@
; STAT: 2 static-data-splitter - Number of hot jump tables seen
; STAT: 2 static-data-splitter - Number of jump tables with unknown hotness
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true \
-; RUN: -min-jump-table-entries=2 -unique-section-names=false \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections -unique-section-names=false \
+; RUN: -min-jump-table-entries=2 \
; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=NUM,JT
; Section names will optionally have `.<func>` if -function-sections is enabled.
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true \
-; RUN: -min-jump-table-entries=2 %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNC,JT
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections -min-jump-table-entries=2 \
+; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNC,JT
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=false \
-; RUN: -min-jump-table-entries=2 %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNCLESS,JT
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections=false -min-jump-table-entries=2 \
+; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNCLESS,JT
; In function @foo, the 2 switch instructions to jt0.* and jt1.* are placed in
; hot-prefixed sections, and the 2 switch instructions to jt2.* and jt3.* are
|
@llvm/pr-subscribers-backend-x86 Author: Mingming Liu (mingmingl-llvm) ChangesPer discussion in #129781 (comment), we'd like to refactor out the requirement of MFS. Full diff: https://github.com/llvm/llvm-project/pull/134752.diff 5 Files Affected:
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index fa1bb84ec5319..45fae653e4181 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1235,13 +1235,11 @@ void TargetPassConfig::addMachinePasses() {
addPass(createMIRAddFSDiscriminatorsPass(
sampleprof::FSDiscriminatorPass::PassLast));
- // Machine function splitter uses the basic block sections feature.
- // When used along with `-basic-block-sections=`, the basic-block-sections
- // feature takes precedence. This means functions eligible for
- // basic-block-sections optimizations (`=all`, or `=list=` with function
- // included in the list profile) will get that optimization instead.
- if (TM->Options.EnableMachineFunctionSplitter ||
- EnableMachineFunctionSplitter) {
+ bool MIRProfileLoaderPassEnabled = false;
+ auto EnableMIRProfileLoaderPass = [&]() {
+ if (MIRProfileLoaderPassEnabled)
+ return;
+
const std::string ProfileFile = getFSProfileFile(TM);
if (!ProfileFile.empty()) {
if (EnableFSDiscriminator) {
@@ -1256,14 +1254,25 @@ void TargetPassConfig::addMachinePasses() {
"performance.\n";
}
}
+ MIRProfileLoaderPassEnabled = true;
+ };
+ // Machine function splitter uses the basic block sections feature.
+ // When used along with `-basic-block-sections=`, the basic-block-sections
+ // feature takes precedence. This means functions eligible for
+ // basic-block-sections optimizations (`=all`, or `=list=` with function
+ // included in the list profile) will get that optimization instead.
+ if (TM->Options.EnableMachineFunctionSplitter ||
+ EnableMachineFunctionSplitter) {
+ EnableMIRProfileLoaderPass();
addPass(createMachineFunctionSplitterPass());
- if (SplitStaticData || TM->Options.EnableStaticDataPartitioning) {
- // The static data splitter pass is a machine function pass. and
- // static data annotator pass is a module-wide pass. See the file comment
- // in StaticDataAnnotator.cpp for the motivation.
- addPass(createStaticDataSplitterPass());
- addPass(createStaticDataAnnotatorPass());
- }
+ }
+ if (SplitStaticData || TM->Options.EnableStaticDataPartitioning) {
+ EnableMIRProfileLoaderPass();
+ // The static data splitter pass is a machine function pass. and
+ // static data annotator pass is a module-wide pass. See the file comment
+ // in StaticDataAnnotator.cpp for the motivation.
+ addPass(createStaticDataSplitterPass());
+ addPass(createStaticDataAnnotatorPass());
}
// We run the BasicBlockSections pass if either we need BB sections or BB
// address map (or both).
diff --git a/llvm/test/CodeGen/AArch64/constant-pool-partition.ll b/llvm/test/CodeGen/AArch64/constant-pool-partition.ll
index ab627b02a1bc7..d4447131e9de1 100644
--- a/llvm/test/CodeGen/AArch64/constant-pool-partition.ll
+++ b/llvm/test/CodeGen/AArch64/constant-pool-partition.ll
@@ -1,12 +1,10 @@
-; RUN: llc -mtriple=aarch64 -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true \
-; RUN: -unique-section-names=false \
+; RUN: llc -mtriple=aarch64 -partition-static-data-sections \
+; RUN: -function-sections -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --dump-input=always
; Repeat the RUN command above for big-endian systems.
-; RUN: llc -mtriple=aarch64_be -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true \
-; RUN: -unique-section-names=false \
+; RUN: llc -mtriple=aarch64_be -partition-static-data-sections \
+; RUN: -function-sections -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --dump-input=always
; Tests that constant pool hotness is aggregated across the module. The
diff --git a/llvm/test/CodeGen/X86/constant-pool-partition.ll b/llvm/test/CodeGen/X86/constant-pool-partition.ll
index d2c87b7b3fc14..515284fb2cf1a 100644
--- a/llvm/test/CodeGen/X86/constant-pool-partition.ll
+++ b/llvm/test/CodeGen/X86/constant-pool-partition.ll
@@ -10,18 +10,16 @@ target triple = "x86_64-grtev4-linux-gnu"
; 2. Similarly if a constant is accessed by both cold function and un-profiled
; function, constant pools for this constant should not have .unlikely suffix.
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true -data-sections=true \
-; RUN: -unique-section-names=false \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections -data-sections -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --dump-input=always
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true -data-sections=true \
-; RUN: -unique-section-names=true \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections -data-sections -unique-section-names \
; RUN: %s -o - 2>&1 | FileCheck %s --dump-input=always
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=false -data-sections=false \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections=false -data-sections=false \
; RUN: -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --dump-input=always
diff --git a/llvm/test/CodeGen/X86/global-variable-partition.ll b/llvm/test/CodeGen/X86/global-variable-partition.ll
index 91084d038cfe0..ce06d1712f840 100644
--- a/llvm/test/CodeGen/X86/global-variable-partition.ll
+++ b/llvm/test/CodeGen/X86/global-variable-partition.ll
@@ -11,22 +11,22 @@ target triple = "x86_64-unknown-linux-gnu"
; This RUN command sets `-data-sections=true -unique-section-names=true` so data
; sections are uniqufied by numbers.
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -data-sections=true \
-; RUN: -unique-section-names=true -relocation-model=pic \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic \
+; RUN: -partition-static-data-sections=true \
+; RUN: -data-sections=true -unique-section-names=true \
; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=SYM,COMMON --dump-input=always
; This RUN command sets `-data-sections=true -unique-section-names=false` so
; data sections are uniqufied by variable names.
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -data-sections=true \
-; RUN: -unique-section-names=false -relocation-model=pic \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic \
+; RUN: -partition-static-data-sections=true \
+; RUN: -data-sections=true -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=UNIQ,COMMON --dump-input=always
; This RUN command sets `-data-sections=false -unique-section-names=false`.
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -data-sections=false \
-; RUN: -unique-section-names=false -relocation-model=pic \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic \
+; RUN: -partition-static-data-sections=true \
+; RUN: -data-sections=false -unique-section-names=false \
; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=AGG,COMMON --dump-input=always
; For @.str and @.str.1
@@ -42,19 +42,19 @@ target triple = "x86_64-unknown-linux-gnu"
; For @hot_relro_array
; COMMON: .type hot_relro_array,@object
; SYM-NEXT: .section .data.rel.ro.hot.hot_relro_array
-; UNIQ-NEXT: .section .data.rel.ro.hot.,"aw",@progbits,unique,3
+; UNIQ-NEXT: .section .data.rel.ro.hot.,"aw",@progbits,unique,1
; AGG-NEXT: .section .data.rel.ro.hot.,"aw",@progbits
; For @hot_data, which is accessed by {cold_func, unprofiled_func, hot_func}.
; COMMON: .type hot_data,@object
; SYM-NEXT: .section .data.hot.hot_data,"aw",@progbits
-; UNIQ-NEXT: .section .data.hot.,"aw",@progbits,unique,4
+; UNIQ-NEXT: .section .data.hot.,"aw",@progbits,unique,2
; AGG-NEXT: .section .data.hot.,"aw",@progbits
; For @hot_bss, which is accessed by {unprofiled_func, hot_func}.
; COMMON: .type hot_bss,@object
; SYM-NEXT: .section .bss.hot.hot_bss,"aw",@nobits
-; UNIQ-NEXT: .section .bss.hot.,"aw",@nobits,unique,5
+; UNIQ-NEXT: .section .bss.hot.,"aw",@nobits,unique,3
; AGG-NEXT: .section .bss.hot.,"aw",@nobits
; For @.str.2
@@ -68,13 +68,13 @@ target triple = "x86_64-unknown-linux-gnu"
; For @cold_bss
; COMMON: .type cold_bss,@object
; SYM-NEXT: .section .bss.unlikely.cold_bss,"aw",@nobits
-; UNIQ-NEXT: .section .bss.unlikely.,"aw",@nobits,unique,6
+; UNIQ-NEXT: .section .bss.unlikely.,"aw",@nobits,unique,4
; AGG-NEXT: .section .bss.unlikely.,"aw",@nobits
; For @cold_data
; COMMON: .type cold_data,@object
; SYM-NEXT: .section .data.unlikely.cold_data,"aw",@progbits
-; UNIQ-NEXT: .section .data.unlikely.,"aw",@progbits,unique,7
+; UNIQ-NEXT: .section .data.unlikely.,"aw",@progbits,unique,5
; AGG-NEXT: .section .data.unlikely.,"aw",@progbits
; For @cold_data_custom_foo_section
@@ -87,7 +87,7 @@ target triple = "x86_64-unknown-linux-gnu"
; For @cold_relro_array
; COMMON: .type cold_relro_array,@object
; SYM-NEXT: .section .data.rel.ro.unlikely.cold_relro_array,"aw",@progbits
-; UNIQ-NEXT: .section .data.rel.ro.unlikely.,"aw",@progbits,unique,8
+; UNIQ-NEXT: .section .data.rel.ro.unlikely.,"aw",@progbits,unique,6
; AGG-NEXT: .section .data.rel.ro.unlikely.,"aw",@progbits
; Currently static-data-splitter only analyzes access from code.
@@ -97,19 +97,19 @@ target triple = "x86_64-unknown-linux-gnu"
; For @bss2
; COMMON: .type bss2,@object
; SYM-NEXT: .section .bss.unlikely.bss2,"aw",@nobits
-; UNIQ-NEXT: .section .bss.unlikely.,"aw",@nobits,unique,9
+; UNIQ-NEXT: .section .bss.unlikely.,"aw",@nobits,unique,7
; AGG-NEXT: .section .bss.unlikely.,"aw",@nobits
; For @data3
; COMMON: .type data3,@object
; SYM-NEXT: .section .data.unlikely.data3,"aw",@progbits
-; UNIQ-NEXT: .section .data.unlikely.,"aw",@progbits,unique,10
+; UNIQ-NEXT: .section .data.unlikely.,"aw",@progbits,unique,8
; AGG-NEXT: .section .data.unlikely.,"aw",@progbits
; For @data_with_unknown_hotness
; SYM: .type .Ldata_with_unknown_hotness,@object # @data_with_unknown_hotness
; SYM: .section .data..Ldata_with_unknown_hotness,"aw",@progbits
-; UNIQ: .section .data,"aw",@progbits,unique,11
+; UNIQ: .section .data,"aw",@progbits,unique,9
; The `.section` directive is omitted for .data with -unique-section-names=false.
; See MCSectionELF::shouldOmitSectionDirective for the implementation details.
; AGG: .data
diff --git a/llvm/test/CodeGen/X86/jump-table-partition.ll b/llvm/test/CodeGen/X86/jump-table-partition.ll
index 0d76f8a5a91ed..40dbc8131e22b 100644
--- a/llvm/test/CodeGen/X86/jump-table-partition.ll
+++ b/llvm/test/CodeGen/X86/jump-table-partition.ll
@@ -13,19 +13,19 @@
; STAT: 2 static-data-splitter - Number of hot jump tables seen
; STAT: 2 static-data-splitter - Number of jump tables with unknown hotness
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true \
-; RUN: -min-jump-table-entries=2 -unique-section-names=false \
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections -unique-section-names=false \
+; RUN: -min-jump-table-entries=2 \
; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=NUM,JT
; Section names will optionally have `.<func>` if -function-sections is enabled.
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=true \
-; RUN: -min-jump-table-entries=2 %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNC,JT
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections -min-jump-table-entries=2 \
+; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNC,JT
-; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions \
-; RUN: -partition-static-data-sections=true -function-sections=false \
-; RUN: -min-jump-table-entries=2 %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNCLESS,JT
+; RUN: llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections \
+; RUN: -function-sections=false -min-jump-table-entries=2 \
+; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNCLESS,JT
; In function @foo, the 2 switch instructions to jt0.* and jt1.* are placed in
; hot-prefixed sections, and the 2 switch instructions to jt2.* and jt3.* are
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can simplify this a bit if we move the staticdatapartitioning pass before the machine function splitter. Since no new CFG changes are introduced in the static data splitter pass we can only load the FS profile once before both of these passes.
So something like this --
if (TM->Options.EnableMachineFunctionSplitter ||
EnableMachineFunctionSplitter || SplitStaticData || TM->Options.EnableStaticDataPartitioning) {
const std::string ProfileFile = getFSProfileFile(TM);
...
}
if (TM->Options.EnableMachineFunctionSplitter ||
EnableMachineFunctionSplitter) {
addPass(createMachineFunctionSplitterPass());
}
if (SplitStaticData || TM->Options.EnableStaticDataPartitioning) {
addPass(createStaticDataSplitterPass());
addPass(createStaticDataAnnotatorPass());
}
thanks for the suggestion! Yeah it's indeed much simpler, done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/12264 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/52/builds/7417 Here is the relevant piece of the build log for the reference
|
Per discussion in #129781 (comment), we'd like to refactor out the requirement of MFS.