Index: llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h =================================================================== --- llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -303,7 +303,8 @@ /// Add an edge to this block. void addEdge(Edge::Kind K, Edge::OffsetT Offset, Symbol &Target, Edge::AddendT Addend) { - assert(!isZeroFill() && "Adding edge to zero-fill block?"); + assert((K == Edge::KeepAlive || !isZeroFill()) && + "Adding edge to zero-fill block?"); Edges.push_back(Edge(K, Offset, Target, Addend)); } Index: llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h =================================================================== --- llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h +++ llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h @@ -128,8 +128,12 @@ // Copy Block data and apply fixups. LLVM_DEBUG(dbgs() << " Applying fixups.\n"); - assert((!B->isZeroFill() || B->edges_size() == 0) && - "Edges in zero-fill block?"); + assert((!B->isZeroFill() || all_of(B->edges(), + [](const Edge &E) { + return E.getKind() == + Edge::KeepAlive; + })) && + "Non-KeepAlive edges in zero-fill block?"); for (auto &E : B->edges()) { // Skip non-relocation edges.