@@ -862,48 +862,6 @@ class AMDGPULowerModuleLDS {
862
862
return N;
863
863
}
864
864
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
-
907
865
DenseMap<Function *, GlobalVariable *> lowerDynamicLDSVariables (
908
866
Module &M, LDSUsesInfoTy &LDSUsesInfo,
909
867
DenseSet<Function *> const &KernelsThatIndirectlyAllocateDynamicLDS,
@@ -1059,7 +1017,7 @@ class AMDGPULowerModuleLDS {
1059
1017
//
1060
1018
// TODO: We could filter out subgraphs that do not access LDS globals.
1061
1019
for (Function *F : KernelsThatAllocateTableLDS)
1062
- removeNoLdsKernelIdFromReachable (CG, F);
1020
+ removeFnAttrFromReachable (CG, F, " amdgpu-no-lds-kernel-id " );
1063
1021
}
1064
1022
1065
1023
DenseMap<Function *, GlobalVariable *> KernelToCreatedDynamicLDS =
0 commit comments