From 9b12dc4f93f3032a60e337a71a936f6bd260c7f9 Mon Sep 17 00:00:00 2001 From: "J\"orn Rennecke" Date: Tue, 15 Mar 2005 12:39:01 +0000 Subject: [PATCH] re PR rtl-optimization/20291 (combine throws away clobbers before trying to split) PR rtl-optimization/20291 * combine.c (try_combine): If splitting fails, re-try with original combined pattern, i.e. before clobber stripping. From-SVN: r96476 --- gcc/ChangeLog | 6 ++++++ gcc/combine.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 276be0466e78..48e144d72f79 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-03-15 J"orn Rennecke + + PR rtl-optimization/20291 + * combine.c (try_combine): If splitting fails, re-try with + original combined pattern, i.e. before clobber stripping. + 2005-03-14 Eric Christopher * config/mips/mips.h (DWARF_CIE_DATA_ALIGNMENT): Change for diff --git a/gcc/combine.c b/gcc/combine.c index ae20c51caaf5..f97d6c04a4ab 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1594,6 +1594,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) { /* New patterns for I3 and I2, respectively. */ rtx newpat, newi2pat = 0; + rtvec newpat_vec_with_clobbers = 0; int substed_i2 = 0, substed_i1 = 0; /* Indicates need to preserve SET in I1 or I2 in I3 if it is not dead. */ int added_sets_1, added_sets_2; @@ -2154,6 +2155,18 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) /* Note which hard regs this insn has as inputs. */ mark_used_regs_combine (newpat); + /* If recog_for_combine fails, it strips existing clobbers. If we'll + consider splitting this pattern, we might need these clobbers. */ + if (i1 && GET_CODE (newpat) == PARALLEL + && GET_CODE (XVECEXP (newpat, 0, XVECLEN (newpat, 0) - 1)) == CLOBBER) + { + int len = XVECLEN (newpat, 0); + + newpat_vec_with_clobbers = rtvec_alloc (len); + for (i = 0; i < len; i++) + RTVEC_ELT (newpat_vec_with_clobbers, i) = XVECEXP (newpat, 0, i); + } + /* Is the result of combination a valid instruction? */ insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes); @@ -2281,6 +2294,13 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) } } + /* If recog_for_combine has discarded clobbers, try to use them + again for the split. */ + if (m_split == 0 && newpat_vec_with_clobbers) + m_split + = split_insns (gen_rtx_PARALLEL (VOIDmode, + newpat_vec_with_clobbers), i3); + if (m_split && NEXT_INSN (m_split) == NULL_RTX) { m_split = PATTERN (m_split);