diff options
author | Rong Xu <xur@google.com> | 2021-05-18 16:08:38 -0700 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2021-05-18 16:23:43 -0700 |
commit | 886629a8c9e58752627d8ae7abf6fa93191a3df8 (patch) | |
tree | 7088ed315c5e8e85dee413f325174183bf6fe2cd /llvm/lib/LTO/LTOBackend.cpp | |
parent | ff99fdf63f9939d5205c0c0df85f28c5509eac0f (diff) | |
download | llvm-886629a8c9e58752627d8ae7abf6fa93191a3df8.zip llvm-886629a8c9e58752627d8ae7abf6fa93191a3df8.tar.gz llvm-886629a8c9e58752627d8ae7abf6fa93191a3df8.tar.bz2 |
[SampleFDO] New hierarchical discriminator for Flow Sensitive SampleFDO
This patch implements first part of Flow Sensitive SampleFDO (FSAFDO).
It has the following changes:
(1) disable current discriminator encoding scheme,
(2) new hierarchical discriminator for FSAFDO.
For this patch, option "-enable-fs-discriminator=true" turns on the new
functionality. Option "-enable-fs-discriminator=false" (the default)
keeps the current SampleFDO behavior. When the fs-discriminator is
enabled, we insert a flag variable, namely, llvm_fs_discriminator, to
the object. This symbol will checked by create_llvm_prof tool, and used
to generate a profile with FS-AFDO discriminators enabled. If this
happens, for an extbinary format profile, create_llvm_prof tool
will add a flag to profile summary section.
Differential Revision: https://reviews.llvm.org/D102246
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 35fa9bd..4e4ba4f 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -215,10 +215,15 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM, PGOOptions::SampleUse, PGOOptions::NoCSAction, true); else if (Conf.RunCSIRInstr) { PGOOpt = PGOOptions("", Conf.CSIRProfile, Conf.ProfileRemapping, - PGOOptions::IRUse, PGOOptions::CSIRInstr); + PGOOptions::IRUse, PGOOptions::CSIRInstr, + Conf.AddFSDiscriminator); } else if (!Conf.CSIRProfile.empty()) { PGOOpt = PGOOptions(Conf.CSIRProfile, "", Conf.ProfileRemapping, - PGOOptions::IRUse, PGOOptions::CSIRUse); + PGOOptions::IRUse, PGOOptions::CSIRUse, + Conf.AddFSDiscriminator); + } else if (Conf.AddFSDiscriminator) { + PGOOpt = PGOOptions("", "", "", PGOOptions::NoAction, + PGOOptions::NoCSAction, true); } LoopAnalysisManager LAM; |