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

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 25 02:10:50 PDT 2025


================
@@ -151,8 +151,12 @@ class LLVM_ABI AsmPrinter : public MachineFunctionPass {
 
   /// Map global GOT equivalent MCSymbols to GlobalVariables and keep track of
   /// its number of uses by other globals.
-  using GOTEquivUsePair = std::pair<const GlobalVariable *, unsigned>;
-  MapVector<const MCSymbol *, GOTEquivUsePair> GlobalGOTEquivs;
+  struct GOTEquivUse {
+    const GlobalVariable *GV;
+    unsigned NumUses;
+    bool HasNonGlobalUsers;
----------------
dianqk wrote:

I prefer the latter, because the former would return true for `isGOTEquivalentCandidate` in most scenarios.

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


More information about the llvm-commits mailing list