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

--- Comment #1 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
If we have to assume that we already applied simplifications on the THEN or
ELSE branches it doesn't appear to be correct to look for split points inside
an IF_THEN_ELSE expression anymore.

This patch fixes the testcase for me:

index cff76cd3303..8f90a354977 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5387,8 +5387,12 @@ find_split_point (rtx *loc, rtx_insn *insn, bool
set_src)
   /* Otherwise, select our actions depending on our rtx class.  */
   switch (GET_RTX_CLASS (code))
     {
-    case RTX_BITFIELD_OPS:             /* This is ZERO_EXTRACT and
SIGN_EXTRACT.  */
     case RTX_TERNARY:
+      /* Don't split inside then/else branches of an IF_THEN_ELSE.
+        Simplification might have changed the expressions based on
+        the condition.  */
+      return 0;
+    case RTX_BITFIELD_OPS:             /* This is ZERO_EXTRACT and
SIGN_EXTRACT.  */
       split = find_split_point (&XEXP (x, 2), insn, false);
       if (split)
        return split;

Reply via email to