From b19801640bf621a596187d819afb57514713d1e7 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Wed, 11 Mar 2020 19:49:12 -0700 Subject: [PATCH] [ORC] Fix an overly aggressive assert. It is ok to add dependencies on symbols that are ready, they should just be skipped. --- llvm/lib/ExecutionEngine/Orc/Core.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp index ef4ab1e..49b7395 100644 --- a/llvm/lib/ExecutionEngine/Orc/Core.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp @@ -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()) { -- 2.7.4