-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion `Denominator > 0 && "Denominator cannot be 0!"' failed. #66382
Comments
@dexonsmith just to confirm - all-zero branch weights are perfectly legal construct, right? They don't make much sense, but if you want to attach branch weights metadata to the basic block that hasn't been executed, I guess they can come up. |
I don't think that's expected, no. If a basic block hasn't been executed, then no branch weights should be attached, so that BranchProbabilityInfo can make a guess. Probably worth adding an IR verifier check. |
@dexonsmith BPI appears to handle zero branch weight case here: llvm-project/llvm/lib/Analysis/BranchProbabilityInfo.cpp Lines 430 to 434 in 7472490
Seems to be and old concern: 6a2c71a |
Error: Command failed due to missing milestone. |
Perhaps that commit wasn't implemented fully, then! Seems like a bug. |
Error: Command failed due to missing milestone. |
@dexonsmith not sure what you mean by commit not being fully implemented. And what exactly do you count as a bug here? It looks like BPI was handling the case of zero branch weight since at least 2015. I was planning to update another pass that didn't handle this case assuming that zero branch weights are legal (if unexpected). As such, I hesitate to declare them illegal, since it's unclear how many places can produce such weights. |
I agree; your plan sounds good to me. |
Error: Command failed due to missing milestone. |
Treat the case where all branch weights are zero as if there was no profile. Fixes llvm#66382
…llvm#66506) Treat the case where all branch weights are zero as if there was no profile. Fixes llvm#66382
Looks like LoopPredication doesn't properly handle the case where all of branch weights are zero.
Run with
opt -loop-predication-skip-profitability-checks=false -passes='require<scalar-evolution>,loop-mssa(loop-predication)'
https://godbolt.org/z/oWGjWTaTY
The text was updated successfully, but these errors were encountered: