diff options
author | Mingming Liu <mingmingl@google.com> | 2025-04-07 22:22:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-07 22:22:08 -0700 |
commit | 0d19efa9d5d872962a0a83c865b4636d58f46519 (patch) | |
tree | 20755d8ae4ac82e11fecc3144bac14633c7cc910 /llvm/lib/CodeGen/TargetPassConfig.cpp | |
parent | 642481a4286c9006958274531ee173b347866c50 (diff) | |
download | llvm-0d19efa9d5d872962a0a83c865b4636d58f46519.zip llvm-0d19efa9d5d872962a0a83c865b4636d58f46519.tar.gz llvm-0d19efa9d5d872962a0a83c865b4636d58f46519.tar.bz2 |
[NFC]In codegen pipeline, turn static-data-splitter pass on/off with its own option (#134752)
Per discussion in
https://github.com/llvm/llvm-project/pull/129781#discussion_r2017489088,
we'd like to refactor out the requirement of MFS.
Diffstat (limited to 'llvm/lib/CodeGen/TargetPassConfig.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetPassConfig.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index fa1bb84..1bf6621 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -1235,13 +1235,9 @@ 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) { + EnableMachineFunctionSplitter || SplitStaticData || + TM->Options.EnableStaticDataPartitioning) { const std::string ProfileFile = getFSProfileFile(TM); if (!ProfileFile.empty()) { if (EnableFSDiscriminator) { @@ -1256,14 +1252,23 @@ void TargetPassConfig::addMachinePasses() { "performance.\n"; } } + } + + // 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) 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) { + // 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). |