[PATCH] D33058: [LV] Sink casts to unravel first order recurrence

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 12:40:50 PDT 2017


Ayal created this revision.
Herald added a subscriber: mzolotukhin.

A loop-phi Phi that involves a first order recurrence can be vectorized only if the Previous instruction that feeds Phi from the previous iteration dominates all of Phi's users. This condition is needed to allow introducing instructions that use both Phi and Previous, combine their values, and feed the users of Phi and Previous.

When Phi has users of types different from its own, a mediating Cast instruction that uses Phi may appear above Previous, thereby breaking this condition. This patch tries to sink such a Cast past Previous, provided the users of Cast are dominated by Previous, thereby enabling vectorization of the loop.


https://reviews.llvm.org/D33058

Files:
  include/llvm/Transforms/Utils/LoopUtils.h
  lib/Transforms/Utils/LoopUtils.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/first-order-recurrence.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33058.98502.patch
Type: text/x-patch
Size: 6885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170510/361170a8/attachment.bin>


More information about the llvm-commits mailing list