[all-commits] [llvm/llvm-project] 00647a: [X86] Don't respect large data threshold for globa...
Arthur Eubanks via All-commits
all-commits at lists.llvm.org
Wed Jan 17 15:38:44 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 00647a18cee6ced40757d03a8c0d61d7571d22d3
https://github.com/llvm/llvm-project/commit/00647a18cee6ced40757d03a8c0d61d7571d22d3
Author: Arthur Eubanks <aeubanks at google.com>
Date: 2024-01-17 (Wed, 17 Jan 2024)
Changed paths:
M llvm/lib/Target/TargetMachine.cpp
M llvm/test/CodeGen/X86/code-model-elf-sections.ll
Log Message:
-----------
[X86] Don't respect large data threshold for globals with an explicit section (#78348)
If multiple globals are placed in an explicit section, there's a chance
that the large data threshold will cause the different globals to be
inconsistent in whether they're large or small. Mixing sections with
mismatched large section flags can cause undesirable issues like
increased relocation pressure because there may be 32-bit references to
the section in some TUs, but the section is considered large since input
section flags are unioned and other TUs added the large section flag.
An explicit code model on the global still overrides the decision. We
can do this for globals without any references to them, like what we did
with asan_globals in #74514. If we have some precompiled small code
model files where asan_globals is not considered large mixed with
medium/large code model files, that's ok because the section is
considered large and placed farther. However, overriding the code model
for globals in some TUs but not others and having references to them
from code will still result in the above undesired behavior.
This mitigates a whole class of mismatched large section flag issues
like what #77986 was trying to fix.
This ends up not adding the SHF_X86_64_LARGE section flag on explicit
sections in the medium/large code model. This is ok for the large code
model since all references from large text must use 64-bit relocations
anyway.
More information about the All-commits
mailing list