diff options
author | Arthur Eubanks <aeubanks@google.com> | 2023-09-19 16:36:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-19 16:36:30 -0700 |
commit | 64573da4bf0bc7883e6d4d3debc60daf665d78b8 (patch) | |
tree | c3d636a43e088d4507e60aa24a9dff52f7d7c3d0 /llvm/lib/LTO/LTOBackend.cpp | |
parent | 96ea48ff5dcba46af350f5300eafd7f7394ba606 (diff) | |
download | llvm-64573da4bf0bc7883e6d4d3debc60daf665d78b8.zip llvm-64573da4bf0bc7883e6d4d3debc60daf665d78b8.tar.gz llvm-64573da4bf0bc7883e6d4d3debc60daf665d78b8.tar.bz2 |
[IR] Add "Large Data Threshold" module metadata (#66797)
This allows us to not have to pass -mllvm flags to set the large data
threshold for (in-LLD/not-distributed) ThinLTO.
Follows https://reviews.llvm.org/D52322, which did the same for the code
model.
Since the large data threshold is tied to the code model and we disallow
mixing different code models, do the same for the large data threshold.
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 29e2887..ccc4276 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -225,7 +225,12 @@ createTargetMachine(const Config &Conf, const Target *TheTarget, Module &M) { std::unique_ptr<TargetMachine> TM(TheTarget->createTargetMachine( TheTriple, Conf.CPU, Features.getString(), Conf.Options, RelocModel, CodeModel, Conf.CGOptLevel)); + assert(TM && "Failed to create target machine"); + + if (std::optional<uint64_t> LargeDataThreshold = M.getLargeDataThreshold()) + TM->setLargeDataThreshold(*LargeDataThreshold); + return TM; } |