aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2023-12-14 09:28:27 -0800
committerGitHub <noreply@github.com>2023-12-14 09:28:27 -0800
commit5e38ba26d2189267a95b4dde4d7b4ae85260eaf3 (patch)
tree0bf49417fef1ad00350cc8539cc0ce5ca1e8195e /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parentfedc54bf35b378ab3418ba0f36c1df476aef5aca (diff)
downloadllvm-5e38ba26d2189267a95b4dde4d7b4ae85260eaf3.zip
llvm-5e38ba26d2189267a95b4dde4d7b4ae85260eaf3.tar.gz
llvm-5e38ba26d2189267a95b4dde4d7b4ae85260eaf3.tar.bz2
[X86] Respect code models more when determining if a global reference can fit in 32 bits (#75386)
For non-GlobalValue references, the small and medium code models can use 32 bit constants. For GlobalValue references, use TargetMachine::isLargeGlobalObject(). Look through aliases for determining if a GlobalValue is small or large. Even the large code model can reference small objects with 32 bit constants as long as we're in no-pic mode, or if the reference is offset from the GOT.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 27d47aa..18f4d54 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -645,7 +645,7 @@ getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind,
Name = ".rodata.cst";
Name += utostr(EntrySize);
} else {
- Name = getSectionPrefixForGlobal(Kind, TM.isLargeGlobalObject(GO));
+ Name = getSectionPrefixForGlobal(Kind, TM.isLargeGlobalValue(GO));
}
bool HasPrefix = false;
@@ -765,7 +765,7 @@ getGlobalObjectInfo(const GlobalObject *GO, const TargetMachine &TM) {
Group = C->getName();
IsComdat = C->getSelectionKind() == Comdat::Any;
}
- if (TM.isLargeGlobalObject(GO))
+ if (TM.isLargeGlobalValue(GO))
Flags |= ELF::SHF_X86_64_LARGE;
return {Group, IsComdat, Flags};
}