From a42787d10854fe2fdaca019634aed03adebcb864 Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Tue, 26 Sep 2023 09:44:31 -0700 Subject: [clang] Add -mlarge-data-threshold for x86_64 medium code model (#66839) Error if not used with x86_64. Warn if not used with the medium code model (can update if other code models end up using this). Set TargetMachine option and add module flag. --- clang/lib/CodeGen/CodeGenModule.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 130cedcd4f2b..25945759e23f 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1146,6 +1146,12 @@ void CodeGenModule::Release() { if (CM != ~0u) { llvm::CodeModel::Model codeModel = static_cast(CM); getModule().setCodeModel(codeModel); + + if (CM == llvm::CodeModel::Medium && + Context.getTargetInfo().getTriple().getArch() == + llvm::Triple::x86_64) { + getModule().setLargeDataThreshold(getCodeGenOpts().LargeDataThreshold); + } } } -- cgit v1.2.3