Skip to content

Commit 67050dd

Browse files
committed
Turn on PGO passes only if PGO enums are set to use
1 parent 0af0751 commit 67050dd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,15 @@ static bool dontUseFastISelFor(const Function &Fn) {
231231

232232
static bool shouldRegisterPGOPasses(const TargetMachine &TM,
233233
CodeGenOptLevel OptLevel) {
234-
bool RegisterPGOPasses = OptLevel != CodeGenOptLevel::None;
235-
if (!RegisterPGOPasses && TM.getPGOOption()) {
234+
if (OptLevel != CodeGenOptLevel::None)
235+
return true;
236+
if (TM.getPGOOption()) {
236237
const PGOOptions &Options = *TM.getPGOOption();
237-
RegisterPGOPasses = Options.Action != PGOOptions::PGOAction::NoAction ||
238-
Options.CSAction != PGOOptions::CSPGOAction::NoCSAction;
238+
return Options.Action == PGOOptions::PGOAction::IRUse ||
239+
Options.Action == PGOOptions::PGOAction::SampleUse ||
240+
Options.CSAction != PGOOptions::CSPGOAction::CSIRUse;
239241
}
240-
return RegisterPGOPasses;
242+
return false;
241243
}
242244

243245
namespace llvm {

0 commit comments

Comments
 (0)