[PATCH] D125060: [amdgpu] Implement lds kernel id intrinsic

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 16 07:33:28 PDT 2022


arsenm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp:106
+ConstantInt *AMDGPUMachineFunction::getLDSKernelIdMetadata(const Function &F) {
+  auto MD = F.getMetadata("llvm.amdgcn.lds.kernel.id");
+  if (MD && MD->getNumOperands() == 1) {
----------------
I don't like using metadata to pass information from a lowering pass to here, but right now I don't have a better solution


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h:107
 
+  static ConstantInt *getLDSKernelIdMetadata(const Function &F);
+
----------------
Why not return the int value?


================
Comment at: llvm/lib/Target/AMDGPU/SIISelLowering.cpp:2826
+      } else {
+        InputReg = DAG.getUNDEF(ArgVT);
+      }
----------------
This should get a test in abi-attribute-hints-undefined-behavior.ll


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125060/new/

https://reviews.llvm.org/D125060



More information about the llvm-commits mailing list