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