[PATCH] D122600: [AMDGPU][NFC]: Remove unnecessary MFI functions

Changpeng Fang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 10:50:27 PDT 2022


cfang created this revision.
cfang added reviewers: arsenm, bcahoon.
Herald added subscribers: hsmhsm, foad, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
Herald added a project: All.
cfang requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

hasHostcallPtr() and hasHeapPtr() are only used in metadata emit. However, we can use the corresponding function attributes directly instead introducing the functions.


https://reviews.llvm.org/D122600

Files:
  llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
  llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
  llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h


Index: llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
===================================================================
--- llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
+++ llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
@@ -421,8 +421,6 @@
   // Pointer to where the ABI inserts special kernel arguments separate from the
   // user arguments. This is an offset from the KernargSegmentPtr.
   bool ImplicitArgPtr : 1;
-  bool HostcallPtr : 1;
-  bool HeapPtr : 1;
 
   bool MayNeedAGPRs : 1;
 
@@ -698,14 +696,6 @@
     return ImplicitArgPtr;
   }
 
-  bool hasHostcallPtr() const {
-    return HostcallPtr;
-  }
-
-  bool hasHeapPtr () const {
-    return HeapPtr;
-  }
-
   bool hasImplicitBufferPtr() const {
     return ImplicitBufferPtr;
   }
Index: llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
@@ -47,8 +47,6 @@
     WorkItemIDZ(false),
     ImplicitBufferPtr(false),
     ImplicitArgPtr(false),
-    HostcallPtr(false),
-    HeapPtr(false),
     GITPtrHigh(0xffffffff),
     HighBitsOf32BitAddress(0),
     GDSSize(0) {
@@ -143,12 +141,6 @@
 
     if (!F.hasFnAttribute("amdgpu-no-dispatch-id"))
       DispatchID = true;
-
-    if (!F.hasFnAttribute("amdgpu-no-hostcall-ptr"))
-      HostcallPtr = true;
-
-    if (!F.hasFnAttribute("amdgpu-no-heap-ptr"))
-      HeapPtr = true;
   }
 
   // FIXME: This attribute is a hack, we just need an analysis on the function
Index: llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp
@@ -823,7 +823,7 @@
     if (M->getNamedMetadata("llvm.printf.fmts"))
       emitKernelArg(DL, Int8PtrTy, Align(8), "hidden_printf_buffer", Offset,
                     Args);
-    else if (MFI.hasHostcallPtr()) {
+    else if (!Func.hasFnAttribute("amdgpu-no-hostcall-ptr")) {
       // The printf runtime binding pass should have ensured that hostcall and
       // printf are not used in the same module.
       assert(!M->getNamedMetadata("llvm.printf.fmts"));
@@ -1019,7 +1019,7 @@
   } else
     Offset += 8; // Skipped.
 
-  if (MFI.hasHostcallPtr()) {
+  if (!Func.hasFnAttribute("amdgpu-no-hostcall-ptr")) {
     emitKernelArg(DL, Int8PtrTy, Align(8), "hidden_hostcall_buffer", Offset,
                   Args);
   } else
@@ -1028,7 +1028,7 @@
   emitKernelArg(DL, Int8PtrTy, Align(8), "hidden_multigrid_sync_arg", Offset,
                 Args);
 
-  if (MFI.hasHeapPtr())
+  if (!Func.hasFnAttribute("amdgpu-no-heap-ptr")) {
     emitKernelArg(DL, Int8PtrTy, Align(8), "hidden_heap_v1", Offset, Args);
   else
     Offset += 8; // Skipped.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122600.418642.patch
Type: text/x-patch
Size: 2849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220328/ed660d93/attachment.bin>


More information about the llvm-commits mailing list