================ @@ -151,15 +151,9 @@ void verifyMisExpect(Instruction &I, ArrayRef<uint32_t> RealWeights, uint64_t TotalBranchWeight = LikelyBranchWeight + (UnlikelyBranchWeight * NumUnlikelyTargets); - // FIXME: When we've addressed sample profiling, restore the assertion - // - // We cannot calculate branch probability if either of these invariants aren't - // met. However, MisExpect diagnostics should not prevent code from compiling, - // so we simply forgo emitting diagnostics here, and return early. - // assert((TotalBranchWeight >= LikelyBranchWeight) && (TotalBranchWeight > 0) - // && "TotalBranchWeight is less than the Likely branch weight"); - if ((TotalBranchWeight == 0) || (TotalBranchWeight <= LikelyBranchWeight)) - return; + // Failing this assert means that we have corrupted metadata. + assert((TotalBranchWeight >= LikelyBranchWeight) && (TotalBranchWeight > 0) && ---------------- ilovepi wrote:
IIRC many of the places where we check metadata for corruption or format incompatibility just use asserts, but I'm fine if its a diagnostic. Let me know if you have a preference, as I'm fine either way. That said, if we're going to make this a diagnostic, we should probably move it out of MisExpect and put it on some other code path where we're examining branch weights, since MisExpect is one of the least used compilation modes. WDYT? https://github.com/llvm/llvm-project/pull/86610 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits