[ORC] Fix an overly aggressive assert.
authorLang Hames <lhames@gmail.com>
Thu, 12 Mar 2020 02:49:12 +0000 (19:49 -0700)
committerLang Hames <lhames@gmail.com>
Thu, 12 Mar 2020 03:04:54 +0000 (20:04 -0700)
It is ok to add dependencies on symbols that are ready, they should just be
skipped.

llvm/lib/ExecutionEngine/Orc/Core.cpp

index ef4ab1e..49b7395 100644 (file)
@@ -1001,16 +1001,18 @@ void JITDylib::addDependencies(const SymbolStringPtr &Name,
       // Check the sym entry for the dependency.
       auto OtherSymI = OtherJITDylib.Symbols.find(OtherSymbol);
 
-#ifndef NDEBUG
       // Assert that this symbol exists and has not reached the ready state
       // already.
       assert(OtherSymI != OtherJITDylib.Symbols.end() &&
-             (OtherSymI->second.getState() < SymbolState::Ready &&
-              "Dependency on emitted/ready symbol"));
-#endif
+             "Dependency on unknown symbol");
 
       auto &OtherSymEntry = OtherSymI->second;
 
+      // If the other symbol is already in the Ready state then there's no
+      // dependency to add.
+      if (OtherSymEntry.getState() == SymbolState::Ready)
+        continue;
+
       // If the dependency is in an error state then note this and continue,
       // we will move this symbol to the error state below.
       if (OtherSymEntry.getFlags().hasError()) {