================
@@ -2907,6 +2907,10 @@ uint64_t
LoopVectorizationCostModel::getPredBlockCostDivisor(
uint64_t BBFreq = getBFI().getBlockFreq(BB).getFrequency();
assert(HeaderFreq >= BBFreq &&
"Header has smaller block freq than dominated BB?");
+ // Guard against division by zero when BBFreq is 0.
+ // In such cases, return 1 to avoid undefined behavior.
+ if (BBFreq == 0)
----------------
lukel97 wrote:
FP division by zero isn't undefined behaviour, it should return -Inf. But in
any case BlockFrequencyInfo should never return a zero frequency. If you add an
assert here you'll see that BBFreq is never zero
https://github.com/llvm/llvm-project/pull/172094
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits