Lines Matching +full:runs +full:- +full:on

1 //===- CGSCCPassManagerTest.cpp -------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
37 // Check whether the analysis or all analyses on modules have been
44 TestModuleAnalysis(int &Runs) : Runs(Runs) {}
47 ++Runs;
55 int &Runs;
67 // Check whether the analysis or all analyses on SCCs have been
75 TestSCCAnalysis(int &Runs) : Runs(Runs) {}
78 ++Runs;
86 int &Runs;
98 // Check whether the analysis or all analyses on functions have been
105 TestFunctionAnalysis(int &Runs) : Runs(Runs) {}
108 ++Runs;
121 int &Runs;
136 TestImmutableFunctionAnalysis(int &Runs) : Runs(Runs) {}
139 ++Runs;
147 int &Runs;
265 // Cross-register proxies.
320 // *C.begin()->getFunction().getParent()))
321 // AnalyzedModuleFunctionCount1 += TMA->FunctionCount;
326 *C.begin()->getFunction().getParent()))
327 AnalyzedModuleFunctionCount1 += TMA->FunctionCount;
399 *C.begin()->getFunction().getParent()))
416 *C.begin()->getFunction().getParent()))
419 // Only fail to preserve analyses on one SCC and make sure that gets
435 *C.begin()->getFunction().getParent()))
490 // Only fail to preserve analyses on one SCC and make sure that gets
551 // will trigger re-running it.
559 // Two runs and four SCCs.
633 // Two runs and four SCCs.
671 // will trigger re-running it.
765 // will trigger re-running it.
773 // Two runs and 6 functions.
808 // will trigger re-running it.
846 // will trigger re-running it.
854 // Two runs and 6 functions.
858 /// A test CGSCC-level analysis pass which caches in its result another
862 /// FIXME: Currently this doesn't also depend on a function analysis, and if it
881 TestIndirectSCCAnalysis(int &Runs, ModuleAnalysisManager &MAM)
882 : Runs(Runs), MAM(MAM) {}
887 ++Runs;
894 // *C.begin()->getFunction().getParent());
897 *C.begin()->getFunction().getParent());
899 // pre-registered on the proxy.
910 int &Runs;
938 TestDoublyIndirectSCCAnalysis(int &Runs) : Runs(Runs) {}
943 ++Runs;
952 int &Runs;
979 TestIndirectFunctionAnalysis(int &Runs, ModuleAnalysisManager &MAM,
981 : Runs(Runs), MAM(MAM), CGAM(CGAM) {}
985 ++Runs;
994 // pre-registered on the proxy.
1009 // pre-registered on the proxy.
1020 int &Runs;
1066 // - both analyses for the (f) and (x) SCCs,
1067 // - just the underlying (indirect) analysis for (g) SCC, and
1068 // - just the direct analysis for (h1,h2,h3) SCC.
1085 // Finally, use the analysis again on each SCC (and function), forcing
1086 // re-computation for all of them.
1099 // Create a second CGSCC pass manager. This will cause the module-level
1101 // indirect SCC-level analysis as the module analysis it depends on gets
1126 // There are generally two possible runs for each of the four SCCs. But
1138 // Then we re-run it for every SCC but "(g)". Then we re-run it for every
1183 // CG. This should successfully invalidate (and force to be re-run) all the
1202 auto &H3F = *cast<CallInst>(H2F.begin()->begin())->getCalledFunction();
1204 H2F.begin()->begin()->eraseFromParent();
1208 H2F.begin()->begin());
1218 // Now use the analysis again on each SCC and function, forcing
1219 // re-computation for all of them.
1250 auto &H3F = *cast<Function>(cast<BitCastInst>(H2F.begin()->begin())->getOperand(0));
1252 H2F.begin()->begin()->eraseFromParent();
1254 (void)CallInst::Create(&H3F, {}, "", H2F.begin()->begin());
1264 // Now use the analysis again on each SCC and function, forcing
1265 // re-computation for all of them.
1270 // Create a second CGSCC pass manager. This will cause the module-level
1272 // indirect SCC-level analysis as the module analysis it depends on gets
1299 // fold three SCCs back to one, re-compute for it and the two SCCs above it
1304 // First we run over all six functions. Then we re-run it over three when we
1305 // split their SCCs. Then we re-run over the whole module. Then we re-run
1311 // Re run the function analysis over the entire module, and then re-run it
1312 // over the `(h3, h1, h2)` SCC due to invalidation. Then we re-run it over
1352 Function *FnX = M->getFunction("x");
1353 Function *FnH1 = M->getFunction("h1");
1354 Function *FnH2 = M->getFunction("h2");
1355 Function *FnH3 = M->getFunction("h3");
1362 BasicBlock::iterator IP = FnH2->getEntryBlock().begin();
1389 Function *FnX = M->getFunction("x");
1390 Function *FnH1 = M->getFunction("h1");
1391 Function *FnH2 = M->getFunction("h2");
1392 Function *FnH3 = M->getFunction("h3");
1399 BasicBlock::iterator IP = FnH2->getEntryBlock().begin();
1426 Function *FnF = M->getFunction("f");
1427 Function *FnH2 = M->getFunction("h2");
1432 BasicBlock::iterator IP = FnF->getEntryBlock().begin();
1457 Function *FnF = M->getFunction("f");
1458 Function *FnH2 = M->getFunction("h2");
1463 BasicBlock::iterator IP = FnF->getEntryBlock().begin();
1488 Function *FnF = M->getFunction("f");
1489 Function *FnewF = Function::Create(FnF->getFunctionType(),
1490 FnF->getLinkage(), "newF", *M);
1491 BasicBlock *BB = BasicBlock::Create(FnewF->getContext(), "", FnewF);
1492 ReturnInst::Create(FnewF->getContext(), BB);
1495 BasicBlock::iterator IP = FnF->getEntryBlock().begin();
1527 Function *FnF = M->getFunction("f");
1529 Function::Create(FnF->getFunctionType(), FnF->getLinkage(), "newF", *M);
1530 BasicBlock *BB = BasicBlock::Create(FnewF->getContext(), "", FnewF);
1531 ReturnInst::Create(FnewF->getContext(), BB);
1539 BasicBlock::iterator IP = FnF->getEntryBlock().begin();
1562 Function *FnX = M->getFunction("x");
1563 Function *FnH1 = M->getFunction("h1");
1564 Function *FnH2 = M->getFunction("h2");
1565 Function *FnH3 = M->getFunction("h3");
1572 BasicBlock::iterator IP = FnH2->getEntryBlock().begin();
1597 Function *FnF = M->getFunction("f");
1598 Function *FnH2 = M->getFunction("h2");
1603 BasicBlock::iterator IP = FnF->getEntryBlock().begin();
1626 Function *FnF = M->getFunction("f");
1627 Function *FnewF = Function::Create(FnF->getFunctionType(),
1628 FnF->getLinkage(), "newF", *M);
1629 BasicBlock *BB = BasicBlock::Create(FnewF->getContext(), "", FnewF);
1630 auto *RI = ReturnInst::Create(FnewF->getContext(), BB);
1631 while (FnF->getEntryBlock().size() > 1)
1632 FnF->getEntryBlock().front().moveBefore(RI->getIterator());
1637 ConstantExpr::getPtrToInt(FnF, Type::getInt64Ty(FnF->getContext()));
1643 ASSERT_TRUE(FnF->isDeclaration());
1644 ASSERT_EQ(FnF->getNumUses(), 0U);
1660 Function *FnF = M->getFunction("f");
1666 ASSERT_EQ(M->getFunctionList().size(), 6U);
1672 ASSERT_EQ(M->getFunctionList().size(), 5U);
1683 Function *FnX = M->getFunction("x");
1684 Function *FnH1 = M->getFunction("h1");
1685 Function *FnH2 = M->getFunction("h2");
1686 Function *FnH3 = M->getFunction("h3");
1693 BasicBlock::iterator IP = FnH1->getEntryBlock().begin();
1699 ASSERT_EQ(cast<CallBase>(IP)->getCalledFunction(), FnH2);
1700 IP->eraseFromParent();
1724 // Start with call recursive f, create f -> g and ref recursive f.
1745 Function &F = N->getFunction();
1753 BasicBlock::Create(F.getParent()->getContext(), "entry", G);
1754 (void)ReturnInst::Create(G->getContext(), GBB);
1760 // "Demote" the 'f -> f' call edge to a ref edge.
1778 << "Updating the call graph with a demoted, self-referential "
1779 "call edge 'f -> f', and a newly inserted ref edge 'f -> g', "
1792 // Start with f, end with f -> g1, f -> g2, and f -ref-> (h1 <-ref-> h2).
1813 Function &F = N->getFunction();
1823 BasicBlock::Create(F.getParent()->getContext(), "entry", G1);
1825 BasicBlock::Create(F.getParent()->getContext(), "entry", G2);
1826 (void)ReturnInst::Create(G1->getContext(), G1BB);
1827 (void)ReturnInst::Create(G2->getContext(), G2BB);
1829 // Add 'f -> g1' call edge.
1831 // Add 'f -> g2' call edge.
1843 BasicBlock::Create(F.getParent()->getContext(), "entry", H1);
1845 BasicBlock::Create(F.getParent()->getContext(), "entry", H2);
1848 (void)ReturnInst::Create(H1->getContext(), H1BB);
1851 (void)ReturnInst::Create(H2->getContext(), H2BB);
1853 // Add 'f -> h1' ref edge.
1857 // Add 'f -> h2' ref edge.
1868 << "Updating the call graph with mutually recursive g1 <-> g2, h1 "
1869 "<-> h2 caused a fatal failure";
1904 Function &F = N->getFunction();
1909 Function &F2 = *F.getParent()->getFunction("f2");
1911 // Remove f1 <-> f2 references
1975 Function &F = N->getFunction();
1979 Function *F3 = F.getParent()->getFunction("f3");
1984 F.getEntryBlock().getTerminator()->getIterator());
1988 << "Updating the call graph with mutually recursive g1 <-> g2, h1 "
1989 "<-> h2 caused a fatal failure";