[PATCH] D86717: AMDGPU: Use caller subtarget, not intrinsic declaration

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 08:16:36 PDT 2020


arsenm created this revision.
arsenm added a reviewer: rampitec.
Herald added subscribers: kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: LLVM.
arsenm requested review of this revision.
Herald added a subscriber: wdng.

Intrinsic declarations use the default subtarget, but this should be
using the subtarget for the calling function. I haven't been able to
come up with a case where it matters though.


https://reviews.llvm.org/D86717

Files:
  llvm/lib/Target/AMDGPU/AMDGPULowerIntrinsics.cpp
  llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h


Index: llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
+++ llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
@@ -243,7 +243,7 @@
   /// 2) dimension.
   unsigned getMaxWorkitemID(const Function &Kernel, unsigned Dimension) const;
 
-  /// Creates value range metadata on an workitemid.* inrinsic call or load.
+  /// Creates value range metadata on an workitemid.* intrinsic call or load.
   bool makeLIDRangeMetadata(Instruction *I) const;
 
   /// \returns Number of bytes of arguments that are passed to a shader or
Index: llvm/lib/Target/AMDGPU/AMDGPULowerIntrinsics.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPULowerIntrinsics.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPULowerIntrinsics.cpp
@@ -131,7 +131,9 @@
     if (!CI)
       continue;
 
-    Changed |= AMDGPUSubtarget::get(TM, F).makeLIDRangeMetadata(CI);
+    Function *Caller = CI->getParent()->getParent();
+    const AMDGPUSubtarget &ST = AMDGPUSubtarget::get(TM, *Caller);
+    Changed |= ST.makeLIDRangeMetadata(CI);
   }
   return Changed;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86717.288342.patch
Type: text/x-patch
Size: 1163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200827/8c78d376/attachment.bin>


More information about the llvm-commits mailing list