[PATCH] D152022: [CodeGen] Add support for reductions in ComplexDeinterleaving pass

Nicholas Guy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 06:14:26 PDT 2023


NickGuy added a comment.

Looks good, just a couple of small points from me today.



================
Comment at: llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp:386-387
   bool identifyNodes(Instruction *RootI);
 
+  bool collectPotentialReductions(BasicBlock *B);
+
----------------
Might be worth adding a comment here saying what it returns, it's not immediately clear to me


================
Comment at: llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp:1734-1787
+  // If Operation is ReductionPHI, a new empty PHINode is created.
+  // It is filled later when the ReductionOperation is processed.
+  if (Node->Operation == ComplexDeinterleavingOperation::ReductionPHI) {
+    auto *VTy = cast<VectorType>(Node->Real->getType());
+    auto *NewVTy = VectorType::getDoubleElementsVectorType(VTy);
+    auto *NewPHI = PHINode::Create(NewVTy, 0, "", BackEdge->getFirstNonPHI());
+    OldToNewPHI[dyn_cast<PHINode>(Node->Real)] = NewPHI;
----------------
This function is getting big. Solely in terms of readability, I'd suggest moving the code for each condition to separate functions, leaving the `if`s here (at least the `ReductionOperation` branch, `ReductionPHI` is small enough on its own)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152022



More information about the llvm-commits mailing list