From 845cc968e987492bda6a62c9a87cd96cfc631d5b Mon Sep 17 00:00:00 2001 From: Daniel Paoliello Date: Thu, 30 Jan 2025 09:51:43 -0800 Subject: [clang][llvm][aarch64][win] Add a clang flag and module attribute for import call optimization, and remove LLVM flag (#122831) Switches import call optimization from being enabled by an LLVM flag to instead using a module attribute, and creates a new Clang flag that will set that attribute. This addresses the concern raised in the original PR: This change also only creates the Called Global info if the module attribute is present, addressing this concern: --- clang/lib/CodeGen/CodeGenModule.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index a015d64f4065..05879cd486a8 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1293,6 +1293,11 @@ void CodeGenModule::Release() { if (LangOpts.EHAsynch) getModule().addModuleFlag(llvm::Module::Warning, "eh-asynch", 1); + // Emit Import Call section. + if (CodeGenOpts.ImportCallOptimization) + getModule().addModuleFlag(llvm::Module::Warning, "import-call-optimization", + 1); + // Indicate whether this Module was compiled with -fopenmp if (getLangOpts().OpenMP && !getLangOpts().OpenMPSimd) getModule().addModuleFlag(llvm::Module::Max, "openmp", LangOpts.OpenMP); -- cgit v1.2.3