diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2016-08-19 10:51:55 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2016-08-19 10:51:55 +0000 |
commit | b8824a5d3f2f8d7a687520c4db641c4d53dc02a5 (patch) | |
tree | 083ba4968131bb5d88e5df452d320c628015b8d9 /llvm/unittests/IR/PassManagerTest.cpp | |
parent | f1b8fdc074d2a9667ee62d36f8bfdaeaa21980c2 (diff) | |
download | bcm5719-llvm-b8824a5d3f2f8d7a687520c4db641c4d53dc02a5.tar.gz bcm5719-llvm-b8824a5d3f2f8d7a687520c4db641c4d53dc02a5.zip |
[PM] Revert r279227 and r279228 until I can find someone to help me
solve completely opaque MSVC build errors. It complains about lots of
stuff with this change without givin nearly enough information to even
try to fix.
llvm-svn: 279231
Diffstat (limited to 'llvm/unittests/IR/PassManagerTest.cpp')
-rw-r--r-- | llvm/unittests/IR/PassManagerTest.cpp | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/llvm/unittests/IR/PassManagerTest.cpp b/llvm/unittests/IR/PassManagerTest.cpp index 47fb8b70f1b..c2ac863260a 100644 --- a/llvm/unittests/IR/PassManagerTest.cpp +++ b/llvm/unittests/IR/PassManagerTest.cpp @@ -331,61 +331,4 @@ TEST_F(PassManagerTest, Basic) { EXPECT_EQ(1, ModuleAnalysisRuns); } - -// A customized pass manager that passes extra arguments through the -// infrastructure. -typedef AnalysisManager<Function, int> CustomizedAnalysisManager; -typedef PassManager<Function, CustomizedAnalysisManager, int, int &> - CustomizedPassManager; - -class CustomizedAnalysis : public AnalysisInfoMixin<CustomizedAnalysis> { -public: - struct Result { - Result(int I) : I(I) {} - int I; - }; - - Result run(Function &F, CustomizedAnalysisManager &AM, int I) { - return Result(I); - } - -private: - friend AnalysisInfoMixin<CustomizedAnalysis>; - static char PassID; -}; - -char CustomizedAnalysis::PassID; - -struct CustomizedPass : PassInfoMixin<CustomizedPass> { - std::function<void(CustomizedAnalysis::Result &, int &)> Callback; - - template <typename CallbackT> - CustomizedPass(CallbackT Callback) : Callback(Callback) {} - - PreservedAnalyses run(Function &F, CustomizedAnalysisManager &AM, int I, - int &O) { - Callback(AM.getResult<CustomizedAnalysis>(F, I), O); - return PreservedAnalyses::none(); - } -}; - -TEST_F(PassManagerTest, CustomizedPassManagerArgs) { - CustomizedAnalysisManager AM; - AM.registerPass([&] { return CustomizedAnalysis(); }); - - CustomizedPassManager PM; - - // Add an instance of the customized pass that just accumulates the input - // after it is round-tripped through the analysis. - int Result = 0; - PM.addPass( - CustomizedPass([](CustomizedAnalysis::Result &R, int &O) { O += R.I; })); - - // Run this over every function with the input of 42. - for (Function &F : *M) - PM.run(F, AM, 42, Result); - - // And ensure that we accumulated the correct result. - EXPECT_EQ(42 * (int)M->size(), Result); -} } |