https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103028

--- Comment #6 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
This will probably avoid the error.  valid_insn_p checks the alternatives, and
fails for the invalid cmpdi_ccu that we attempt to create.  Conceivably, this
could be avoided by narrowing down the condition of the cbranch4 expander to
reject unfit constants after reload.  Alas, there doesn't seem to be any
existing opportunity to adjust the canonicalized condition to fit md
constraints, e.g. undoing the LEU to LTU transformation so that we could still
get a conditional trap for this case: we don't go through the cbranch4 expander
there.

diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 017944f4f79aa..b0052f6c5ced3 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -4726,7 +4726,9 @@ find_cond_trap (basic_block test_bb, edge then_edge, edge
else_edge)

   /* If that results in an invalid insn, back out.  */
   for (rtx_insn *x = seq; x; x = NEXT_INSN (x))
-    if (recog_memoized (x) < 0)
+    if (reload_completed
+       ? !valid_insn_p (x)
+       : recog_memoized (x) < 0)
       return FALSE;

   /* Emit the new insns before cond_earliest.  */

Reply via email to