[PATCH] D105590: [amdgpu] Remove the GlobalDCE pass prior to the internalization pass.
Michael Liao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 7 13:52:00 PDT 2021
hliao created this revision.
hliao added reviewers: yaxunl, tra, rjmccall, rampitec.
Herald added subscribers: foad, kerbowa, hiraditya, t-tye, tpr, dstuttard, nhaehnle, jvesely, kzhuravl, arsenm.
hliao requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.
- In D98783 <https://reviews.llvm.org/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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105590
Files:
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
Index: llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -431,6 +431,7 @@
if (const Function *F = dyn_cast<Function>(&GV))
return F->isDeclaration() || AMDGPU::isEntryFunctionCC(F->getCallingConv());
+ GV.removeDeadConstantUsers();
return !GV.use_empty();
}
@@ -595,9 +596,6 @@
PM.addPass(AMDGPUPrintfRuntimeBindingPass());
if (InternalizeSymbols) {
- // Global variables may have dead uses which need to be removed.
- // Otherwise these useless global variables will not get internalized.
- PM.addPass(GlobalDCEPass());
PM.addPass(InternalizePass(mustPreserveGV));
}
PM.addPass(AMDGPUPropagateAttributesLatePass(*this));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105590.357069.patch
Type: text/x-patch
Size: 885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210707/eb46f281/attachment.bin>
More information about the llvm-commits
mailing list