[BOLT] Fix ICPJumpTablesTopN option use

Fix non-sensical `opts::ICPJumpTablesTopN != 0 ? opts::ICPTopN : opts::ICPTopN`.
Refactor/simplify another similar assignment.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D124880
This commit is contained in:
Amir Ayupov 2022-05-03 19:33:43 -07:00
parent c3d5372093
commit 60957a5a08
1 changed files with 6 additions and 7 deletions

View File

@ -546,7 +546,7 @@ IndirectCallPromotion::findCallTargetSymbols(std::vector<Callsite> &Targets,
}
uint64_t RemainingMemAccesses = TotalMemAccesses;
const size_t TopN =
opts::ICPJumpTablesTopN != 0 ? opts::ICPTopN : opts::ICPTopN;
opts::ICPJumpTablesTopN ? opts::ICPJumpTablesTopN : opts::ICPTopN;
size_t I = 0;
for (; I < HotTargets.size(); ++I) {
const uint64_t MemAccesses = HotTargets[I].first;
@ -942,12 +942,11 @@ size_t IndirectCallPromotion::canPromoteCallsite(
}
size_t TopN = opts::ICPTopN;
if (IsJumpTable) {
if (opts::ICPJumpTablesTopN != 0)
TopN = opts::ICPJumpTablesTopN;
} else if (opts::ICPCallsTopN != 0) {
TopN = opts::ICPCallsTopN;
}
if (IsJumpTable)
TopN = opts::ICPJumpTablesTopN ? opts::ICPJumpTablesTopN : TopN;
else
TopN = opts::ICPCallsTopN ? opts::ICPCallsTopN : TopN;
const size_t TrialN = TopN ? std::min(TopN, Targets.size()) : Targets.size();
if (opts::ICPTopCallsites > 0) {