[llvm-branch-commits] [llvm] [BOLT] Drop high discrepancy profiles in matching (PR #95156)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Jun 16 13:47:23 PDT 2024


================
@@ -575,10 +583,16 @@ void preprocessUnreachableBlocks(FlowFunction &Func) {
 /// Decide if stale profile matching can be applied for a given function.
 /// Currently we skip inference for (very) large instances and for instances
 /// having "unexpected" control flow (e.g., having no sink basic blocks).
-bool canApplyInference(const FlowFunction &Func) {
+bool canApplyInference(const FlowFunction &Func,
+                       const yaml::bolt::BinaryFunctionProfile &YamlBF,
+                       const uint64_t &MatchedBlocks) {
   if (Func.Blocks.size() > opts::StaleMatchingMaxFuncSize)
     return false;
 
+  if ((double)(MatchedBlocks) / YamlBF.Blocks.size() <=
----------------
aaupov wrote:

It's preferred to use integer math when dealing with options, e.g.:
https://github.com/llvm/llvm-project/blob/67285feffd6708e6db36c11faf95eeab449e797a/bolt/lib/Passes/IndirectCallPromotion.cpp#L584-L586


https://github.com/llvm/llvm-project/pull/95156


More information about the llvm-branch-commits mailing list