[polly] r303064 - [Polly][NewPM] Add missing Unittests
Philip Pfaffe via llvm-commits
llvm-commits at lists.llvm.org
Mon May 15 06:52:10 PDT 2017
Author: pfaffe
Date: Mon May 15 08:52:10 2017
New Revision: 303064
URL: http://llvm.org/viewvc/llvm-project?rev=303064&view=rev
Log:
[Polly][NewPM] Add missing Unittests
Added:
polly/trunk/unittests/ScopPassManager/
polly/trunk/unittests/ScopPassManager/CMakeLists.txt
polly/trunk/unittests/ScopPassManager/PassManagerTest.cpp
Added: polly/trunk/unittests/ScopPassManager/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/unittests/ScopPassManager/CMakeLists.txt?rev=303064&view=auto
==============================================================================
--- polly/trunk/unittests/ScopPassManager/CMakeLists.txt (added)
+++ polly/trunk/unittests/ScopPassManager/CMakeLists.txt Mon May 15 08:52:10 2017
@@ -0,0 +1,3 @@
+add_polly_unittest(ScopPassManagerTests
+ PassManagerTest.cpp
+ )
Added: polly/trunk/unittests/ScopPassManager/PassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/unittests/ScopPassManager/PassManagerTest.cpp?rev=303064&view=auto
==============================================================================
--- polly/trunk/unittests/ScopPassManager/PassManagerTest.cpp (added)
+++ polly/trunk/unittests/ScopPassManager/PassManagerTest.cpp Mon May 15 08:52:10 2017
@@ -0,0 +1,66 @@
+#include "polly/CodeGen/IslAst.h"
+#include "polly/DependenceInfo.h"
+#include "polly/ScopPass.h"
+#include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/Analysis/CGSCCPassManager.h"
+#include "llvm/IR/PassManager.h"
+#include "llvm/Passes/PassBuilder.h"
+#include "llvm/Transforms/Scalar/LoopPassManager.h"
+#include "gtest/gtest.h"
+
+using namespace polly;
+using namespace llvm;
+
+namespace {
+class ScopPassRegistry : public ::testing::Test {
+protected:
+ ModuleAnalysisManager MAM;
+ FunctionAnalysisManager FAM;
+ LoopAnalysisManager LAM;
+ CGSCCAnalysisManager CGAM;
+ ScopAnalysisManager SAM;
+ AAManager AM;
+
+public:
+ ScopPassRegistry(ScopPassRegistry &&) = delete;
+ ScopPassRegistry(const ScopPassRegistry &) = delete;
+ ScopPassRegistry &operator=(ScopPassRegistry &&) = delete;
+ ScopPassRegistry &operator=(const ScopPassRegistry &) = delete;
+ ScopPassRegistry() {
+ PassBuilder PB;
+
+ AM = PB.buildDefaultAAPipeline();
+ PB.registerModuleAnalyses(MAM);
+ PB.registerFunctionAnalyses(FAM);
+ PB.registerLoopAnalyses(LAM);
+ PB.registerCGSCCAnalyses(CGAM);
+
+ FAM.registerPass([] { return ScopAnalysis(); });
+ FAM.registerPass([] { return ScopInfoAnalysis(); });
+ FAM.registerPass([this] { return ScopAnalysisManagerFunctionProxy(SAM); });
+
+ // SAM.registerPass([] { return IslAstAnalysis(); });
+ // SAM.registerPass([] { return DependenceAnalysis(); });
+ SAM.registerPass([this] { return FunctionAnalysisManagerScopProxy(FAM); });
+
+ PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
+ }
+};
+
+TEST_F(ScopPassRegistry, PrintScops) {
+ FunctionPassManager FPM;
+ FPM.addPass(ScopAnalysisPrinterPass(errs()));
+}
+
+TEST_F(ScopPassRegistry, PrintScopInfo) {
+ FunctionPassManager FPM;
+ FPM.addPass(ScopInfoPrinterPass(errs()));
+}
+
+TEST_F(ScopPassRegistry, PrinIslAstInfo) {
+ FunctionPassManager FPM;
+ ScopPassManager SPM;
+ // SPM.addPass(IslAstPrinterPass(errs()));
+ FPM.addPass(createFunctionToScopPassAdaptor(std::move(SPM)));
+}
+} // namespace
More information about the llvm-commits
mailing list