diff options
author | Lang Hames <lhames@gmail.com> | 2018-06-14 15:32:59 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2018-06-14 15:32:59 +0000 |
commit | c6679d1e091164751b6922d7ca0ce2c6ebb9473c (patch) | |
tree | 8d6893c4d29d7c5c79abaa55843852d3e42b758a | |
parent | 6ba3aa8738c244cac904143a22731836293f8fd6 (diff) |
[ORC] Filter out self-dependencies in VSO::addDependencies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334724 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/ExecutionEngine/Orc/Core.cpp | 2 | ||||
-rw-r--r-- | unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/Orc/Core.cpp b/lib/ExecutionEngine/Orc/Core.cpp index aeb10a584c3..82be34476f6 100644 --- a/lib/ExecutionEngine/Orc/Core.cpp +++ b/lib/ExecutionEngine/Orc/Core.cpp @@ -452,7 +452,7 @@ void VSO::addDependencies(const SymbolFlagsMap &Dependants, if (OtherMI.IsFinalized) transferFinalizedNodeDependencies(MI, Name, OtherMI); - else { + else if (&OtherVSO != this || OtherSymbol != Name) { OtherMI.Dependants[this].insert(Name); DepsOnOtherVSO.insert(OtherSymbol); } diff --git a/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp index 01f81d9a80f..c8f30dbfd94 100644 --- a/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp +++ b/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp @@ -301,10 +301,17 @@ TEST(CoreAPIsTest, TestCircularDependenceInOneVSO) { EXPECT_TRUE(Unresolved.empty()) << "Failed to resolve \"Baz\""; } + // Add a circular dependency: Foo -> Bar, Bar -> Baz, Baz -> Foo. FooR->addDependencies({{&V, SymbolNameSet({Bar})}}); BarR->addDependencies({{&V, SymbolNameSet({Baz})}}); BazR->addDependencies({{&V, SymbolNameSet({Foo})}}); + // Add self-dependencies for good measure. This tests that the implementation + // of addDependencies filters these out. + FooR->addDependencies({{&V, SymbolNameSet({Foo})}}); + BarR->addDependencies({{&V, SymbolNameSet({Bar})}}); + BazR->addDependencies({{&V, SymbolNameSet({Baz})}}); + EXPECT_FALSE(FooResolved) << "\"Foo\" should not be resolved yet"; EXPECT_FALSE(BarResolved) << "\"Bar\" should not be resolved yet"; EXPECT_FALSE(BazResolved) << "\"Baz\" should not be resolved yet"; |