Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bolt
diff options
context:
space:
mode:
authorAmir Ayupov <aaupov@fb.com>2022-05-04 05:30:41 +0300
committerAmir Ayupov <aaupov@fb.com>2022-05-04 05:31:20 +0300
commitd0b1c98c960b1073015bb9a87c9d10a2115fd32f (patch)
tree9e436558b6e7b46c5e413100f0130864250c5d67 /bolt
parentec02227bf7c3f92d336e50c148fccdb734a33ee0 (diff)
[BOLT][NFC] ICP: simplify findTargetsIndex
Unnest lambda and use `llvm::is_contained`. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D124877
Diffstat (limited to 'bolt')
-rw-r--r--bolt/lib/Passes/IndirectCallPromotion.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/bolt/lib/Passes/IndirectCallPromotion.cpp b/bolt/lib/Passes/IndirectCallPromotion.cpp
index a028802734ef..dca7fe148e00 100644
--- a/bolt/lib/Passes/IndirectCallPromotion.cpp
+++ b/bolt/lib/Passes/IndirectCallPromotion.cpp
@@ -515,20 +515,17 @@ IndirectCallPromotion::findCallTargetSymbols(std::vector<Callsite> &Targets,
JumpTableInfoType HotTargets =
maybeGetHotJumpTableTargets(BB, CallInst, TargetFetchInst, JT);
- if (!HotTargets.empty()) {
- auto findTargetsIndex = [&](uint64_t JTIndex) {
- for (size_t I = 0; I < Targets.size(); ++I) {
- std::vector<uint64_t> &JTIs = Targets[I].JTIndices;
- if (std::find(JTIs.begin(), JTIs.end(), JTIndex) != JTIs.end())
- return I;
- }
- LLVM_DEBUG(
- dbgs() << "BOLT-ERROR: Unable to find target index for hot jump "
- << " table entry in " << *BB.getFunction() << "\n");
- llvm_unreachable("Hot indices must be referred to by at least one "
- "callsite");
- };
+ auto findTargetsIndex = [&](uint64_t JTIndex) {
+ for (size_t I = 0; I < Targets.size(); ++I)
+ if (llvm::is_contained(Targets[I].JTIndices, JTIndex))
+ return I;
+ LLVM_DEBUG(dbgs() << "BOLT-ERROR: Unable to find target index for hot jump "
+ << " table entry in " << *BB.getFunction() << "\n");
+ llvm_unreachable("Hot indices must be referred to by at least one "
+ "callsite");
+ };
+ if (!HotTargets.empty()) {
if (opts::Verbosity >= 1)
for (size_t I = 0; I < HotTargets.size(); ++I)
outs() << "BOLT-INFO: HotTarget[" << I << "] = (" << HotTargets[I].first