================ @@ -592,10 +599,15 @@ 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) { if (Func.Blocks.size() > opts::StaleMatchingMaxFuncSize) return false; + if ((double)Func.MatchedExecCount / YamlBF.ExecCount >= + opts::MatchedProfileThreshold / 100.0) + return false; ---------------- WenleiHe wrote:
> For block-based matching, the threshold should be higher than 5%, perhaps > closer to a half? Yes. Threshold of course need to be tuned based on the heuristic chosen. I just feel that block count based threshold could be a better proxy of how confident we are about the graph match and whether stale profile matching should proceed.. But I don't have very strong opinion. https://github.com/llvm/llvm-project/pull/95156 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits