[LLVMdev] LLVM Loop Vectorizer puzzle

Arnold Schwaighofer aschwaighofer at apple.com
Thu May 23 06:52:09 PDT 2013

On May 23, 2013, at 8:06 AM, Hal Finkel <hfinkel at anl.gov> wrote:

> ----- Original Message -----
>> Hi,
>> Just from personal interest, is there a canonical way in IR+metadata
>> to express "This small constant trip-count loop is desired to be
>> converted into a sequence of vector operations directly"? Ie,
>> mapping a 4 element i32 loop into a linear sequence of <4 x i32>
>> operations. Obviously this may not always be a win, but I'm just
>> wondering if there's a way to communicate this intent and get around
>> the vectorizer-min-trip-count in specially desired cases, or if I
>> should decide to generate vectorized IR directly. (This is in code
>> coming from a DSL which will impliciltly insert annotations, not
>> manually written loops.)
> I think that the answer is: not currently. On the other hand, if the loop is small enough to get unrolled, then you can either use the BB vectorization pass or the SLP vectorization pass to vectorize it.


I would like us to grow a few annotations, among others, one to force vectorization irrespective whether the loop vectorizer thinks it is beneficial or not - however, this is future music.

More information about the llvm-dev mailing list