[llvm] [AMDGPU] Skip lowerNonKernelLDSAccesses if function is declaration. (PR #106975)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 2 05:05:09 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Chaitanya (skc7)
<details>
<summary>Changes</summary>
This PR skips lowering non-kernel LDS i.e lowerNonKernelLDSAccesses, when function is a declaration or there are no lds globals to process.
---
Full diff: https://github.com/llvm/llvm-project/pull/106975.diff
1 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp (+2)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
index b2ab7e9c03e528..b85cc9cbbc02de 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
@@ -1218,6 +1218,7 @@ 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 +1227,7 @@ 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);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/106975
More information about the llvm-commits
mailing list