/// manager as the old one doesn't have this ability.
std::string OptPipeline;
+ // If this field is set, it has the same effect of specifying an AA pipeline
+ // identified by the string. Only works with the new pass manager, in
+ // conjunction OptPipeline.
+ std::string AAPipeline;
+
/// Setting this field will replace target triples in input files with this
/// triple.
std::string OverrideTriple;
CGOptLevel(std::move(X.CGOptLevel)), OptLevel(std::move(X.OptLevel)),
DisableVerify(std::move(X.DisableVerify)),
OptPipeline(std::move(X.OptPipeline)),
+ AAPipeline(std::move(X.AAPipeline)),
OverrideTriple(std::move(X.OverrideTriple)),
DefaultTriple(std::move(X.DefaultTriple)),
ShouldDiscardValueNames(std::move(X.ShouldDiscardValueNames)),
OptLevel = std::move(X.OptLevel);
DisableVerify = std::move(X.DisableVerify);
OptPipeline = std::move(X.OptPipeline);
+ AAPipeline = std::move(X.AAPipeline);
OverrideTriple = std::move(X.OverrideTriple);
DefaultTriple = std::move(X.DefaultTriple);
ShouldDiscardValueNames = std::move(X.ShouldDiscardValueNames);
static void runNewPMCustomPasses(Module &Mod, TargetMachine *TM,
std::string PipelineDesc,
+ std::string AAPipelineDesc,
bool DisableVerify) {
PassBuilder PB(TM);
AAManager AA;
+
+ // Parse a custom AA pipeline if asked to.
+ if (!AAPipelineDesc.empty())
+ if (!PB.parseAAPipeline(AA, AAPipelineDesc))
+ report_fatal_error("unable to parse AA pipeline description: " +
+ AAPipelineDesc);
+
LoopAnalysisManager LAM;
FunctionAnalysisManager FAM;
CGSCCAnalysisManager CGAM;
if (Conf.OptPipeline.empty())
runOldPMPasses(Conf, Mod, TM, IsThinLto);
else
- runNewPMCustomPasses(Mod, TM, Conf.OptPipeline, Conf.DisableVerify);
+ runNewPMCustomPasses(Mod, TM, Conf.OptPipeline, Conf.AAPipeline,
+ Conf.DisableVerify);
return !Conf.PostOptModuleHook || Conf.PostOptModuleHook(Task, Mod);
}
; Try a custom pipeline
; RUN: llvm-lto2 %t1.bc -o %t.o -save-temps \
-; RUN: -r %t1.bc,patatino,px -opt-pipeline loweratomic
+; RUN: -r %t1.bc,patatino,px -opt-pipeline loweratomic \
+; RUN: -aa-pipeline basic-aa
; RUN: llvm-dis < %t.o.0.4.opt.bc | FileCheck %s --check-prefix=CUSTOM
target triple = "x86_64-unknown-linux-gnu"
; CUSTOM-NEXT: ret void
; CUSTOM-NEXT: }
-; Check that invalid pipeline are caught as errors.
-; RUN: not llvm-lto2 %t1.bc -o %t.o -save-temps \
+; Check that invalid pipelines are caught as errors.
+; RUN: not llvm-lto2 %t1.bc -o %t.o \
; RUN: -r %t1.bc,patatino,px -opt-pipeline foogoo 2>&1 | \
; RUN: FileCheck %s --check-prefix=ERR
; ERR: LLVM ERROR: unable to parse pass pipeline description: foogoo
+
+; RUN: not llvm-lto2 %t1.bc -o %t.o \
+; RUN: -r %t1.bc,patatino,px -aa-pipeline patatino \
+; RUN: -opt-pipeline loweratomic 2>&1 | \
+; RUN: FileCheck %s --check-prefix=AAERR
+
+; AAERR: LLVM ERROR: unable to parse AA pipeline description: patatino
cl::desc("Optimizer Pipeline"),
cl::value_desc("pipeline"));
+static cl::opt<std::string> AAPipeline("aa-pipeline",
+ cl::desc("Alias Analysis Pipeline"),
+ cl::value_desc("aapipeline"));
+
static cl::opt<bool> SaveTemps("save-temps", cl::desc("Save temporary files"));
static cl::opt<bool>
// Run a custom pipeline, if asked for.
Conf.OptPipeline = OptPipeline;
+ Conf.AAPipeline = AAPipeline;
ThinBackend Backend;
if (ThinLTODistributedIndexes)