[llvm] [SandboxIR] Pass registry (PR #108084)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 10 14:01:06 PDT 2024
================
@@ -133,3 +133,33 @@ define void @foo() {
EXPECT_EQ(Buff, "test-fpm(test-pass1,test-pass2)");
#endif // NDEBUG
}
+
+TEST_F(PassTest, PassRegistry) {
+ class TestPass1 final : public FunctionPass {
+ public:
+ TestPass1() : FunctionPass("test-pass1") {}
+ bool runOnFunction(Function &F) final { return false; }
+ };
+ class TestPass2 final : public FunctionPass {
+ public:
+ TestPass2() : FunctionPass("test-pass2") {}
+ bool runOnFunction(Function &F) final { return false; }
+ };
+
+ PassRegistry Registry;
+ auto *TP1 = Registry.registerPass(std::make_unique<TestPass1>());
+ auto *TP2 = Registry.registerPass(std::make_unique<TestPass2>());
+
+ // Check getPassByName().
+ EXPECT_EQ(Registry.getPassByName("test-pass1"), TP1);
+ EXPECT_EQ(Registry.getPassByName("test-pass2"), TP2);
+
+ FunctionPassManager FPM("test-fpm");
----------------
aeubanks wrote:
copy pasta?
https://github.com/llvm/llvm-project/pull/108084
More information about the llvm-commits
mailing list