[PATCH] D12285: [LV] Switch to using canonical induction variables.

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 08:59:43 PDT 2015


jmolloy created this revision.
jmolloy added reviewers: anemet, mzolotukhin.
jmolloy added a subscriber: llvm-commits.
jmolloy set the repository for this revision to rL LLVM.

Vectorized loops only ever have one induction variable. All induction PHIs from the scalar loop are rewritten to be in terms of this single indvar.

We were trying very hard to pick an indvar that already existed, even if that indvar wasn't canonical (didn't start at zero). But trying so hard is really fruitless - creating a new, canonical, indvar only results in one extra add in the worst case and that add is trivially easy to push through the PHI out of the loop by instcombine.

If we try and be less clever here and instead let instcombine clean up our mess (as we do in many other places in LV), we can remove unneeded complexity.

Repository:
  rL LLVM

http://reviews.llvm.org/D12285

Files:
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/induction.ll
  test/Transforms/LoopVectorize/reverse_induction.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12285.32963.patch
Type: text/x-patch
Size: 4605 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150824/bf463709/attachment.bin>


More information about the llvm-commits mailing list