On Mon, Nov 24, 2025 at 02:28:40PM +0100, Richard Biener wrote:
> The following recors both a possibly notinbranch and an inbranch
> SIMD clone during analysis so that we can properly handle the
> late decision on loop masking. I'm not sure to which extent things
> like SIMD_CLONE_ARG_TYPE_LINEAR_* and friends are uniform amongst
> all SIMD clones for a function. If there can be actual differences
> that would result in different recordings in simd_clone_info[]
> we'd have to duplicate those as well.
If it is a result from the same declare simd directive, then
it is necessarily the same, like for
#pragma omp declare simd linear(a:4) uniform(b) simdlen(8)
int foo (int a, int b, int c);
for both inbranch and notinbranch clones linear & uniform will be
the same.
But it can be different, either from multiple declare simd on the
same decl or from multiple declarations.
#pragma omp declare simd linear(a:4) simdlen(8) inbranch
#pragma omp declare simd linear(a:8) uniform(b) simdlen(8) notinbranch
int bar (int a, int b, int c);
or
#pragma omp declare simd linear(a:4) simdlen(8) inbranch
int baz (int a, int b, int c);
#pragma omp declare simd linear(a:8) uniform(b) simdlen(8) notinbranch
int baz (int a, int b, int c);
For bar and baz, the notinbranch clones have middle argument uniform
and first argument linear with step 8, while the inbranch clones have
the middle argument normally vectorized and first argument linear with step
4 instead (but could be any other clause combination).
So I wonder if you shouldn't use both clone and clone_inbranch solely
if the analysis phase finds that there are clones with the same badness
when ignoring inbranch vs. notinbranch.
Jakub