|
@@ -211,6 +211,35 @@ TEST(OperationsTest, SplitBlock) {
|
|
|
EXPECT_FALSE(verifyModule(M, &errs()));
|
|
|
}
|
|
|
|
|
|
+TEST(OperationsTest, SplitEHBlock) {
|
|
|
+ // Check that we will not try to branch back to the landingpad block using
|
|
|
+ // regular branch instruction
|
|
|
+
|
|
|
+ LLVMContext Ctx;
|
|
|
+ const char *SourceCode =
|
|
|
+ "declare i32* @f()"
|
|
|
+ "declare i32 @personality_function()"
|
|
|
+ "define i32* @test() personality i32 ()* @personality_function {\n"
|
|
|
+ "entry:\n"
|
|
|
+ " %val = invoke i32* @f()\n"
|
|
|
+ " to label %normal unwind label %exceptional\n"
|
|
|
+ "normal:\n"
|
|
|
+ " ret i32* %val\n"
|
|
|
+ "exceptional:\n"
|
|
|
+ " %landing_pad4 = landingpad token cleanup\n"
|
|
|
+ " ret i32* undef\n"
|
|
|
+ "}";
|
|
|
+ auto M = parseAssembly(SourceCode, Ctx);
|
|
|
+
|
|
|
+ // Get the landingpad block
|
|
|
+ BasicBlock &BB = *std::next(M->getFunction("test")->begin(), 2);
|
|
|
+
|
|
|
+ fuzzerop::OpDescriptor Descr = fuzzerop::splitBlockDescriptor(1);
|
|
|
+
|
|
|
+ Descr.BuilderFunc({ConstantInt::getTrue(Ctx)},&*BB.getFirstInsertionPt());
|
|
|
+ ASSERT_TRUE(!verifyModule(*M, &errs()));
|
|
|
+}
|
|
|
+
|
|
|
TEST(OperationsTest, SplitBlockWithPhis) {
|
|
|
LLVMContext Ctx;
|
|
|
|