[PATCH] D105505: [LV] Unconditionally branch from middle to scalar preheader if the scalar loop must execute (try 4)

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 6 11:33:19 PDT 2021


reames created this revision.
Herald added subscribers: dmgreen, zzheng, bollu, hiraditya, kristof.beyls, mcrosier.
reames requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

(Not a real review, posted to save state until bots are quiet.

Resubmit after the following:

- Fix a latent bug related to unrolling with required epilogue (see e49d65f <https://reviews.llvm.org/rGe49d65f36d66e247c148601f59edeb2e0b44d8dd>).  I believe this is the cause of the prior PPC buildbot failure.
- Disable non-latch exits for epilogue vectorization to be safe (9ffa90d <https://reviews.llvm.org/rG9ffa90d6c27e583bec9656a0aae5062ea5499094>)
- Split out assert movement (600624a <https://reviews.llvm.org/rG600624a10326ad4be32be409e88b9b8580cef85d>) to reduce churn if this gets reverted again.

Previous commit message (try 3)

  
  Resubmit after fixing test/Transforms/LoopVectorize/ARM/mve-gather-scatter-tailpred.ll
  
  Previous commit message...
  
  This is a resubmit of 3e5ce4 (which was reverted by 7fe41ac).  The original commit caused a PPC build bot failure we never really got to the bottom of.  I can't reproduce the issue, and the bot owner was non-responsive.  In the meantime, we stumbled across an issue which seems possibly related, and worked around a latent bug in 80e8025.  My best guess is that the original patch exposed that latent issue at higher frequency, but it really is just a guess.
  
  Original commit message follows...
  
  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.
  
  Differential Revision: https://reviews.llvm.org/D94892


https://reviews.llvm.org/D105505

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/ARM/mve-gather-scatter-tailpred.ll
  llvm/test/Transforms/LoopVectorize/first-order-recurrence-complex.ll
  llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
  llvm/test/Transforms/LoopVectorize/loop-form.ll
  llvm/test/Transforms/LoopVectorize/unroll_nonlatch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105505.356786.patch
Type: text/x-patch
Size: 49124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210706/e64fd2c8/attachment.bin>


More information about the llvm-commits mailing list