- In D98783, an extra GlobalDCE pass is inserted before the internalization pass to ensure a global variable without users could be internalized even if there are dead users. Instead of inserting a dedicated optimization pass, the dead user checking, i.e. 'use_empty()', should be preceeded with constant dead user removal to ensure an accurate result.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Unit Tests
Time | Test | |
---|---|---|
60 ms | x64 debian > LLVM.tools/llvm-nm::just-symbols.test |
Event Timeline
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | ||
---|---|---|
434 | Maybe do this in the InternalizePass itself? This is a predicate function and it is not expected to change the IR. |
Comment Actions
Instead of inserting GlobalDCE to remove all constant users, call 'removeDeadConstantUsers' directly before 'use_empty' check. That should be the standard way to check whether a global is still in use.
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | ||
---|---|---|
434 | In fact, even there are dead constants removed, the IR won't be changed. IR printer won't be able to print those dead constant users from this GV. |
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | ||
---|---|---|
434 | Agreed, I think this is the right way to do this. |
Maybe do this in the InternalizePass itself? This is a predicate function and it is not expected to change the IR.