[PATCH] D94779: [Clang] Ensure vector predication pragma is ignored only when vectorization width is 1.

Sjoerd Meijer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 22 06:44:54 PST 2021


SjoerdMeijer added a comment.

In D94779#2515157 <https://reviews.llvm.org/D94779#2515157>, @dmgreen wrote:

> Thanks. @fhahn @SjoerdMeijer what do we think about the edge case where the width==1? As far as I understand (with this patch):
>
>   #pragma clang loop vectorize_predicate(disable) vectorize_width(4)
>   Gives llvm.loop.vectorize.predicate.enable=false, llvm.loop.vectorize.width=4, llvm.loop.vectorize.scalable.enable=false, llvm.loop.vectorize.enable=true
>   
>   #pragma clang loop vectorize_predicate(disable) vectorize_width(4)

I guess this is a typo, and should be `vectorize_predicate(enable)`

> Gives llvm.loop.vectorize.predicate.enable=true, llvm.loop.vectorize.width=4, llvm.loop.vectorize.scalable.enable=false, llvm.loop.vectorize.enable=true
>
> #pragma clang loop vectorize_predicate(enable) vectorize_width(1)
> Gives llvm.loop.vectorize.width=1, llvm.loop.vectorize.scalable.enable=false
>
> #pragma clang loop vectorize_predicate(disable) vectorize_width(1)
> Gives llvm.loop.vectorize.width=1, llvm.loop.vectorize.scalable.enable=false
>
>   Should we be adding llvm.loop.vectorize.predicate.enable metadata even when width=1? I would be inclined to emit the predication pragma anyway.

So yeah, I got confused about this edge case width=1 earlier, but have refreshed my memory.
I would like to ask the question if it matters? Vectorize.width = 1 disables vectorisation, so unless I miss something, I don't think it matters if we emit `llvm.loop.vectorize.predicate.enable=true` or `llvm.loop.vectorize.predicate.enable=false` because it is ignored anyway? But if we have a combination that doesn't make sense, like `width(1)` and `predicate(enable)`, should we emit a diagnostic if this is not already done?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94779/new/

https://reviews.llvm.org/D94779



More information about the cfe-commits mailing list