[PATCH] D124267: Fix assert failure when building poplibs

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 08:10:55 PDT 2022


thopre created this revision.
thopre added a reviewer: bcahoon.
Herald added a subscriber: hiraditya.
Herald added a project: All.
thopre requested review of this revision.
Herald added a project: LLVM.

Prior to ordering instructions to be scheduled, the machine pipeliner
update recurrence node sets in groupRemainingNodes() by adding in a
given node set any node on the dependency path from a node set with
higher priority to the given node set. The function computePath() that
determine what constitutes a path follows artificial dependencies.

However, when ordering the nodes in the resulting node sets,
computeNodeOrder() calls ignoreDependence when looking at dependencies
which ignores artificial dependencies. This can cause a node not to be
scheduled which then causes wrong code generation and in the case of a
debug build will lead to an assert failure in generatePhis() in
ModuloScheduler.cpp.

This commit adds calls to ignoreDependence() in computePath() to not add
any node in groupRemainingNodes() that would not be ordered by
computeNodeOrder().


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124267

Files:
  llvm/lib/CodeGen/MachinePipeliner.cpp


Index: llvm/lib/CodeGen/MachinePipeliner.cpp
===================================================================
--- llvm/lib/CodeGen/MachinePipeliner.cpp
+++ llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -1575,9 +1575,11 @@
     return Path.contains(Cur);
   bool FoundPath = false;
   for (auto &SI : Cur->Succs)
-    FoundPath |= computePath(SI.getSUnit(), Path, DestNodes, Exclude, Visited);
+    if (!ignoreDependence(SI, false))
+      FoundPath |=
+          computePath(SI.getSUnit(), Path, DestNodes, Exclude, Visited);
   for (auto &PI : Cur->Preds)
-    if (PI.getKind() == SDep::Anti)
+    if (PI.getKind() == SDep::Anti && !ignoreDependence(PI, true))
       FoundPath |=
           computePath(PI.getSUnit(), Path, DestNodes, Exclude, Visited);
   if (FoundPath)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124267.424483.patch
Type: text/x-patch
Size: 772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220422/cd9b61f4/attachment.bin>


More information about the llvm-commits mailing list