Index: lld/trunk/ELF/Config.h =================================================================== --- lld/trunk/ELF/Config.h +++ lld/trunk/ELF/Config.h @@ -92,6 +92,7 @@ llvm::StringRef Fini; llvm::StringRef Init; llvm::StringRef LTOAAPipeline; + llvm::StringRef LTOCSProfileFile; llvm::StringRef LTONewPmPasses; llvm::StringRef LTOObjPath; llvm::StringRef LTOSampleProfile; @@ -151,6 +152,7 @@ bool HasDynSymTab; bool IgnoreDataAddressEquality; bool IgnoreFunctionAddressEquality; + bool LTOCSProfileGenerate; bool LTODebugPassManager; bool LTONewPassManager; bool MergeArmExidx; Index: lld/trunk/ELF/Driver.cpp =================================================================== --- lld/trunk/ELF/Driver.cpp +++ lld/trunk/ELF/Driver.cpp @@ -800,6 +800,8 @@ Args.hasArg(OPT_ignore_function_address_equality); Config->Init = Args.getLastArgValue(OPT_init, "_init"); Config->LTOAAPipeline = Args.getLastArgValue(OPT_lto_aa_pipeline); + Config->LTOCSProfileGenerate = Args.hasArg(OPT_lto_cs_profile_generate); + Config->LTOCSProfileFile = Args.getLastArgValue(OPT_lto_cs_profile_file); Config->LTODebugPassManager = Args.hasArg(OPT_lto_debug_pass_manager); Config->LTONewPassManager = Args.hasArg(OPT_lto_new_pass_manager); Config->LTONewPmPasses = Args.getLastArgValue(OPT_lto_newpm_passes); Index: lld/trunk/ELF/LTO.cpp =================================================================== --- lld/trunk/ELF/LTO.cpp +++ lld/trunk/ELF/LTO.cpp @@ -104,6 +104,9 @@ C.DebugPassManager = Config->LTODebugPassManager; C.DwoDir = Config->DwoDir; + C.CSIRProfile = Config->LTOCSProfileFile; + C.RunCSIRInstr = Config->LTOCSProfileGenerate; + if (Config->EmitLLVM) { C.PostInternalizeModuleHook = [](size_t Task, const Module &M) { if (std::unique_ptr OS = openFile(Config->OutputFile)) Index: lld/trunk/ELF/Options.td =================================================================== --- lld/trunk/ELF/Options.td +++ lld/trunk/ELF/Options.td @@ -444,6 +444,10 @@ HelpText<"Optimization level for LTO">; def lto_partitions: J<"lto-partitions=">, HelpText<"Number of LTO codegen partitions">; +def lto_cs_profile_generate: F<"lto-cs-profile-generate">, + HelpText<"Perform context senstive PGO instrumentation">; +def lto_cs_profile_file: J<"lto-cs-profile-file=">, + HelpText<"Context sensitive profile file path">; def lto_sample_profile: J<"lto-sample-profile=">, HelpText<"Sample profile file path">; def disable_verify: F<"disable-verify">; @@ -472,6 +476,10 @@ def: F<"plugin-opt=new-pass-manager">, Alias, HelpText<"Alias for -lto-new-pass-manager">; def plugin_opt_obj_path_eq: J<"plugin-opt=obj-path=">; +def: F<"plugin-opt=cs-profile-generate">, + Alias, HelpText<"Alias for -lto-cs-profile-generate">; +def: J<"plugin-opt=cs-profile-path=">, + Alias, HelpText<"Alias for -lto-cs-profile-file">; def: J<"plugin-opt=sample-profile=">, Alias, HelpText<"Alias for -lto-sample-profile">; def: F<"plugin-opt=save-temps">, Alias, HelpText<"Alias for -save-temps">;