[llvm] LoopVectorize: Set branch_weight for conditional branches (PR #72450)
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 11:32:35 PST 2023
================
@@ -1710,20 +1711,19 @@ void SampleProfileLoader::generateMDProfMetadata(Function &F) {
else if (OverwriteExistingWeights)
I.setMetadata(LLVMContext::MD_prof, nullptr);
} else if (!isa<IntrinsicInst>(&I)) {
- I.setMetadata(LLVMContext::MD_prof,
- MDB.createBranchWeights(
- {static_cast<uint32_t>(BlockWeights[BB])}));
+ setBranchWeights(I, {static_cast<uint32_t>(BlockWeights[BB])});
}
}
} else if (OverwriteExistingWeights || ProfileSampleBlockAccurate) {
// Set profile metadata (possibly annotated by LTO prelink) to zero or
// clear it for cold code.
for (auto &I : *BB) {
if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
- if (cast<CallBase>(I).isIndirectCall())
+ if (cast<CallBase>(I).isIndirectCall()) {
I.setMetadata(LLVMContext::MD_prof, nullptr);
----------------
MatzeB wrote:
Sorry this line was part of PR https://github.com/llvm/llvm-project/pull/72446 that I already landed. Hope it's fine to leave this unchanged.
https://github.com/llvm/llvm-project/pull/72450
More information about the llvm-commits
mailing list