From: Jim Wilson Date: Fri, 10 Mar 1995 20:03:20 +0000 (-0800) Subject: (max_uid_cuid): New static variable. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4255220d922400aeb4c3da7b627b716c908d9a4e;p=gcc.git (max_uid_cuid): New static variable. (INSN_CUID): Call abort if INSN is out of range. (combine_instructions): Set max_uid_cuid. Set uid_cuid directly instead of through INSN_CUID. (get_last_value): Use prev_real_insn instead of prev_nonnote_insn. Ignore USE insns generated by combine. From-SVN: r9169 --- diff --git a/gcc/combine.c b/gcc/combine.c index 1a77ca39851..d2df7d8755b 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -135,10 +135,13 @@ static int total_attempts, total_merges, total_extras, total_successes; the dumps produced by earlier passes with those from later passes. */ static int *uid_cuid; +static int max_uid_cuid; /* Get the cuid of an insn. */ -#define INSN_CUID(INSN) (uid_cuid[INSN_UID (INSN)]) +#define INSN_CUID(INSN) (INSN_UID (INSN) > max_uid_cuid \ + ? (abort(), 0) \ + : uid_cuid[INSN_UID (INSN)]) /* Maximum register number, which is the size of the tables below. */ @@ -488,6 +491,7 @@ combine_instructions (f, nregs) i = INSN_UID (insn); uid_cuid = (int *) alloca ((i + 1) * sizeof (int)); + max_uid_cuid = i; nonzero_bits_mode = mode_for_size (HOST_BITS_PER_WIDE_INT, MODE_INT, 0); @@ -513,7 +517,7 @@ combine_instructions (f, nregs) for (insn = f, i = 0; insn; insn = NEXT_INSN (insn)) { - INSN_CUID (insn) = ++i; + uid_cuid[INSN_UID (insn)] = ++i; subst_low_cuid = i; subst_insn = insn; @@ -9846,7 +9850,7 @@ get_last_value (x) && reg_last_set_label[regno] != label_tick)) return 0; - /* If the value was set in a later insn that the ones we are processing, + /* If the value was set in a later insn than the ones we are processing, we can't use it even if the register was only set once, but make a quick check to see if the previous insn set it to something. This is commonly the case when the same pseudo is used by repeated insns. */ @@ -9855,9 +9859,13 @@ get_last_value (x) { rtx insn, set; - for (insn = prev_nonnote_insn (subst_insn); - insn && INSN_CUID (insn) >= subst_low_cuid; - insn = prev_nonnote_insn (insn)) + /* 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. */ + for (insn = prev_real_insn (subst_insn); + insn && (GET_CODE (PATTERN (insn)) == USE + || INSN_CUID (insn) >= subst_low_cuid); + insn = prev_real_insn (insn)) ; if (insn