[llvm] r334724 - [ORC] Filter out self-dependencies in VSO::addDependencies.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 14 08:32:59 PDT 2018
Author: lhames
Date: Thu Jun 14 08:32:59 2018
New Revision: 334724
URL: http://llvm.org/viewvc/llvm-project?rev=334724&view=rev
Log:
[ORC] Filter out self-dependencies in VSO::addDependencies.
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=334724&r1=334723&r2=334724&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/Core.cpp Thu Jun 14 08:32:59 2018
@@ -452,7 +452,7 @@ void VSO::addDependencies(const SymbolFl
if (OtherMI.IsFinalized)
transferFinalizedNodeDependencies(MI, Name, OtherMI);
- else {
+ else if (&OtherVSO != this || OtherSymbol != Name) {
OtherMI.Dependants[this].insert(Name);
DepsOnOtherVSO.insert(OtherSymbol);
}
Modified: llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp?rev=334724&r1=334723&r2=334724&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp Thu Jun 14 08:32:59 2018
@@ -301,10 +301,17 @@ TEST(CoreAPIsTest, TestCircularDependenc
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";
More information about the llvm-commits
mailing list