[llvm] a1bc37c - AMDGPU: Use caller subtarget, not intrinsic declaration

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 13:42:20 PDT 2020


Author: Matt Arsenault
Date: 2020-08-27T16:42:09-04:00
New Revision: a1bc37c9e54e0163bc6ccb7a438a68047310ccff

URL: https://github.com/llvm/llvm-project/commit/a1bc37c9e54e0163bc6ccb7a438a68047310ccff
DIFF: https://github.com/llvm/llvm-project/commit/a1bc37c9e54e0163bc6ccb7a438a68047310ccff.diff

LOG: AMDGPU: Use caller subtarget, not intrinsic declaration

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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPULowerIntrinsics.cpp b/llvm/lib/Target/AMDGPU/AMDGPULowerIntrinsics.cpp
index 3ff1ada720ba..f4640252c9d5 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULowerIntrinsics.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULowerIntrinsics.cpp
@@ -124,7 +124,6 @@ bool AMDGPULowerIntrinsics::makeLIDRangeMetadata(Function &F) const {
     return false;
 
   const TargetMachine &TM = TPC->getTM<TargetMachine>();
-  const AMDGPUSubtarget &ST = AMDGPUSubtarget::get(TM, F);
   bool Changed = false;
 
   for (auto *U : F.users()) {
@@ -132,6 +131,8 @@ bool AMDGPULowerIntrinsics::makeLIDRangeMetadata(Function &F) const {
     if (!CI)
       continue;
 
+    Function *Caller = CI->getParent()->getParent();
+    const AMDGPUSubtarget &ST = AMDGPUSubtarget::get(TM, *Caller);
     Changed |= ST.makeLIDRangeMetadata(CI);
   }
   return Changed;

diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
index 97b15bac774a..867a72291d9a 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h
@@ -243,7 +243,7 @@ class AMDGPUSubtarget {
   /// 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


        


More information about the llvm-commits mailing list