|
@@ -58,6 +58,30 @@ static std::unique_ptr<Module> getLazyModuleFromAssembly(LLVMContext &Context,
|
|
return std::unique_ptr<Module>(ModuleOrErr.get());
|
|
return std::unique_ptr<Module>(ModuleOrErr.get());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+TEST(BitReaderTest, DematerializeFunctionPreservesLinkageType) {
|
|
|
|
+ SmallString<1024> Mem;
|
|
|
|
+
|
|
|
|
+ LLVMContext Context;
|
|
|
|
+ std::unique_ptr<Module> M = getLazyModuleFromAssembly(
|
|
|
|
+ Context, Mem, "define internal i32 @func() {\n"
|
|
|
|
+ "ret i32 0\n"
|
|
|
|
+ "}\n");
|
|
|
|
+
|
|
|
|
+ EXPECT_FALSE(verifyModule(*M, &dbgs()));
|
|
|
|
+
|
|
|
|
+ M->getFunction("func")->Materialize();
|
|
|
|
+ EXPECT_FALSE(M->getFunction("func")->empty());
|
|
|
|
+ EXPECT_TRUE(M->getFunction("func")->getLinkage() ==
|
|
|
|
+ GlobalValue::InternalLinkage);
|
|
|
|
+
|
|
|
|
+ // Check that the linkage type is preserved after dematerialization.
|
|
|
|
+ M->getFunction("func")->Dematerialize();
|
|
|
|
+ EXPECT_TRUE(M->getFunction("func")->empty());
|
|
|
|
+ EXPECT_TRUE(M->getFunction("func")->getLinkage() ==
|
|
|
|
+ GlobalValue::InternalLinkage);
|
|
|
|
+ EXPECT_FALSE(verifyModule(*M, &dbgs()));
|
|
|
|
+}
|
|
|
|
+
|
|
TEST(BitReaderTest, MaterializeFunctionsForBlockAddr) { // PR11677
|
|
TEST(BitReaderTest, MaterializeFunctionsForBlockAddr) { // PR11677
|
|
SmallString<1024> Mem;
|
|
SmallString<1024> Mem;
|
|
|
|
|