[PATCH] D130450: [JITLink] Relax zero-fill edge assertions.

Sunho Kim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 24 18:54:38 PDT 2022


sunho created this revision.
sunho added reviewers: lhames, sgraenitz.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
sunho requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Relax zero-fill edge assertions to only consider relocation edges. Keep-alive edges to zero-fill blocks can cause this assertion which is too strict.


https://reviews.llvm.org/D130450

Files:
  llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
  llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h


Index: llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h
+++ llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h
@@ -128,14 +128,14 @@
 
       // Copy Block data and apply fixups.
       LLVM_DEBUG(dbgs() << "    Applying fixups.\n");
-      assert((!B->isZeroFill() || B->edges_size() == 0) &&
-             "Edges in zero-fill block?");
       for (auto &E : B->edges()) {
 
         // Skip non-relocation edges.
         if (!E.isRelocation())
           continue;
 
+        assert(!B->isZeroFill() && "Edges in zero-fill block?");
+
         // Dispatch to LinkerImpl for fixup.
         if (auto Err = impl().applyFixup(G, *B, E))
           return Err;
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::FirstRelocation || !isZeroFill()) &&
+           "Adding edge to zero-fill block?");
     Edges.push_back(Edge(K, Offset, Target, Addend));
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130450.447169.patch
Type: text/x-patch
Size: 1418 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220725/702e0bf1/attachment.bin>


More information about the llvm-commits mailing list