Skip to content

Commit e264b0e

Browse files
[ProfileData] Avoid repeated hash lookups (NFC) (#128829)
1 parent b2c8f66 commit e264b0e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/ProfileData/InstrProf.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,8 @@ void TemporalProfTraceTy::createBPFunctionNodes(
10761076
// BalancedPartitioning more effective.
10771077
for (auto &[Id, UNs] : IdToUNs)
10781078
llvm::erase_if(UNs, [&](auto &UN) {
1079-
return UNFrequency[UN] <= 1 || 2 * UNFrequency[UN] > IdToUNs.size();
1079+
unsigned Freq = UNFrequency[UN];
1080+
return Freq <= 1 || 2 * Freq > IdToUNs.size();
10801081
});
10811082
}
10821083

0 commit comments

Comments
 (0)