diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp index 819ddd02a24ce..47eb751328b51 100644 --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -1076,7 +1076,8 @@ void TemporalProfTraceTy::createBPFunctionNodes( // BalancedPartitioning more effective. for (auto &[Id, UNs] : IdToUNs) llvm::erase_if(UNs, [&](auto &UN) { - return UNFrequency[UN] <= 1 || 2 * UNFrequency[UN] > IdToUNs.size(); + unsigned Freq = UNFrequency[UN]; + return Freq <= 1 || 2 * Freq > IdToUNs.size(); }); }