[llvm] [AMDGPU] Skip lowerNonKernelLDSAccesses if function is declaration. (PR #106975)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 2 05:12:50 PDT 2024


https://github.com/skc7 updated https://github.com/llvm/llvm-project/pull/106975

>From 010b2787204f821f7273b9e4800ff887cdb51d9d Mon Sep 17 00:00:00 2001
From: skc7 <Krishna.Sankisa at amd.com>
Date: Mon, 2 Sep 2024 17:30:49 +0530
Subject: [PATCH] [AMDGPU] Skip lowerNonKernelLDSAccesses if function is
 declaration.

---
 llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
index b2ab7e9c03e528..ca796200ee6c6f 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
@@ -1218,6 +1218,8 @@ bool AMDGPUSwLowerLDS::run() {
     for (auto &K : FuncLDSAccessInfo.NonKernelToLDSAccessMap) {
       Function *Func = K.first;
       DenseSet<GlobalVariable *> &LDSGlobals = K.second;
+      if (Func->isDeclaration() || LDSGlobals.empty())
+        continue;
       SetVector<GlobalVariable *> OrderedLDSGlobals = sortByName(
           std::vector<GlobalVariable *>(LDSGlobals.begin(), LDSGlobals.end()));
       lowerNonKernelLDSAccesses(Func, OrderedLDSGlobals, NKLDSParams);
@@ -1226,6 +1228,8 @@ bool AMDGPUSwLowerLDS::run() {
       auto &K = FuncLDSAccessInfo.NonKernelToLDSAccessMap;
       if (K.find(Func) != K.end())
         continue;
+      if (Func->isDeclaration())
+        continue;
       SetVector<llvm::GlobalVariable *> Vec;
       lowerNonKernelLDSAccesses(Func, Vec, NKLDSParams);
     }



More information about the llvm-commits mailing list