[PATCH] D143177: Cleanup of Complex Deinterleaving pass (NFCI)

Nicholas Guy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 07:46:18 PST 2023


NickGuy updated this revision to Diff 503369.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143177/new/

https://reviews.llvm.org/D143177

Files:
  llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp


Index: llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
===================================================================
--- llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
+++ llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
@@ -271,8 +271,6 @@
   bool identifyNodes(Instruction *RootI);
 
   /// Perform the actual replacement of the underlying instruction graph.
-  /// Returns false if the deinterleaving operation should be cancelled for the
-  /// current graph.
   void replaceNodes();
 };
 
@@ -598,8 +596,16 @@
        Rotation == ComplexDeinterleavingRotation::Rotation_270)
           ? CommonOperand
           : nullptr);
-  NodePtr CNode = identifyNodeWithImplicitAdd(
-      cast<Instruction>(CR), cast<Instruction>(CI), PartialMatch);
+
+  auto *CRInst = dyn_cast<Instruction>(CR);
+  auto *CIInst = dyn_cast<Instruction>(CI);
+
+  if (!CRInst || !CIInst) {
+    LLVM_DEBUG(dbgs() << "  - Common operands are not instructions.\n");
+    return nullptr;
+  }
+
+  NodePtr CNode = identifyNodeWithImplicitAdd(CRInst, CIInst, PartialMatch);
   if (!CNode) {
     LLVM_DEBUG(dbgs() << "  - No cnode identified\n");
     return nullptr;
@@ -807,7 +813,10 @@
     return identifyAdd(Real, Imag);
   }
 
-  return nullptr;
+  auto Symmetric = identifySymmetricOperation(Real, Imag);
+  LLVM_DEBUG(if (Symmetric == nullptr) dbgs()
+             << "  - Not recognised as a valid pattern.\n");
+  return Symmetric;
 }
 
 bool ComplexDeinterleavingGraph::identifyNodes(Instruction *RootI) {
@@ -832,7 +841,8 @@
   // Check all instructions have internal uses
   for (const auto &Node : CompositeNodes) {
     if (!Node->hasAllInternalUses(AllInstructions)) {
-      LLVM_DEBUG(dbgs() << "  - Invalid internal uses\n");
+      LLVM_DEBUG(dbgs() << "  - Invalid internal uses in " << Node.get()
+                        << "\n");
       return false;
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143177.503369.patch
Type: text/x-patch
Size: 1865 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230308/b13bc018/attachment.bin>


More information about the llvm-commits mailing list