]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/cse.c
Merge in trunk.
[thirdparty/gcc.git] / gcc / cse.c
index 484a9746b7a068dab056aa066c5fc2018b65e5a3..73755849975730f88e40e9390d46c30f74451798 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3204,9 +3204,27 @@ fold_rtx (rtx x, rtx insn)
 
 #ifdef HAVE_cc0
          case CC0:
-           folded_arg = prev_insn_cc0;
-           mode_arg = prev_insn_cc0_mode;
-           const_arg = equiv_constant (folded_arg);
+           /* The cc0-user and cc0-setter may be in different blocks if
+              the cc0-setter potentially traps.  In that case PREV_INSN_CC0
+              will have been cleared as we exited the block with the
+              setter.
+
+              While we could potentially track cc0 in this case, it just
+              doesn't seem to be worth it given that cc0 targets are not
+              terribly common or important these days and trapping math
+              is rarely used.  The combination of those two conditions
+              necessary to trip this situation is exceedingly rare in the
+              real world.  */
+           if (!prev_insn_cc0)
+             {
+               const_arg = NULL_RTX;
+             }
+           else
+             {
+               folded_arg = prev_insn_cc0;
+               mode_arg = prev_insn_cc0_mode;
+               const_arg = equiv_constant (folded_arg);
+             }
            break;
 #endif
 
@@ -5670,11 +5688,6 @@ cse_insn (rtx insn)
          invalidate (XEXP (dest, 0), GET_MODE (dest));
       }
 
-  /* A volatile ASM or an UNSPEC_VOLATILE invalidates everything.  */
-  if (NONJUMP_INSN_P (insn)
-      && volatile_insn_p (PATTERN (insn)))
-    flush_hash_table ();
-
   /* Don't cse over a call to setjmp; on some machines (eg VAX)
      the regs restored by the longjmp come from a later time
      than the setjmp.  */