Index: lld/trunk/ELF/Config.h =================================================================== --- lld/trunk/ELF/Config.h +++ lld/trunk/ELF/Config.h @@ -44,6 +44,7 @@ llvm::StringRef Emulation; llvm::StringRef Fini; llvm::StringRef Init; + llvm::StringRef LtoAAPipeline; llvm::StringRef LtoNewPmPasses; llvm::StringRef OutputFile; llvm::StringRef SoName; Index: lld/trunk/ELF/Driver.cpp =================================================================== --- lld/trunk/ELF/Driver.cpp +++ lld/trunk/ELF/Driver.cpp @@ -338,6 +338,7 @@ Config->Entry = getString(Args, OPT_entry); Config->Fini = getString(Args, OPT_fini, "_fini"); Config->Init = getString(Args, OPT_init, "_init"); + Config->LtoAAPipeline = getString(Args, OPT_lto_aa_pipeline); Config->LtoNewPmPasses = getString(Args, OPT_lto_newpm_passes); Config->OutputFile = getString(Args, OPT_o); Config->SoName = getString(Args, OPT_soname); Index: lld/trunk/ELF/LTO.cpp =================================================================== --- lld/trunk/ELF/LTO.cpp +++ lld/trunk/ELF/LTO.cpp @@ -66,6 +66,13 @@ PassBuilder PB(&TM); AAManager AA; + + // Parse a custom AA pipeline if asked to. + if (!PB.parseAAPipeline(AA, Config->LtoAAPipeline)) { + error("Unable to parse AA pipeline description: " + Config->LtoAAPipeline); + return; + } + LoopAnalysisManager LAM; FunctionAnalysisManager FAM; CGSCCAnalysisManager CGAM; Index: lld/trunk/ELF/Options.td =================================================================== --- lld/trunk/ELF/Options.td +++ lld/trunk/ELF/Options.td @@ -260,6 +260,8 @@ // LTO-related options. def lto_jobs : Joined<["--"], "lto-jobs=">, HelpText<"Number of threads to run codegen">; +def lto_aa_pipeline : Joined<["--"], "lto-aa-pipeline=">, + HelpText<"AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes">; def lto_newpm_passes : Joined<["--"], "lto-newpm-passes=">, HelpText<"Passes to run during LTO">; def disable_verify : Flag<["-"], "disable-verify">; Index: lld/trunk/test/ELF/lto/ltopasses-custom.ll =================================================================== --- lld/trunk/test/ELF/lto/ltopasses-custom.ll +++ lld/trunk/test/ELF/lto/ltopasses-custom.ll @@ -1,6 +1,7 @@ ; REQUIRES: x86 ; RUN: llvm-as %s -o %t.o -; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps --lto-newpm-passes=ipsccp -shared +; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -save-temps --lto-aa-pipeline=basic-aa \ +; RUN: --lto-newpm-passes=ipsccp -shared ; RUN: ld.lld -m elf_x86_64 %t.o -o %t2.so -save-temps --lto-newpm-passes=loweratomic -shared ; RUN: llvm-dis %t.so.lto.opt.bc -o - | FileCheck %s ; RUN: llvm-dis %t2.so.lto.opt.bc -o - | FileCheck %s --check-prefix=ATOMIC