From 28430b2e56e7ca59b3099eb743936cc40b6bede9 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov <vmakarov@redhat.com> Date: Fri, 2 Nov 2012 14:44:12 +0000 Subject: [PATCH] re PR middle-end/55130 (ICE in insn_rhs_dead_pseudo_p, at lra-constraints.c:3224) 2012-11-02 Vladimir Makarov <vmakarov@redhat.com> PR middle-end/55130 * lra-constraints.c (debug_loc_equivalence_change_p): Rename to loc_equivalence_change_p. (lra_constraints): Check equiv_insn_bitmap for debug insn. Call loc_equivalence_change_p for non-transformed insn. 2012-11-02 Vladimir Makarov <vmakarov@redhat.com> PR middle-end/55150 * gcc.target/i386/pr55130.c: New test. From-SVN: r193096 --- gcc/ChangeLog | 8 ++++++++ gcc/lra-constraints.c | 24 +++++++++++++++++------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr55130.c | 15 +++++++++++++++ 4 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr55130.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f0a6a97f91e2..1d6729449817 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2012-11-02 Vladimir Makarov <vmakarov@redhat.com> + + PR middle-end/55130 + * lra-constraints.c (debug_loc_equivalence_change_p): Rename to + loc_equivalence_change_p. + (lra_constraints): Check equiv_insn_bitmap for debug insn. Call + loc_equivalence_change_p for non-transformed insn. + 2012-11-02 Eric Botcazou <ebotcazou@adacore.com> * cfg-flags.def (ABNORMAL_CALL): Fix comment. diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index afc49d75bdf9..affdc5f5788a 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -3095,10 +3095,10 @@ contains_reg_p (rtx x, bool hard_reg_p, bool spilled_p) return false; } -/* Process all regs in debug location *LOC and change them on - equivalent substitution. Return true if any change was done. */ +/* Process all regs in location *LOC and change them on equivalent + substitution. Return true if any change was done. */ static bool -debug_loc_equivalence_change_p (rtx *loc) +loc_equivalence_change_p (rtx *loc) { rtx subst, reg, x = *loc; bool result = false; @@ -3130,11 +3130,11 @@ debug_loc_equivalence_change_p (rtx *loc) for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) { if (fmt[i] == 'e') - result = debug_loc_equivalence_change_p (&XEXP (x, i)) || result; + result = loc_equivalence_change_p (&XEXP (x, i)) || result; else if (fmt[i] == 'E') for (j = XVECLEN (x, i) - 1; j >= 0; j--) result - = debug_loc_equivalence_change_p (&XVECEXP (x, i, j)) || result; + = loc_equivalence_change_p (&XVECEXP (x, i, j)) || result; } return result; } @@ -3322,7 +3322,6 @@ lra_constraints (bool first_p) substituted by their equivalences. */ EXECUTE_IF_SET_IN_BITMAP (&equiv_insn_bitmap, 0, uid, bi) lra_push_insn_by_uid (uid); - bitmap_clear (&equiv_insn_bitmap); lra_eliminate (false); min_len = lra_insn_stack_length (); new_insns_num = 0; @@ -3353,7 +3352,8 @@ lra_constraints (bool first_p) /* We need to check equivalence in debug insn and change pseudo to the equivalent value if necessary. */ curr_id = lra_get_insn_recog_data (curr_insn); - if (debug_loc_equivalence_change_p (curr_id->operand_loc[0])) + if (bitmap_bit_p (&equiv_insn_bitmap, INSN_UID (curr_insn)) + && loc_equivalence_change_p (curr_id->operand_loc[0])) { lra_update_insn_regno_info (curr_insn); changed_p = true; @@ -3417,8 +3417,18 @@ lra_constraints (bool first_p) init_curr_operand_mode (); if (curr_insn_transform ()) changed_p = true; + /* Check non-transformed insns too for equiv change as USE + or CLOBBER don't need reloads but can contain pseudos + being changed on their equivalences. */ + else if (bitmap_bit_p (&equiv_insn_bitmap, INSN_UID (curr_insn)) + && loc_equivalence_change_p (&PATTERN (curr_insn))) + { + lra_update_insn_regno_info (curr_insn); + changed_p = true; + } } } + bitmap_clear (&equiv_insn_bitmap); /* If we used a new hard regno, changed_p should be true because the hard reg is assigned to a new pseudo. */ #ifdef ENABLE_CHECKING diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b161d58c7e39..9ebf52999ad2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-11-02 Vladimir Makarov <vmakarov@redhat.com> + + PR middle-end/55150 + * gcc.target/i386/pr55130.c: New test. + 2012-11-02 Jakub Jelinek <jakub@redhat.com> PR target/55147 diff --git a/gcc/testsuite/gcc.target/i386/pr55130.c b/gcc/testsuite/gcc.target/i386/pr55130.c new file mode 100644 index 000000000000..61b98dc934cf --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr55130.c @@ -0,0 +1,15 @@ +/* PR middle-end/55130 */ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O1 -mregparm=3 -mpreferred-stack-boundary=2" } */ + +extern void bar(long long); + +int foo(long long a, char b, long long c, long long d) +{ + if (c == 0) + c = d; + + bar(b + c); + + return a == d; +} -- GitLab