OSDN Git Service

[LV] Switch to using canonical induction variables.
authorJames Molloy <james.molloy@arm.com>
Wed, 2 Sep 2015 10:14:54 +0000 (10:14 +0000)
committerJames Molloy <james.molloy@arm.com>
Wed, 2 Sep 2015 10:14:54 +0000 (10:14 +0000)
commit390bcc0ac8c73dd81e1929382f2af5927d3d5ae7
tree79e4c374c28ed1e5a11c1045c89e8c174b9f21ff
parent11caed9e121eef5fa6dc7dfbf4c92877d131dc4c
[LV] Switch to using canonical induction variables.

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246630 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/induction.ll
test/Transforms/LoopVectorize/reverse_induction.ll