[PATCH] D71180: [NFC][MacroFusion] Adding the assertion if someone want to fuse more than 2 instructions.

qshanz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 8 19:17:54 PST 2019


steven.zhang created this revision.
steven.zhang added reviewers: fhahn, evandro, jsji, PowerPC.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

As discussed in https://reviews.llvm.org/D69998, we miss to create some dependency edges if chained more than 2 instructions. Adding an assertion here if someone want to chain more than 2 instructions.


https://reviews.llvm.org/D71180

Files:
  llvm/lib/CodeGen/MacroFusion.cpp


Index: llvm/lib/CodeGen/MacroFusion.cpp
===================================================================
--- llvm/lib/CodeGen/MacroFusion.cpp
+++ llvm/lib/CodeGen/MacroFusion.cpp
@@ -71,6 +71,13 @@
   if (!DAG.addEdge(&SecondSU, SDep(&FirstSU, SDep::Cluster)))
     return false;
 
+  // TODO - If we want to chain more than two instructions, we need to create
+  // artifical edges to make data dependencies from the FirstSU and dependencies
+  // of the SecondSU also dependent on other chained instructions, to prevent
+  // them from being scheduled into these chained instructions.
+  assert(hasLessThanNumFused(FirstSU, 2) &&
+         "Chain two instructions together at most");
+
   // Adjust the latency between both instrs.
   for (SDep &SI : FirstSU.Succs)
     if (SI.getSUnit() == &SecondSU)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71180.232753.patch
Type: text/x-patch
Size: 808 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191209/8d5d69bc/attachment.bin>


More information about the llvm-commits mailing list