@@ -862,48 +862,6 @@ class AMDGPULowerModuleLDS {
862862 return N;
863863 }
864864
865- // / Strip "amdgpu-no-lds-kernel-id" from any functions where we may have
866- // / introduced its use. If AMDGPUAttributor ran prior to the pass, we inferred
867- // / the lack of llvm.amdgcn.lds.kernel.id calls.
868- void removeNoLdsKernelIdFromReachable (CallGraph &CG, Function *KernelRoot) {
869- KernelRoot->removeFnAttr (" amdgpu-no-lds-kernel-id" );
870-
871- SmallVector<Function *> WorkList ({CG[KernelRoot]->getFunction ()});
872- SmallPtrSet<Function *, 8 > Visited;
873- bool SeenUnknownCall = false ;
874-
875- while (!WorkList.empty ()) {
876- Function *F = WorkList.pop_back_val ();
877-
878- for (auto &CallRecord : *CG[F]) {
879- if (!CallRecord.second )
880- continue ;
881-
882- Function *Callee = CallRecord.second ->getFunction ();
883- if (!Callee) {
884- if (!SeenUnknownCall) {
885- SeenUnknownCall = true ;
886-
887- // If we see any indirect calls, assume nothing about potential
888- // targets.
889- // TODO: This could be refined to possible LDS global users.
890- for (auto &ExternalCallRecord : *CG.getExternalCallingNode ()) {
891- Function *PotentialCallee =
892- ExternalCallRecord.second ->getFunction ();
893- assert (PotentialCallee);
894- if (!isKernelLDS (PotentialCallee))
895- PotentialCallee->removeFnAttr (" amdgpu-no-lds-kernel-id" );
896- }
897- }
898- } else {
899- Callee->removeFnAttr (" amdgpu-no-lds-kernel-id" );
900- if (Visited.insert (Callee).second )
901- WorkList.push_back (Callee);
902- }
903- }
904- }
905- }
906-
907865 DenseMap<Function *, GlobalVariable *> lowerDynamicLDSVariables (
908866 Module &M, LDSUsesInfoTy &LDSUsesInfo,
909867 DenseSet<Function *> const &KernelsThatIndirectlyAllocateDynamicLDS,
@@ -1059,7 +1017,7 @@ class AMDGPULowerModuleLDS {
10591017 //
10601018 // TODO: We could filter out subgraphs that do not access LDS globals.
10611019 for (Function *F : KernelsThatAllocateTableLDS)
1062- removeNoLdsKernelIdFromReachable (CG, F);
1020+ removeFnAttrFromReachable (CG, F, " amdgpu-no-lds-kernel-id " );
10631021 }
10641022
10651023 DenseMap<Function *, GlobalVariable *> KernelToCreatedDynamicLDS =
0 commit comments