[llvm] 86caf51 - Revert "[amdgpu][nfc] Delete dead code in LowerModuleLDS"
Jon Chesterfield via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 10 16:31:59 PST 2021
Author: Jon Chesterfield
Date: 2021-12-11T00:31:51Z
New Revision: 86caf517bf056685cd1b63817967987662d7247f
URL: https://github.com/llvm/llvm-project/commit/86caf517bf056685cd1b63817967987662d7247f
DIFF: https://github.com/llvm/llvm-project/commit/86caf517bf056685cd1b63817967987662d7247f.diff
LOG: Revert "[amdgpu][nfc] Delete dead code in LowerModuleLDS"
This reverts commit 7b9ab06d10a6a989f76e6c5ecf89d906f838fe7d.
Said code is better removed as part of a larger change.
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp b/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
index bb15d0e7b2b59..894f341bb0851 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
@@ -55,6 +55,20 @@ static cl::opt<bool> SuperAlignLDSGlobals(
namespace {
+SmallPtrSet<GlobalValue *, 32> getUsedList(Module &M) {
+ SmallPtrSet<GlobalValue *, 32> UsedList;
+
+ SmallVector<GlobalValue *, 32> TmpVec;
+ collectUsedGlobalVariables(M, TmpVec, true);
+ UsedList.insert(TmpVec.begin(), TmpVec.end());
+
+ TmpVec.clear();
+ collectUsedGlobalVariables(M, TmpVec, false);
+ UsedList.insert(TmpVec.begin(), TmpVec.end());
+
+ return UsedList;
+}
+
class AMDGPULowerModuleLDS : public ModulePass {
static void removeFromUsedList(Module &M, StringRef Name,
@@ -151,6 +165,8 @@ class AMDGPULowerModuleLDS : public ModulePass {
}
bool runOnModule(Module &M) override {
+ UsedList = getUsedList(M);
+
bool Changed = processUsedLDS(M);
for (Function &F : M.functions()) {
@@ -163,6 +179,7 @@ class AMDGPULowerModuleLDS : public ModulePass {
Changed |= processUsedLDS(M, &F);
}
+ UsedList.clear();
return Changed;
}
More information about the llvm-commits
mailing list