[llvm] [PowerPC] support branch hint for AtomicExpandImpl::expandAtomicCmpXchg (PR #152366)
zhijian lin via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 7 06:43:50 PDT 2025
================
@@ -12816,6 +12817,11 @@ Value *PPCTargetLowering::emitStoreConditional(IRBuilderBase &Builder,
return Builder.CreateXor(Call, Builder.getInt32(1));
}
+MDNode *PPCTargetLowering::getTrueBranchHintWeightForAtomicCmpXchgg(
+ LLVMContext &Ctx) const {
+ return MDBuilder(Ctx).createLikelyBranchWeights();
----------------
diggerlin wrote:
I'm not sure whether other platforms use the same branch prediction mechanism, so I introduced a new virtual API:
```
virtual MDNode *
getTrueBranchHintWeightForAtomicCmpXchg(LLVMContext &Ctx) const {
return nullptr;
}
```
Targets that want to support branch hinting for expandAtomicCmpXchg can override this with a target-specific implementation.
https://github.com/llvm/llvm-project/pull/152366
More information about the llvm-commits
mailing list