[PATCH] D121623: [LV] Remove unneeded createHeaderBranch.(NFCI)

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 27 09:16:28 PDT 2022


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:634
-  /// vector loop preheader, middle block and scalar preheader. Also
-  /// allocate a loop object for the new vector loop and return it.
-  Loop *createVectorLoopSkeleton(StringRef Prefix);
----------------
It still also allocates a loop object for the new vector loop, placing the header in it, and could return it, but doing so would be useless - the loop is retrieved when needed from its header block.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7590
       ILV.createVectorizedLoopSkeleton();
+  State.CFG.LastBB = ILV.LoopMiddleBlock;
   ILV.collectPoisonGeneratingRecipes(State);
----------------
Would be good to set here the minimal fields of State needed, PrevBB/VectorLoopPreHeader being an anchor, and complement other caching fields later - possibly LastBB included?


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.cpp:914
   State->CurrentVectorLoop = L;
-  State->CFG.LastBB = L->getExitBlock();
 
----------------
Is it no longer possible to retrieve LoopMiddleBlock as the exit block of L, at this time? (Intentionally, from the summary: "Instead of relying on the loop ...")
Alternatively, retrieve LastBB/LoopMiddleBlock as VectorHeaderBB->getSingleSuccessor(); ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121623



More information about the llvm-commits mailing list