[llvm] [AsmPrinter] Always emit global equivalents if there is non-global uses (PR #145648)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 25 00:36:48 PDT 2025
================
@@ -740,9 +740,11 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
if (emitSpecialLLVMGlobal(GV))
return;
- // Skip the emission of global equivalents. The symbol can be emitted later
- // on by emitGlobalGOTEquivs in case it turns out to be needed.
- if (GlobalGOTEquivs.count(getSymbol(GV)))
+ // Skip the emission of global equivalents if they are only used by global
+ // values. The symbol can be emitted later on by emitGlobalGOTEquivs in case
+ // it turns out to be needed.
+ if (GlobalGOTEquivs.contains(getSymbol(GV)) &&
+ !GlobalGOTEquivs[getSymbol(GV)].HasNonGlobalUsers)
----------------
arsenm wrote:
Avoid doing the double map lookup
https://github.com/llvm/llvm-project/pull/145648
More information about the llvm-commits
mailing list