[llvm] [NFC] Add comment to describe the intention use of newly added `avail-extern-gv-in-addrspace-to-local` (PR #144911)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 19 08:16:05 PDT 2025


https://github.com/shiltian created https://github.com/llvm/llvm-project/pull/144911

None

>From ad84e875bddcb3ef2491d212b208e6d0db3f3b3d Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Thu, 19 Jun 2025 11:14:58 -0400
Subject: [PATCH] [NFC] Add comment to describe the intention use of newly
 added `avail-extern-gv-in-addrspace-to-local`

---
 llvm/lib/Transforms/IPO/ElimAvailExtern.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp b/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp
index bc98f994f490c..538755e66f9cf 100644
--- a/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp
+++ b/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp
@@ -35,6 +35,10 @@ static cl::opt<bool> ConvertToLocal(
     cl::desc("Convert available_externally into locals, renaming them "
              "to avoid link-time clashes."));
 
+// This option was originally introduced to correctly support the lowering of
+// LDS variables for AMDGPU when ThinLTO is enabled. It can be utilized for
+// other purposes, but make sure it is safe to do so, as privatizing global
+// variables is generally not safe.
 static cl::opt<unsigned> ConvertGlobalVariableInAddrSpace(
     "avail-extern-gv-in-addrspace-to-local", cl::Hidden,
     cl::desc(



More information about the llvm-commits mailing list