[llvm] [NewPM][CodeGen] add TargetPassConfig like API (PR #70906)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 18 23:40:24 PST 2023
================
@@ -869,9 +1018,23 @@ Error CodeGenPassBuilder<Derived>::addMachinePasses(
// Run pre-ra passes.
derived().addPreRegAlloc(addPass);
+ // Add a FSDiscriminator pass right before RA, so that we could get
+ // more precise SampleFDO profile for RA.
+ if (EnableFSDiscriminator) {
+ addPass(MIRAddFSDiscriminatorsPass(sampleprof::FSDiscriminatorPass::Pass1));
+ const std::string ProfileFile = getFSProfileFile();
+ if (!ProfileFile.empty() && !Opt.DisableRAFSProfileLoader)
+ addPass(MIRProfileLoaderNewPass(ProfileFile, getFSRemappingFile(),
+ sampleprof::FSDiscriminatorPass::Pass1,
+ nullptr));
+ }
+
// Run register allocation and passes that are tightly coupled with it,
// including phi elimination and scheduling.
- if (*Opt.OptimizeRegAlloc) {
+ bool IsOptimizeRegAlloc = Opt.OptimizeRegAlloc.has_value()
----------------
aeubanks wrote:
`.value_or(getOptLevel() != None)`
https://github.com/llvm/llvm-project/pull/70906
More information about the llvm-commits
mailing list