On Wed, 10 Jun 2026, Tamar Christina wrote:
> This defines a new IFN "VARYING" to indicate that the operation has no current
> defining statement and so things like range analysis should just not report
> anything yet.
>
> In the vectorizer we can create new SSA variables that are only defined after
> vectorization is finishing. For instance the actual control statement for
> masked loops.
>
> However intermediate values need to be able to perform build expressions using
> this SSA name but since GCC 16 ranger now tries to analyze these and we ICE.
>
> This replaces the uses of gimple_nop in the definition with a value with a
> more
> defined semantics.
>
> Bootstrapped Regtested on aarch64-none-linux-gnu,
> arm-none-linux-gnueabihf, x86_64-pc-linux-gnu
> -m32, -m64 and no issues.
>
> Ok for master?
OK.
Thanks,
Richard.
> Thanks,
> Tamar
>
> gcc/ChangeLog:
>
> PR tree-optimization/125597
> * internal-fn.def (VARYING): New.
> * doc/ifn.texi: Document it.
> * internal-fn.cc (expand_VARYING): New.
> * internal-fn.h (expand_VARYING): New.
> * tree-cfg.cc (verify_gimple_call): Check for leaked IFN_VARYING.
>
> ---
> diff --git a/gcc/doc/ifn.texi b/gcc/doc/ifn.texi
> index
> 95813a264730c38e1233d4ef5f989c0bc73c9a2a..9a2c60a5768af8da8b43ce6dc3343deb8673101a
> 100644
> --- a/gcc/doc/ifn.texi
> +++ b/gcc/doc/ifn.texi
> @@ -1546,5 +1546,11 @@ The @code{IFN_FLOATTOBITINT} internal function is
> expanded by the
> The @code{IFN_BITINTTOFLOAT} internal function is expanded by the
> @code{expand_BITINTTOFLOAT} function.
>
> +@cindex @code{IFN_VARYING} internal function
> +@item @samp{IFN_VARYING}
> +Use @code{IFN_VARYING} as a temporary placeholder for a value whose
> +definition is still being built by the current pass. The pass that creates
> +it must replace it before finishing; the verifier rejects any remaining
> calls.
> +
> @end table
>
> diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc
> index
> 8a4622da794917b1ed494e9566482001867db570..0138c6f7ef0117f43afa5c81406a6564a425d304
> 100644
> --- a/gcc/internal-fn.cc
> +++ b/gcc/internal-fn.cc
> @@ -5686,6 +5686,13 @@ expand_MASK_CALL (internal_fn, gcall *)
> gcc_unreachable ();
> }
>
> +void
> +expand_VARYING (internal_fn, gcall *)
> +{
> + /* This IFN should reach expand. */
> + gcc_unreachable ();
> +}
> +
> void
> expand_MULBITINT (internal_fn, gcall *stmt)
> {
> diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def
> index
> a9fb933021f8b590b7894fcb159faabf6ab55767..af9f92950c73dd09356a625cf2fd60a5abbde321
> 100644
> --- a/gcc/internal-fn.def
> +++ b/gcc/internal-fn.def
> @@ -622,6 +622,10 @@ DEF_INTERNAL_FN (CO_FRAME, ECF_PURE | ECF_NOTHROW |
> ECF_LEAF, NULL)
> /* A NOP function with arbitrary arguments and return value. */
> DEF_INTERNAL_FN (NOP, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
>
> +/* A GIMPLE value with no definition and not Virtual Opeands for temporary
> + assignment cases within a pass. */
> +DEF_INTERNAL_FN (VARYING , ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL)
> +
> /* Temporary vehicle for __builtin_shufflevector. */
> DEF_INTERNAL_FN (SHUFFLEVECTOR, ECF_CONST | ECF_LEAF | ECF_NOTHROW, NULL)
>
> diff --git a/gcc/internal-fn.h b/gcc/internal-fn.h
> index
> bd9ba8d6929af57bdcd7706feaa8ad5229532973..30930f388b069ca98167f0911c62681143979327
> 100644
> --- a/gcc/internal-fn.h
> +++ b/gcc/internal-fn.h
> @@ -275,6 +275,7 @@ extern void expand_SPACESHIP (internal_fn, gcall *);
> extern void expand_TRAP (internal_fn, gcall *);
> extern void expand_ASSUME (internal_fn, gcall *);
> extern void expand_MASK_CALL (internal_fn, gcall *);
> +extern void expand_VARYING (internal_fn, gcall *);
> extern void expand_MULBITINT (internal_fn, gcall *);
> extern void expand_DIVMODBITINT (internal_fn, gcall *);
> extern void expand_FLOATTOBITINT (internal_fn, gcall *);
> diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
> index
> 8fb80b8121ed1fe2bb3f26844018e3d77dfd7f90..dc07dde8cfd4cfa48ea52e28e96717fb5b7958ab
> 100644
> --- a/gcc/tree-cfg.cc
> +++ b/gcc/tree-cfg.cc
> @@ -3419,6 +3419,14 @@ verify_gimple_call (gcall *stmt)
> }
> }
>
> + /* IFN_VARING is not allowed to be present after the completion of any pass
> + as it should have been replaced. */
> + if (gimple_call_internal_p (stmt, IFN_VARYING))
> + {
> + error ("%<.VARYING%> calls should have been replaced and are not
> allowed "
> + "outside of the pass that introduced them");
> + return true;
> + }
> /* ??? The C frontend passes unpromoted arguments in case it
> didn't see a function declaration before the call. So for now
> leave the call arguments mostly unverified. Once we gimplify
>
>
>
--
Richard Biener <[email protected]>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)