168 changes: 84 additions & 84 deletions llvm/unittests/Analysis/CGSCCPassManagerTest.cpp

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions llvm/unittests/IR/PassBuilderCallbacksTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,9 @@ class PassBuilderCallbacksTest<PassManager<
"exit:\n"
" ret void\n"
"}\n")),
CallbacksHandle(), PB(false, nullptr, PipelineTuningOptions(), None,
&CallbacksHandle.Callbacks),
PM(true), LAM(), FAM(), CGAM(), AM() {
CallbacksHandle(),
PB(nullptr, PipelineTuningOptions(), None, &CallbacksHandle.Callbacks),
PM(), LAM(), FAM(), CGAM(), AM() {

EXPECT_TRUE(&CallbacksHandle.Callbacks ==
PB.getPassInstrumentationCallbacks());
Expand Down Expand Up @@ -1278,8 +1278,7 @@ TEST_F(LoopCallbacksTest, PassUtilities) {
TEST_F(ModuleCallbacksTest, ParseTopLevelPipeline) {
PB.registerParseTopLevelPipelineCallback(
[this](ModulePassManager &MPM,
ArrayRef<PassBuilder::PipelineElement> Pipeline,
bool DebugLogging) {
ArrayRef<PassBuilder::PipelineElement> Pipeline) {
auto &FirstName = Pipeline.front().Name;
auto &InnerPipeline = Pipeline.front().InnerPipeline;
if (FirstName == "another-pipeline") {
Expand Down
24 changes: 12 additions & 12 deletions llvm/unittests/IR/PassManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,11 @@ TEST_F(PassManagerTest, Basic) {
int AnalyzedFunctionCount1 = 0;
{
// Pointless scoped copy to test move assignment.
ModulePassManager NestedMPM(/*DebugLogging*/ true);
ModulePassManager NestedMPM;
FunctionPassManager FPM;
{
// Pointless scope to test move assignment.
FunctionPassManager NestedFPM(/*DebugLogging*/ true);
FunctionPassManager NestedFPM;
NestedFPM.addPass(TestFunctionPass(FunctionPassRunCount1,
AnalyzedInstrCount1,
AnalyzedFunctionCount1, MAM));
Expand All @@ -463,7 +463,7 @@ TEST_F(PassManagerTest, Basic) {
int AnalyzedInstrCount2 = 0;
int AnalyzedFunctionCount2 = 0;
{
FunctionPassManager FPM(/*DebugLogging*/ true);
FunctionPassManager FPM;
FPM.addPass(TestFunctionPass(FunctionPassRunCount2, AnalyzedInstrCount2,
AnalyzedFunctionCount2, MAM));
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
Expand All @@ -476,7 +476,7 @@ TEST_F(PassManagerTest, Basic) {
int AnalyzedInstrCount3 = 0;
int AnalyzedFunctionCount3 = 0;
{
FunctionPassManager FPM(/*DebugLogging*/ true);
FunctionPassManager FPM;
FPM.addPass(TestFunctionPass(FunctionPassRunCount3, AnalyzedInstrCount3,
AnalyzedFunctionCount3, MAM));
FPM.addPass(TestInvalidationFunctionPass("f"));
Expand All @@ -502,7 +502,7 @@ TEST_F(PassManagerTest, Basic) {
int AnalyzedInstrCount5 = 0;
int AnalyzedFunctionCount5 = 0;
{
FunctionPassManager FPM(/*DebugLogging*/ true);
FunctionPassManager FPM;
FPM.addPass(TestInvalidationFunctionPass("f"));
FPM.addPass(TestFunctionPass(FunctionPassRunCount5, AnalyzedInstrCount5,
AnalyzedFunctionCount5, MAM,
Expand Down Expand Up @@ -724,8 +724,8 @@ TEST_F(PassManagerTest, IndirectAnalysisInvalidation) {
FAM.registerPass([&] { return PassInstrumentationAnalysis(&PIC); });

int InstrCount = 0, FunctionCount = 0;
ModulePassManager MPM(/*DebugLogging*/ true);
FunctionPassManager FPM(/*DebugLogging*/ true);
ModulePassManager MPM;
FunctionPassManager FPM;
// First just use the analysis to get the instruction count, and preserve
// everything.
FPM.addPass(LambdaPass([&](Function &F, FunctionAnalysisManager &AM) {
Expand Down Expand Up @@ -768,7 +768,7 @@ TEST_F(PassManagerTest, IndirectAnalysisInvalidation) {
// invalidation to occur, which will force yet another invalidation of the
// indirect function-level analysis as the module analysis it depends on gets
// invalidated.
FunctionPassManager FPM2(/*DebugLogging*/ true);
FunctionPassManager FPM2;
FPM2.addPass(LambdaPass([&](Function &F, FunctionAnalysisManager &AM) {
auto &DoublyIndirectResult =
AM.getResult<TestDoublyIndirectFunctionAnalysis>(F);
Expand Down Expand Up @@ -824,7 +824,7 @@ TEST_F(PassManagerTest, FunctionPassCFGChecker) {

auto *F = M->getFunction("foo");
FunctionAnalysisManager FAM;
FunctionPassManager FPM(/*DebugLogging*/ true);
FunctionPassManager FPM;
PassInstrumentationCallbacks PIC;
StandardInstrumentations SI(/*DebugLogging*/ true);
SI.registerCallbacks(PIC, &FAM);
Expand Down Expand Up @@ -870,7 +870,7 @@ TEST_F(PassManagerTest, FunctionPassCFGCheckerInvalidateAnalysis) {

auto *F = M->getFunction("foo");
FunctionAnalysisManager FAM;
FunctionPassManager FPM(/*DebugLogging*/ true);
FunctionPassManager FPM;
PassInstrumentationCallbacks PIC;
StandardInstrumentations SI(/*DebugLogging*/ true);
SI.registerCallbacks(PIC, &FAM);
Expand Down Expand Up @@ -935,7 +935,7 @@ TEST_F(PassManagerTest, FunctionPassCFGCheckerWrapped) {

auto *F = M->getFunction("foo");
FunctionAnalysisManager FAM;
FunctionPassManager FPM(/*DebugLogging*/ true);
FunctionPassManager FPM;
PassInstrumentationCallbacks PIC;
StandardInstrumentations SI(/*DebugLogging*/ true);
SI.registerCallbacks(PIC, &FAM);
Expand All @@ -944,7 +944,7 @@ TEST_F(PassManagerTest, FunctionPassCFGCheckerWrapped) {
FAM.registerPass([&] { return AssumptionAnalysis(); });
FAM.registerPass([&] { return TargetIRAnalysis(); });

FunctionPassManager InnerFPM(/*DebugLogging*/ true);
FunctionPassManager InnerFPM;
InnerFPM.addPass(SimplifyCFGPass());

FPM.addPass(TestSimplifyCFGWrapperPass(InnerFPM));
Expand Down
56 changes: 28 additions & 28 deletions llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class LoopPassManagerTest : public ::testing::Test {
};

TEST_F(LoopPassManagerTest, Basic) {
ModulePassManager MPM(true);
ModulePassManager MPM;
::testing::InSequence MakeExpectationsSequenced;

// First we just visit all the loops in all the functions and get their
Expand All @@ -350,9 +350,9 @@ TEST_F(LoopPassManagerTest, Basic) {
EXPECT_CALL(MLAHandle, run(HasName("loop.g.0"), _, _));
// Wire the loop pass through pass managers into the module pipeline.
{
LoopPassManager LPM(true);
LoopPassManager LPM;
LPM.addPass(MLPHandle.getPass());
FunctionPassManager FPM(true);
FunctionPassManager FPM;
FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM)));
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
}
Expand All @@ -376,10 +376,10 @@ TEST_F(LoopPassManagerTest, Basic) {
.WillOnce(Invoke(getLoopAnalysisResult));
// Wire two loop pass runs into the module pipeline.
{
LoopPassManager LPM(true);
LoopPassManager LPM;
LPM.addPass(MLPHandle.getPass());
LPM.addPass(MLPHandle.getPass());
FunctionPassManager FPM(true);
FunctionPassManager FPM;
FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM)));
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
}
Expand All @@ -389,8 +389,8 @@ TEST_F(LoopPassManagerTest, Basic) {
}

TEST_F(LoopPassManagerTest, FunctionPassInvalidationOfLoopAnalyses) {
ModulePassManager MPM(true);
FunctionPassManager FPM(true);
ModulePassManager MPM;
FunctionPassManager FPM;
// We process each function completely in sequence.
::testing::Sequence FSequence, GSequence;

Expand Down Expand Up @@ -473,7 +473,7 @@ TEST_F(LoopPassManagerTest, FunctionPassInvalidationOfLoopAnalyses) {
}

TEST_F(LoopPassManagerTest, ModulePassInvalidationOfLoopAnalyses) {
ModulePassManager MPM(true);
ModulePassManager MPM;
::testing::InSequence MakeExpectationsSequenced;

// First, force the analysis result to be computed for each loop.
Expand Down Expand Up @@ -564,8 +564,8 @@ TEST_F(LoopPassManagerTest, ModulePassInvalidationOfLoopAnalyses) {
// become invalid, the analysis proxy itself becomes invalid and we clear all
// loop analysis results.
TEST_F(LoopPassManagerTest, InvalidationOfBundledAnalyses) {
ModulePassManager MPM(true);
FunctionPassManager FPM(true);
ModulePassManager MPM;
FunctionPassManager FPM;
::testing::InSequence MakeExpectationsSequenced;

// First, force the analysis result to be computed for each loop.
Expand Down Expand Up @@ -772,11 +772,11 @@ TEST_F(LoopPassManagerTest, IndirectInvalidation) {
}));

// Build the pipeline and run it.
ModulePassManager MPM(true);
FunctionPassManager FPM(true);
ModulePassManager MPM;
FunctionPassManager FPM;
FPM.addPass(
createFunctionToLoopPassAdaptor(RequireAnalysisLoopPass<AnalysisA>()));
LoopPassManager LPM(true);
LoopPassManager LPM;
LPM.addPass(MLPHandle.getPass());
LPM.addPass(MLPHandle.getPass());
FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM)));
Expand Down Expand Up @@ -856,8 +856,8 @@ TEST_F(LoopPassManagerTest, IndirectOuterPassInvalidation) {
}));

// Build the pipeline and run it.
ModulePassManager MPM(true);
FunctionPassManager FPM(true);
ModulePassManager MPM;
FunctionPassManager FPM;
FPM.addPass(MFPHandle.getPass());
FPM.addPass(
createFunctionToLoopPassAdaptor(RequireAnalysisLoopPass<LoopAnalysis>()));
Expand Down Expand Up @@ -935,9 +935,9 @@ TEST_F(LoopPassManagerTest, LoopChildInsertion) {
// pass pipeline consisting of three mock pass runs over each loop. After
// this we run both domtree and loop verification passes to make sure that
// the IR remained valid during our mutations.
ModulePassManager MPM(true);
FunctionPassManager FPM(true);
LoopPassManager LPM(true);
ModulePassManager MPM;
FunctionPassManager FPM;
LoopPassManager LPM;
LPM.addPass(MLPHandle.getPass());
LPM.addPass(MLPHandle.getPass());
LPM.addPass(MLPHandle.getPass());
Expand Down Expand Up @@ -1138,9 +1138,9 @@ TEST_F(LoopPassManagerTest, LoopPeerInsertion) {
// pass pipeline consisting of three mock pass runs over each loop. After
// this we run both domtree and loop verification passes to make sure that
// the IR remained valid during our mutations.
ModulePassManager MPM(true);
FunctionPassManager FPM(true);
LoopPassManager LPM(true);
ModulePassManager MPM;
FunctionPassManager FPM;
LoopPassManager LPM;
LPM.addPass(MLPHandle.getPass());
LPM.addPass(MLPHandle.getPass());
LPM.addPass(MLPHandle.getPass());
Expand Down Expand Up @@ -1422,14 +1422,14 @@ TEST_F(LoopPassManagerTest, LoopDeletion) {
};

// Build up the pass managers.
ModulePassManager MPM(true);
FunctionPassManager FPM(true);
ModulePassManager MPM;
FunctionPassManager FPM;
// We run several loop pass pipelines across the loop nest, but they all take
// the same form of three mock pass runs in a loop pipeline followed by
// domtree and loop verification. We use a lambda to stamp this out each
// time.
auto AddLoopPipelineAndVerificationPasses = [&] {
LoopPassManager LPM(true);
LoopPassManager LPM;
LPM.addPass(MLPHandle.getPass());
LPM.addPass(MLPHandle.getPass());
LPM.addPass(MLPHandle.getPass());
Expand Down Expand Up @@ -1636,11 +1636,11 @@ TEST_F(LoopPassManagerTest, HandleLoopNestPass) {
EXPECT_CALL(MLNPHandle, run(HasName("loop.g.0"), _, _, _))
.InSequence(GSequence);

ModulePassManager MPM(true);
FunctionPassManager FPM(true);
ModulePassManager MPM;
FunctionPassManager FPM;

{
LoopPassManager LPM(true);
LoopPassManager LPM;
LPM.addPass(MLPHandle.getPass());
LPM.addPass(MLNPHandle.getPass());
LPM.addPass(MLPHandle.getPass());
Expand All @@ -1658,7 +1658,7 @@ TEST_F(LoopPassManagerTest, HandleLoopNestPass) {
}

{
LoopPassManager LPM(true);
LoopPassManager LPM;
LPM.addPass(MLNPHandle.getPass());
auto Adaptor = createFunctionToLoopPassAdaptor(MLNPHandle.getPass());
ASSERT_TRUE(Adaptor.isLoopNestMode());
Expand Down
12 changes: 5 additions & 7 deletions polly/lib/Support/RegisterPasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,16 +734,15 @@ static bool isScopPassName(StringRef Name) {

static bool
parseTopLevelPipeline(ModulePassManager &MPM, PassInstrumentationCallbacks *PIC,
ArrayRef<PassBuilder::PipelineElement> Pipeline,
bool DebugLogging) {
ArrayRef<PassBuilder::PipelineElement> Pipeline) {
std::vector<PassBuilder::PipelineElement> FullPipeline;
StringRef FirstName = Pipeline.front().Name;

if (!isScopPassName(FirstName))
return false;

FunctionPassManager FPM(DebugLogging);
ScopPassManager SPM(DebugLogging);
FunctionPassManager FPM;
ScopPassManager SPM;

for (auto &Element : Pipeline) {
auto &Name = Element.Name;
Expand Down Expand Up @@ -773,9 +772,8 @@ void registerPollyPasses(PassBuilder &PB) {
});
PB.registerParseTopLevelPipelineCallback(
[PIC](ModulePassManager &MPM,
ArrayRef<PassBuilder::PipelineElement> Pipeline,
bool DebugLogging) -> bool {
return parseTopLevelPipeline(MPM, PIC, Pipeline, DebugLogging);
ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
return parseTopLevelPipeline(MPM, PIC, Pipeline);
});

if (PassPosition != POSITION_BEFORE_VECTORIZER)
Expand Down