]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end: introduce IFN_VARYING for temporary statements [PR125597]
authorTamar Christina <tamar.christina@arm.com>
Fri, 12 Jun 2026 10:55:46 +0000 (11:55 +0100)
committerTamar Christina <tamar.christina@arm.com>
Fri, 12 Jun 2026 10:55:46 +0000 (11:55 +0100)
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.

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.

gcc/doc/ifn.texi
gcc/internal-fn.cc
gcc/internal-fn.def
gcc/internal-fn.h
gcc/tree-cfg.cc

index 95813a264730c38e1233d4ef5f989c0bc73c9a2a..9a2c60a5768af8da8b43ce6dc3343deb8673101a 100644 (file)
@@ -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
 
index 8a4622da794917b1ed494e9566482001867db570..0138c6f7ef0117f43afa5c81406a6564a425d304 100644 (file)
@@ -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)
 {
index a9fb933021f8b590b7894fcb159faabf6ab55767..af9f92950c73dd09356a625cf2fd60a5abbde321 100644 (file)
@@ -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)
 
index bd9ba8d6929af57bdcd7706feaa8ad5229532973..30930f388b069ca98167f0911c62681143979327 100644 (file)
@@ -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 *);
index 8fb80b8121ed1fe2bb3f26844018e3d77dfd7f90..dc07dde8cfd4cfa48ea52e28e96717fb5b7958ab 100644 (file)
@@ -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