[llvm] [AMDGPU] Enable kernarg preloading by default on gfx940 (PR #110691)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 1 12:35:23 PDT 2024
================
@@ -1014,12 +1014,49 @@ struct AAAMDGPUNoAGPR
const char AAAMDGPUNoAGPR::ID = 0;
+static unsigned getMaxNumPreloadArgs(const Function &F, const DataLayout &DL,
+ const TargetMachine &TM) {
+ const GCNSubtarget &ST = TM.getSubtarget<GCNSubtarget>(F);
+ unsigned Offset = 0;
+ unsigned ArgsToPreload = 0;
+ for (const auto &Arg : F.args()) {
+ if (Arg.hasByRefAttr())
+ break;
+
+ Type *Ty = Arg.getType();
+ Align ArgAlign = DL.getABITypeAlign(Ty);
+ auto Size = DL.getTypeAllocSize(Ty);
----------------
arsenm wrote:
The allocation size doesn't directly map to number of registers. Really this should look at what ComputeValueVTs does to get the number of registers.
I think it would be better to be more precise (and maybe even make the inreg a hard requirement to respect)
https://github.com/llvm/llvm-project/pull/110691
More information about the llvm-commits
mailing list