[PATCH] D94892: [LV] Unconditionally branch from middle to scalar preheader if the scalar loop must execute

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 17 20:18:41 PST 2021


reames created this revision.
reames added reviewers: Ayal, fhahn, anna.
Herald added subscribers: dantrushin, bollu, hiraditya, mcrosier.
reames requested review of this revision.
Herald added a project: LLVM.

If we know that the scalar epilogue is required to run, modify the CFG to end the middle block with an unconditional branch to scalar preheader.  This is instead of a conditional branch to either the preheader or the exit block.

The motivation to do this is to support multiple exit blocks.  Specifically, the current structure forces us to identify immediate dominators and *which* exit block to branch from in the middle terminator.  For the multiple exit case - where we know require scalar will hold - these questions are ill formed.

This is the last change needed to support multiple exit loops, but since the diffs are already large enough, I'm going to land this, and then enable separately.  You can think of this as being NFCIish prep work, but the changes are a bit too involved for me to feel comfortable tagging the review that way.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94892

Files:
  llvm/lib/Transforms/Utils/LoopVersioning.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/first-order-recurrence-complex.ll
  llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
  llvm/test/Transforms/LoopVectorize/loop-form.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94892.317260.patch
Type: text/x-patch
Size: 37711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210118/561340e5/attachment.bin>


More information about the llvm-commits mailing list