[llvm] [DirectX] Add GlobalDCE pass after finalize linkage pass in DirectX backend (PR #151071)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 4 11:03:40 PDT 2025
================
@@ -20,13 +20,13 @@ using namespace llvm;
static bool finalizeLinkage(Module &M) {
bool MadeChange = false;
- // Convert private global variables to internal linkage.
- for (GlobalVariable &GV : M.globals()) {
- if (GV.hasPrivateLinkage()) {
+ // Convert private globals and external globals with no usage to internal
+ // linkage.
+ for (GlobalVariable &GV : M.globals())
+ if (GV.hasPrivateLinkage() || (GV.hasExternalLinkage() && GV.use_empty())) {
----------------
farzonl wrote:
If we use GlobalDCE we don't need to special case, things just work by converting to internal.
https://github.com/llvm/llvm-project/pull/151071
More information about the llvm-commits
mailing list