[llvm] [AMDGPU] Update code object metadata for kernarg preload (PR #134666)

Austin Kerbow via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 29 00:03:57 PDT 2025


================
@@ -176,6 +179,37 @@ AMDGPUFunctionArgInfo AMDGPUFunctionArgInfo::fixedABILayout() {
   return AI;
 }
 
+SmallVector<const KernArgPreloadDescriptor *, 4>
+AMDGPUFunctionArgInfo::getPreloadDescriptorsForArgIdx(unsigned ArgIdx) const {
+  SmallVector<const KernArgPreloadDescriptor *, 4> Results;
+  for (const auto &KV : PreloadKernArgs) {
+    if (KV.second.OrigArgIdx == ArgIdx)
+      Results.push_back(&KV.second);
+  }
+
+  stable_sort(Results, [](const KernArgPreloadDescriptor *A,
----------------
kerbowa wrote:

Are you saying this function should return an indexed map? I don't think I can iterate over it efficiently. 

If what you mean is that `PreloadKernArgs` should be indexed by the OrigArgIdx I considered this initially but it would require refactoring the isel code and I didn't think it would be worth much performance since the number of parts per arg is usually very low. I can do the refactor if you think it's worth it though, let me know.

https://github.com/llvm/llvm-project/pull/134666


More information about the llvm-commits mailing list