1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

[ORC] Erase empty dependence sets when adding new symbol dependencies.

llvm-svn: 334910
This commit is contained in:
Lang Hames 2018-06-17 16:59:53 +00:00
parent 9d5f10e891
commit d0ab0c2460
2 changed files with 41 additions and 0 deletions

View File

@ -467,6 +467,9 @@ void VSO::addDependencies(const SymbolFlagsMap &Dependants,
DepsOnOtherVSO.insert(OtherSymbol);
}
}
if (DepsOnOtherVSO.empty())
MI.UnfinalizedDependencies.erase(&OtherVSO);
}
}
});

View File

@ -205,6 +205,44 @@ TEST(CoreAPIsTest, LookupFlagsTest) {
EXPECT_EQ(SymbolFlags[Bar], BarFlags) << "Incorrect flags returned for Bar";
}
TEST(CoreAPIsTest, TestTrivialCircularDependency) {
ExecutionSession ES;
auto &V = ES.createVSO("V");
auto Foo = ES.getSymbolStringPool().intern("foo");
auto FooFlags = JITSymbolFlags::Exported;
auto FooSym = JITEvaluatedSymbol(1U, FooFlags);
Optional<MaterializationResponsibility> FooR;
auto FooMU = llvm::make_unique<SimpleMaterializationUnit>(
SymbolFlagsMap({{Foo, FooFlags}}),
[&](MaterializationResponsibility R) { FooR.emplace(std::move(R)); });
cantFail(V.define(FooMU));
bool FooReady = false;
auto Q =
std::make_shared<AsynchronousSymbolQuery>(
SymbolNameSet({ Foo }),
[](Expected<AsynchronousSymbolQuery::ResolutionResult> R) {
cantFail(std::move(R));
},
[&](Error Err) {
cantFail(std::move(Err));
FooReady = true;
});
V.lookup(std::move(Q), { Foo });
FooR->addDependencies({{&V, {Foo}}});
FooR->resolve({{Foo, FooSym}});
FooR->finalize();
EXPECT_TRUE(FooReady)
<< "Self-dependency prevented symbol from being marked ready";
}
TEST(CoreAPIsTest, TestCircularDependenceInOneVSO) {
ExecutionSession ES;