1717
1818#include " llvm/ADT/ArrayRef.h"
1919#include " llvm/IR/PassManager.h"
20- #include " llvm/ProfileData/InstrProf.h"
2120#include < cstdint>
2221#include < string>
2322
@@ -27,51 +26,23 @@ class Function;
2726class Instruction ;
2827class Module ;
2928
30- // / The instrumentation (profile-instr-gen) pass for IR based PGO.
31- // We use this pass to create COMDAT profile variables for context
32- // sensitive PGO (CSPGO). The reason to have a pass for this is CSPGO
33- // can be run after LTO/ThinLTO linking. Lld linker needs to see
34- // all the COMDAT variables before linking. So we have this pass
35- // always run before linking for CSPGO.
36- class PGOInstrumentationGenCreateVar
37- : public PassInfoMixin<PGOInstrumentationGenCreateVar> {
38- public:
39- PGOInstrumentationGenCreateVar (std::string CSInstrName = " " )
40- : CSInstrName(CSInstrName) {}
41- PreservedAnalyses run (Module &M, ModuleAnalysisManager &AM) {
42- createProfileFileNameVar (M, CSInstrName);
43- createIRLevelProfileFlagVar (M, /* IsCS */ true );
44- return PreservedAnalyses::all ();
45- }
46-
47- private:
48- std::string CSInstrName;
49- };
50-
5129// / The instrumentation (profile-instr-gen) pass for IR based PGO.
5230class PGOInstrumentationGen : public PassInfoMixin <PGOInstrumentationGen> {
5331public:
54- PGOInstrumentationGen (bool IsCS = false ) : IsCS(IsCS) {}
5532 PreservedAnalyses run (Module &M, ModuleAnalysisManager &AM);
56-
57- private:
58- // If this is a context sensitive instrumentation.
59- bool IsCS;
6033};
6134
6235// / The profile annotation (profile-instr-use) pass for IR based PGO.
6336class PGOInstrumentationUse : public PassInfoMixin <PGOInstrumentationUse> {
6437public:
6538 PGOInstrumentationUse (std::string Filename = " " ,
66- std::string RemappingFilename = " " , bool IsCS = false );
39+ std::string RemappingFilename = " " );
6740
6841 PreservedAnalyses run (Module &M, ModuleAnalysisManager &AM);
6942
7043private:
7144 std::string ProfileFileName;
7245 std::string ProfileRemappingFileName;
73- // If this is a context sensitive instrumentation.
74- bool IsCS;
7546};
7647
7748// / The indirect function call promotion pass.
0 commit comments