================ @@ -636,9 +636,13 @@ static void updateBranchWeights(Instruction *Term, WeightInfo &Info) { MDB.createBranchWeights(Info.Weights)); for (auto [Idx, SubWeight] : enumerate(Info.SubWeights)) if (SubWeight != 0) - Info.Weights[Idx] = Info.Weights[Idx] > SubWeight - ? Info.Weights[Idx] - SubWeight - : 1; + // Don't set the probability of taking the edge from latch to loop header + // to less than 1, as this could significantly reduce the loop's hotness, + // which would be incorrect in the case of underestimating the trip count. ---------------- MatzeB wrote:
Maybe "Don't set the probability ... to less than a 1:1 ratio (meaning Weight should not be lower than SubWeight) ... "? https://github.com/llvm/llvm-project/pull/70094 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits