(combine_instrutions): Set subst_prev_insn to zero.
authorJim Wilson <wilson@gcc.gnu.org>
Mon, 1 May 1995 23:43:28 +0000 (16:43 -0700)
committerJim Wilson <wilson@gcc.gnu.org>
Mon, 1 May 1995 23:43:28 +0000 (16:43 -0700)
(try_combine, undo_all): Likewise.
(get_last_value): Return zero if subst_prev_insn set.

From-SVN: r9559

gcc/combine.c

index 827141c2e5f7b38d594962494f716add359e6333..229479fd14514df2e26a6104a30d028738989716 100644 (file)
@@ -518,6 +518,10 @@ combine_instructions (f, nregs)
 
   label_tick = 1;
 
+  /* We need to initialize it here, because record_dead_and_set_regs may call
+     get_last_value.  */
+  subst_prev_insn = NULL_RTX;
+
   setup_incoming_promotions ();
 
   for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
@@ -2337,6 +2341,10 @@ try_combine (i3, i2, i1)
 
   combine_successes++;
 
+  /* Clear this here, so that subsequent get_last_value calls are not
+     affected.  */
+  subst_prev_insn = NULL_RTX;
+
   if (added_links_insn
       && (newi2pat == 0 || INSN_CUID (added_links_insn) < INSN_CUID (i2))
       && INSN_CUID (added_links_insn) < INSN_CUID (i3))
@@ -2364,6 +2372,10 @@ undo_all ()
 
   obfree (undobuf.storage);
   undobuf.num_undo = 0;
+
+  /* Clear this here, so that subsequent get_last_value calls are not
+     affected.  */
+  subst_prev_insn = NULL_RTX;
 }
 \f
 /* Find the innermost point within the rtx at LOC, possibly LOC itself,
@@ -9965,10 +9977,15 @@ get_last_value (x)
      This does not work if there exists an instruction which is temporarily
      not on the insn chain.  */
 
-  if (INSN_CUID (reg_last_set[regno]) >= subst_low_cuid && ! subst_prev_insn)
+  if (INSN_CUID (reg_last_set[regno]) >= subst_low_cuid)
     {
       rtx insn, set;
 
+      /* We can not do anything useful in this case, because there is
+        an instruction which is not on the insn chain.  */
+      if (subst_prev_insn)
+       return 0;
+
       /* Skip over USE insns.  They are not useful here, and they may have
         been made by combine, in which case they do not have a INSN_CUID
         value.  We can't use prev_real_insn, because that would incorrectly