@@ -52,12 +52,12 @@ class AMDGPUTTIImpl final : public BasicTTIImplBase<AMDGPUTTIImpl> {
52
52
53
53
void getUnrollingPreferences (Loop *L, ScalarEvolution &SE,
54
54
TTI::UnrollingPreferences &UP,
55
- OptimizationRemarkEmitter *ORE) const ;
55
+ OptimizationRemarkEmitter *ORE) const override ;
56
56
57
57
void getPeelingPreferences (Loop *L, ScalarEvolution &SE,
58
- TTI::PeelingPreferences &PP) const ;
58
+ TTI::PeelingPreferences &PP) const override ;
59
59
60
- uint64_t getMaxMemIntrinsicInlineSizeThreshold () const ;
60
+ uint64_t getMaxMemIntrinsicInlineSizeThreshold () const override ;
61
61
};
62
62
63
63
class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
@@ -104,78 +104,79 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
104
104
public:
105
105
explicit GCNTTIImpl (const AMDGPUTargetMachine *TM, const Function &F);
106
106
107
- bool hasBranchDivergence (const Function *F = nullptr ) const ;
107
+ bool hasBranchDivergence (const Function *F = nullptr ) const override ;
108
108
109
109
void getUnrollingPreferences (Loop *L, ScalarEvolution &SE,
110
110
TTI::UnrollingPreferences &UP,
111
- OptimizationRemarkEmitter *ORE) const ;
111
+ OptimizationRemarkEmitter *ORE) const override ;
112
112
113
113
void getPeelingPreferences (Loop *L, ScalarEvolution &SE,
114
- TTI::PeelingPreferences &PP) const ;
114
+ TTI::PeelingPreferences &PP) const override ;
115
115
116
- TTI::PopcntSupportKind getPopcntSupport (unsigned TyWidth) const {
116
+ TTI::PopcntSupportKind getPopcntSupport (unsigned TyWidth) const override {
117
117
assert (isPowerOf2_32 (TyWidth) && " Ty width must be power of 2" );
118
118
return TTI::PSK_FastHardware;
119
119
}
120
120
121
- unsigned getNumberOfRegisters (unsigned RCID) const ;
122
- TypeSize getRegisterBitWidth (TargetTransformInfo::RegisterKind Vector) const ;
123
- unsigned getMinVectorRegisterBitWidth () const ;
124
- unsigned getMaximumVF (unsigned ElemWidth, unsigned Opcode) const ;
121
+ unsigned getNumberOfRegisters (unsigned RCID) const override ;
122
+ TypeSize
123
+ getRegisterBitWidth (TargetTransformInfo::RegisterKind Vector) const override ;
124
+ unsigned getMinVectorRegisterBitWidth () const override ;
125
+ unsigned getMaximumVF (unsigned ElemWidth, unsigned Opcode) const override ;
125
126
unsigned getLoadVectorFactor (unsigned VF, unsigned LoadSize,
126
127
unsigned ChainSizeInBytes,
127
- VectorType *VecTy) const ;
128
+ VectorType *VecTy) const override ;
128
129
unsigned getStoreVectorFactor (unsigned VF, unsigned StoreSize,
129
130
unsigned ChainSizeInBytes,
130
- VectorType *VecTy) const ;
131
- unsigned getLoadStoreVecRegBitWidth (unsigned AddrSpace) const ;
131
+ VectorType *VecTy) const override ;
132
+ unsigned getLoadStoreVecRegBitWidth (unsigned AddrSpace) const override ;
132
133
133
134
bool isLegalToVectorizeMemChain (unsigned ChainSizeInBytes, Align Alignment,
134
135
unsigned AddrSpace) const ;
135
136
bool isLegalToVectorizeLoadChain (unsigned ChainSizeInBytes, Align Alignment,
136
- unsigned AddrSpace) const ;
137
+ unsigned AddrSpace) const override ;
137
138
bool isLegalToVectorizeStoreChain (unsigned ChainSizeInBytes, Align Alignment,
138
- unsigned AddrSpace) const ;
139
+ unsigned AddrSpace) const override ;
139
140
140
- uint64_t getMaxMemIntrinsicInlineSizeThreshold () const ;
141
- Type *
142
- getMemcpyLoopLoweringType (LLVMContext &Context, Value *Length,
143
- unsigned SrcAddrSpace, unsigned DestAddrSpace,
144
- Align SrcAlign, Align DestAlign,
145
- std::optional<uint32_t > AtomicElementSize) const ;
141
+ uint64_t getMaxMemIntrinsicInlineSizeThreshold () const override ;
142
+ Type *getMemcpyLoopLoweringType (
143
+ LLVMContext &Context, Value *Length, unsigned SrcAddrSpace,
144
+ unsigned DestAddrSpace, Align SrcAlign, Align DestAlign,
145
+ std::optional<uint32_t > AtomicElementSize) const override ;
146
146
147
147
void getMemcpyLoopResidualLoweringType (
148
148
SmallVectorImpl<Type *> &OpsOut, LLVMContext &Context,
149
149
unsigned RemainingBytes, unsigned SrcAddrSpace, unsigned DestAddrSpace,
150
150
Align SrcAlign, Align DestAlign,
151
- std::optional<uint32_t > AtomicCpySize) const ;
152
- unsigned getMaxInterleaveFactor (ElementCount VF) const ;
151
+ std::optional<uint32_t > AtomicCpySize) const override ;
152
+ unsigned getMaxInterleaveFactor (ElementCount VF) const override ;
153
153
154
- bool getTgtMemIntrinsic (IntrinsicInst *Inst, MemIntrinsicInfo &Info) const ;
154
+ bool getTgtMemIntrinsic (IntrinsicInst *Inst,
155
+ MemIntrinsicInfo &Info) const override ;
155
156
156
157
InstructionCost getArithmeticInstrCost (
157
158
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
158
159
TTI::OperandValueInfo Op1Info = {TTI::OK_AnyValue, TTI::OP_None},
159
160
TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
160
161
ArrayRef<const Value *> Args = {},
161
- const Instruction *CxtI = nullptr ) const ;
162
+ const Instruction *CxtI = nullptr ) const override ;
162
163
163
164
InstructionCost getCFInstrCost (unsigned Opcode, TTI::TargetCostKind CostKind,
164
- const Instruction *I = nullptr ) const ;
165
+ const Instruction *I = nullptr ) const override ;
165
166
166
167
bool isInlineAsmSourceOfDivergence (const CallInst *CI,
167
168
ArrayRef<unsigned > Indices = {}) const ;
168
169
169
170
InstructionCost getVectorInstrCost (unsigned Opcode, Type *ValTy,
170
171
TTI::TargetCostKind CostKind,
171
172
unsigned Index, Value *Op0,
172
- Value *Op1) const ;
173
+ Value *Op1) const override ;
173
174
174
175
bool isReadRegisterSourceOfDivergence (const IntrinsicInst *ReadReg) const ;
175
- bool isSourceOfDivergence (const Value *V) const ;
176
- bool isAlwaysUniform (const Value *V) const ;
176
+ bool isSourceOfDivergence (const Value *V) const override ;
177
+ bool isAlwaysUniform (const Value *V) const override ;
177
178
178
- bool isValidAddrSpaceCast (unsigned FromAS, unsigned ToAS) const {
179
+ bool isValidAddrSpaceCast (unsigned FromAS, unsigned ToAS) const override {
179
180
// Address space casts must cast between different address spaces.
180
181
if (FromAS == ToAS)
181
182
return false ;
@@ -196,11 +197,11 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
196
197
return false ;
197
198
}
198
199
199
- bool addrspacesMayAlias (unsigned AS0, unsigned AS1) const {
200
+ bool addrspacesMayAlias (unsigned AS0, unsigned AS1) const override {
200
201
return AMDGPU::addrspacesMayAlias (AS0, AS1);
201
202
}
202
203
203
- unsigned getFlatAddressSpace () const {
204
+ unsigned getFlatAddressSpace () const override {
204
205
// Don't bother running InferAddressSpaces pass on graphics shaders which
205
206
// don't use flat addressing.
206
207
if (IsGraphics)
@@ -209,24 +210,25 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
209
210
}
210
211
211
212
bool collectFlatAddressOperands (SmallVectorImpl<int > &OpIndexes,
212
- Intrinsic::ID IID) const ;
213
+ Intrinsic::ID IID) const override ;
213
214
214
- bool canHaveNonUndefGlobalInitializerInAddressSpace (unsigned AS) const {
215
+ bool
216
+ canHaveNonUndefGlobalInitializerInAddressSpace (unsigned AS) const override {
215
217
return AS != AMDGPUAS::LOCAL_ADDRESS && AS != AMDGPUAS::REGION_ADDRESS &&
216
218
AS != AMDGPUAS::PRIVATE_ADDRESS;
217
219
}
218
220
219
221
Value *rewriteIntrinsicWithAddressSpace (IntrinsicInst *II, Value *OldV,
220
- Value *NewV) const ;
222
+ Value *NewV) const override ;
221
223
222
224
bool canSimplifyLegacyMulToMul (const Instruction &I, const Value *Op0,
223
225
const Value *Op1, InstCombiner &IC) const ;
224
226
225
227
bool simplifyDemandedLaneMaskArg (InstCombiner &IC, IntrinsicInst &II,
226
228
unsigned LaneAgIdx) const ;
227
229
228
- std::optional<Instruction *> instCombineIntrinsic (InstCombiner &IC,
229
- IntrinsicInst &II) const ;
230
+ std::optional<Instruction *>
231
+ instCombineIntrinsic (InstCombiner &IC, IntrinsicInst &II) const override ;
230
232
231
233
Value *simplifyAMDGCNLaneIntrinsicDemanded (InstCombiner &IC,
232
234
IntrinsicInst &II,
@@ -237,40 +239,43 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
237
239
InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts,
238
240
APInt &UndefElts2, APInt &UndefElts3,
239
241
std::function<void (Instruction *, unsigned , APInt, APInt &)>
240
- SimplifyAndSetOp) const ;
242
+ SimplifyAndSetOp) const override ;
241
243
242
244
InstructionCost getVectorSplitCost () const { return 0 ; }
243
245
244
- InstructionCost getShuffleCost (TTI::ShuffleKind Kind, VectorType *Tp,
245
- ArrayRef<int > Mask,
246
- TTI::TargetCostKind CostKind, int Index,
247
- VectorType *SubTp,
248
- ArrayRef<const Value *> Args = {},
249
- const Instruction *CxtI = nullptr ) const ;
246
+ InstructionCost
247
+ getShuffleCost (TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef<int > Mask,
248
+ TTI::TargetCostKind CostKind, int Index, VectorType *SubTp,
249
+ ArrayRef<const Value *> Args = {},
250
+ const Instruction *CxtI = nullptr ) const override ;
250
251
251
252
bool isProfitableToSinkOperands (Instruction *I,
252
- SmallVectorImpl<Use *> &Ops) const ;
253
+ SmallVectorImpl<Use *> &Ops) const override ;
253
254
254
255
bool areInlineCompatible (const Function *Caller,
255
- const Function *Callee) const ;
256
+ const Function *Callee) const override ;
256
257
257
- int getInliningLastCallToStaticBonus () const ;
258
- unsigned getInliningThresholdMultiplier () const { return 11 ; }
259
- unsigned adjustInliningThreshold (const CallBase *CB) const ;
260
- unsigned getCallerAllocaCost (const CallBase *CB, const AllocaInst *AI) const ;
258
+ int getInliningLastCallToStaticBonus () const override ;
259
+ unsigned getInliningThresholdMultiplier () const override { return 11 ; }
260
+ unsigned adjustInliningThreshold (const CallBase *CB) const override ;
261
+ unsigned getCallerAllocaCost (const CallBase *CB,
262
+ const AllocaInst *AI) const override ;
261
263
262
- int getInlinerVectorBonusPercent () const { return InlinerVectorBonusPercent; }
264
+ int getInlinerVectorBonusPercent () const override {
265
+ return InlinerVectorBonusPercent;
266
+ }
263
267
264
268
InstructionCost
265
269
getArithmeticReductionCost (unsigned Opcode, VectorType *Ty,
266
270
std::optional<FastMathFlags> FMF,
267
- TTI::TargetCostKind CostKind) const ;
271
+ TTI::TargetCostKind CostKind) const override ;
268
272
269
- InstructionCost getIntrinsicInstrCost (const IntrinsicCostAttributes &ICA,
270
- TTI::TargetCostKind CostKind) const ;
271
- InstructionCost getMinMaxReductionCost (Intrinsic::ID IID, VectorType *Ty,
272
- FastMathFlags FMF,
273
- TTI::TargetCostKind CostKind) const ;
273
+ InstructionCost
274
+ getIntrinsicInstrCost (const IntrinsicCostAttributes &ICA,
275
+ TTI::TargetCostKind CostKind) const override ;
276
+ InstructionCost
277
+ getMinMaxReductionCost (Intrinsic::ID IID, VectorType *Ty, FastMathFlags FMF,
278
+ TTI::TargetCostKind CostKind) const override ;
274
279
275
280
// / Data cache line size for LoopDataPrefetch pass. Has no use before GFX12.
276
281
unsigned getCacheLineSize () const override { return 128 ; }
@@ -283,7 +288,7 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
283
288
bool shouldPrefetchAddressSpace (unsigned AS) const override ;
284
289
void collectKernelLaunchBounds (
285
290
const Function &F,
286
- SmallVectorImpl<std::pair<StringRef, int64_t >> &LB) const ;
291
+ SmallVectorImpl<std::pair<StringRef, int64_t >> &LB) const override ;
287
292
};
288
293
289
294
} // end namespace llvm
0 commit comments