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

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 16:25:25 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
----------------
rnk wrote:

This comment seems stale. What does it mean if GV is null? Does that represent a reference to a local label, something like a constant pool?

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


More information about the llvm-commits mailing list