[llvm] [SimplifyCFG] Fix uint32_t overflow in cbranch to cbranch merge prevention check. (PR #72329)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 14 21:23:51 PST 2023
================
@@ -4351,10 +4351,10 @@ static bool SimplifyCondBranchToCondBranch(BranchInst *PBI, BranchInst *BI,
SmallVector<uint32_t, 2> PredWeights;
if (!PBI->getMetadata(LLVMContext::MD_unpredictable) &&
extractBranchWeights(*PBI, PredWeights) &&
- (PredWeights[0] + PredWeights[1]) != 0) {
+ ((uint64_t)PredWeights[0] + PredWeights[1]) != 0) {
----------------
aeubanks wrote:
`static_cast` is clearer
https://github.com/llvm/llvm-project/pull/72329
More information about the llvm-commits
mailing list