[llvm] [AsmPrinter] Always emit global equivalents if there is non-global uses (PR #145648)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 25 00:43:50 PDT 2025


================
@@ -2209,9 +2219,9 @@ void AsmPrinter::emitGlobalGOTEquivs() {
 
   SmallVector<const GlobalVariable *, 8> FailedCandidates;
   for (auto &I : GlobalGOTEquivs) {
-    const GlobalVariable *GV = I.second.first;
-    unsigned Cnt = I.second.second;
-    if (Cnt)
+    const GlobalVariable *GV = I.second.GV;
+    unsigned Cnt = I.second.NumUses;
+    if (Cnt > 0 && !I.second.HasNonGlobalUsers)
----------------
nikic wrote:

I'm confused by this. I would have expected the check here to be this instead?
```suggestion
    if (Cnt > 0 || I.second.HasNonGlobalUsers)
```

https://github.com/llvm/llvm-project/pull/145648


More information about the llvm-commits mailing list