[llvm] [VPlan] Record estimated branch probabilities on VPlan0 for cost modeling (PR #216172)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 13 20:24:12 PDT 2026
================
@@ -2144,8 +2145,12 @@ void VPIRPhi::printRecipe(raw_ostream &O, const Twine &Indent,
#endif
void VPIRMetadata::applyMetadata(Instruction &I) const {
- for (const auto &[Kind, Node] : Metadata)
+ for (const auto &[Kind, Node] : Metadata) {
+ // Estimated weights must not be emitted as profile data, see setProfile.
+ if (Kind == LLVMContext::MD_prof && EstimatedProfile)
----------------
mtrofin wrote:
IIUC if the original IR has `!prof` throughout, none of these will have `EstimatedProfile`, correct? I.e. we shouldn't try to set it to "unknown" here (`llvm::setExplicitlyUnknownBranchWeightsIfProfiled`), as it's not like we had information to compute it from.
Could you add a comment about that - so that if later profcheck fails and someone investigates and sees this, they don't get tempted to "fix" it by slapping "unknown" here, and rather figures out what dropped the profile in the first place.
https://github.com/llvm/llvm-project/pull/216172
More information about the llvm-commits
mailing list