From 64573da4bf0bc7883e6d4d3debc60daf665d78b8 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Tue, 19 Sep 2023 16:36:30 -0700 Subject: [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. --- llvm/lib/LTO/LTOBackend.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/LTO/LTOBackend.cpp') 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 TM(TheTarget->createTargetMachine( TheTriple, Conf.CPU, Features.getString(), Conf.Options, RelocModel, CodeModel, Conf.CGOptLevel)); + assert(TM && "Failed to create target machine"); + + if (std::optional LargeDataThreshold = M.getLargeDataThreshold()) + TM->setLargeDataThreshold(*LargeDataThreshold); + return TM; } -- cgit v1.1