[llvm] [TTI] Use MemIntrinsicCostAttributes for getGatherScatterOpCost (PR #168650)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 27 09:14:12 PST 2025
================
@@ -1598,8 +1603,10 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
// For a target without strided memory operations (or for an illegal
// operation type on one which does), assume we lower to a gather/scatter
// operation. (Which may in turn be scalarized.)
- return thisT()->getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask,
- Alignment, CostKind, I);
+ unsigned IID = Opcode == Instruction::Load ? Intrinsic::masked_gather
+ : Intrinsic::masked_scatter;
+ return thisT()->getGatherScatterOpCost(
+ {IID, DataTy, Ptr, VariableMask, Alignment, I}, CostKind);
----------------
lukel97 wrote:
The guide mentions it's for non-trivial constructors though, and the constructor here is trivial in that it only initialises members:
> Do not use these to call constructors with non-trivial logic or if you care that you’re calling some particular constructor.
I think we use brace initialisation in a good few other places across LLVM. Not a strongly held opinion, but I feel like the class name here is long enough that it might warrant the more succinct syntax.
https://github.com/llvm/llvm-project/pull/168650
More information about the llvm-commits
mailing list