[llvm] r334910 - [ORC] Erase empty dependence sets when adding new symbol dependencies.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 17 09:59:53 PDT 2018
Author: lhames
Date: Sun Jun 17 09:59:53 2018
New Revision: 334910
URL: http://llvm.org/viewvc/llvm-project?rev=334910&view=rev
Log:
[ORC] Erase empty dependence sets when adding new symbol dependencies.
Modified:
llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
Modified: llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp?rev=334910&r1=334909&r2=334910&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp Sun Jun 17 09:59:53 2018
@@ -467,6 +467,9 @@ void VSO::addDependencies(const SymbolFl
DepsOnOtherVSO.insert(OtherSymbol);
}
}
+
+ if (DepsOnOtherVSO.empty())
+ MI.UnfinalizedDependencies.erase(&OtherVSO);
}
}
});
Modified: llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp?rev=334910&r1=334909&r2=334910&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp Sun Jun 17 09:59:53 2018
@@ -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;
More information about the llvm-commits
mailing list