[LoopVectorizer] Propagate underlying instruction to the cloned instances of VPPartia...
[llvm-project.git] / llvm / tools / llvm-reduce / deltas / RunIRPasses.cpp
blobe3af05616fe04b8571299cf75e52371e5fe6cdc3
1 //===- RunIRPasses.cpp ----------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "RunIRPasses.h"
10 #include "Delta.h"
11 #include "llvm/Passes/PassBuilder.h"
12 #include "llvm/Support/CommandLine.h"
13 #include "llvm/Support/ErrorHandling.h"
15 using namespace llvm;
17 extern cl::OptionCategory LLVMReduceOptions;
19 static cl::opt<std::string>
20 PassPipeline("ir-passes",
21 cl::desc("A textual description of the pass pipeline, same as "
22 "what's passed to `opt -passes`."),
23 cl::init("function(sroa,instcombine<no-verify-fixpoint>,gvn,"
24 "simplifycfg,infer-address-spaces)"),
25 cl::cat(LLVMReduceOptions));
27 static void runPasses(Oracle &O, ReducerWorkItem &WorkItem) {
28 Module &Program = WorkItem.getModule();
29 LoopAnalysisManager LAM;
30 FunctionAnalysisManager FAM;
31 CGSCCAnalysisManager CGAM;
32 ModuleAnalysisManager MAM;
34 PassInstrumentationCallbacks PIC;
35 PIC.registerShouldRunOptionalPassCallback(
36 [&](StringRef, Any) { return !O.shouldKeep(); });
37 PassBuilder PB(nullptr, PipelineTuningOptions(), std::nullopt, &PIC);
39 PB.registerModuleAnalyses(MAM);
40 PB.registerCGSCCAnalyses(CGAM);
41 PB.registerFunctionAnalyses(FAM);
42 PB.registerLoopAnalyses(LAM);
43 PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
45 ModulePassManager MPM;
46 if (auto Err = PB.parsePassPipeline(MPM, PassPipeline)) {
47 errs() << toString(std::move(Err)) << "\n";
48 report_fatal_error("Error constructing pass pipeline");
50 MPM.run(Program, MAM);
53 void llvm::runIRPassesDeltaPass(TestRunner &Test) {
54 runDeltaPass(Test, runPasses, "Running passes");