[llvm] [X86] Respect code models more when determining if a global reference can fit in 32 bits (PR #75386)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 20:25:15 PST 2023


================
@@ -91,9 +91,8 @@ X86Subtarget::classifyLocalReference(const GlobalValue *GV) const {
       if (CM == CodeModel::Large)
         return X86II::MO_GOTOFF;
       // Large objects use GOTOFF, otherwise use RIP-rel access.
-      if (auto *GO = dyn_cast_or_null<GlobalObject>(GV))
-        return TM.isLargeGlobalObject(GO) ? X86II::MO_GOTOFF
-                                          : X86II::MO_NO_FLAG;
+      if (GV)
+        return TM.isLargeGlobalValue(GV) ? X86II::MO_GOTOFF : X86II::MO_NO_FLAG;
       // For non-GlobalObjects, the small and medium code models treat them as
----------------
aeubanks wrote:

updated comment

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


More information about the llvm-commits mailing list