[clang] [clang][CodeGen] Fix metadata when vectorization is disabled by pragma (PR #135163)
Michael Kruse via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 14 05:08:11 PDT 2025
Meinersbur wrote:
> I think there are two possible interpretations of `vectorize(disable) vectorize_width(scalable)`, as follows:
>
> * It is equivalent to `vectorize(disable)` so vectorization is disabled, as the document says:
> > Pragmas setting transformation options imply the transformation is enabled, as if it was enabled via the corresponding transformation pragma (e.g. `vectorize(enable)`). If the transformation is disabled (e.g. `vectorize(disable)`), that takes precedence over transformations option pragmas implying that transformation..
This seems to be the more logical interpretation. Like `unroll(disable) unroll_count(5)` which wold also not unroll loops.
> * Since `vectorize(disable)` is equivalent to `vectorize_width(1)`, it is equivalent to `vectorize_width(1, scalable)` so that vectorization should be performed [as previously commented](https://github.com/llvm/llvm-project/pull/135163#discussion_r2037236948).
That `llvm.loop.vectorize.width==1` disables vectorization is just a quirk of how the metadata evolved. It should not leak into the user-visible semantics.
If you prefer, you can also clean up the metata and introduce a separate `llvm.loop.interleave.enable`.
https://github.com/llvm/llvm-project/pull/135163
More information about the cfe-commits
mailing list