[PATCH] D103655: [AMDGPU] Handle constant LDS uses from different kernels
Mahesha S via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 4 01:20:59 PDT 2021
hsmhsm added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp:279
+ Instruction *I = dyn_cast<Instruction>(U.getUser());
+ return I && I->getFunction() == F;
});
----------------
Probably, we can change
```
Instruction *I = dyn_cast<Instruction>(U.getUser());
return I && I->getFunction() == F;
```
to
```
Instruction *I = cast<Instruction>(U.getUser());
return I->getFunction() == F;
```
================
Comment at: llvm/lib/Target/AMDGPU/Utils/AMDGPULDSUtils.cpp:46
+ for (User *UU : U->users()) {
+ collectFunctionUses(UU, F, InstUsers);
}
----------------
We probably better avoid recursion when it is possible to avoid.
================
Comment at: llvm/lib/Target/AMDGPU/Utils/AMDGPULDSUtils.cpp:53
- return false;
+ collectFunctionUses(C, F, InstUsers);
+ for (Instruction *I : InstUsers) {
----------------
Within the pointer replacement patch https://reviews.llvm.org/D103225, we already have this functionality in place - please take a look at the utility function getFunctionToInstsMap(). Probably we can reuse it here. Once we get FunctionToInstsMap, we can consider only key F, and ignore all others.
If you think it is a good idea, then, I can create new patch by taking out this utility function from https://reviews.llvm.org/D103225. I leave it to you.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103655/new/
https://reviews.llvm.org/D103655
More information about the llvm-commits
mailing list