Skip to content

Commit e9e7062

Browse files
[Transforms] Avoid repeated hash lookups (NFC)
1 parent ef1128b commit e9e7062

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -646,14 +646,13 @@ void SampleProfileLoaderBaseImpl<BT>::findEquivalenceClasses(FunctionT &F) {
646646
BasicBlockT *BB1 = &BB;
647647

648648
// Compute BB1's equivalence class once.
649-
if (EquivalenceClass.count(BB1)) {
649+
// By default, blocks are in their own equivalence class.
650+
auto [It, Inserted] = EquivalenceClass.try_emplace(BB1, BB1);
651+
if (!Inserted) {
650652
LLVM_DEBUG(printBlockEquivalence(dbgs(), BB1));
651653
continue;
652654
}
653655

654-
// By default, blocks are in their own equivalence class.
655-
EquivalenceClass[BB1] = BB1;
656-
657656
// Traverse all the blocks dominated by BB1. We are looking for
658657
// every basic block BB2 such that:
659658
//

0 commit comments

Comments
 (0)