aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcse.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2005-12-20 17:06:14 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2005-12-20 17:06:14 +0000
commit64068ca2f1fb0174ceb16e0f0f917da7afe82837 (patch)
tree82d3d092201bbbb1c8e056d0e465dbc2ca06c1a6 /gcc/gcse.c
parentf5a7da0f62f3eed45dad990ef70a91d45a3fb5d3 (diff)
downloadgcc-64068ca2f1fb0174ceb16e0f0f917da7afe82837.zip
gcc-64068ca2f1fb0174ceb16e0f0f917da7afe82837.tar.gz
gcc-64068ca2f1fb0174ceb16e0f0f917da7afe82837.tar.bz2
re PR rtl-optimization/25115 (Segmentation fault in pre_insert_copy_insn)
2005-12-20 Roger Sayle <roger@eyesopen.com> Paolo Bonzini <bonzini@gnu.org> PR rtl-optimization/25115 * gcse.c (pre_insert_copy_insn): Fall back to the sole SET in the insn if there is no SET for an expression that is equivalent to EXPR. Co-Authored-By: Paolo Bonzini <bonzini@gnu.org> From-SVN: r108855
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r--gcc/gcse.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c
index df6e484..8e4dbec 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4219,7 +4219,7 @@ pre_insert_copy_insn (struct expr *expr, rtx insn)
int regno = REGNO (reg);
int indx = expr->bitmap_index;
rtx pat = PATTERN (insn);
- rtx set, new_insn;
+ rtx set, first_set, new_insn;
rtx old_reg;
int i;
@@ -4233,17 +4233,29 @@ pre_insert_copy_insn (struct expr *expr, rtx insn)
case PARALLEL:
/* Search through the parallel looking for the set whose
source was the expression that we're interested in. */
+ first_set = NULL_RTX;
set = NULL_RTX;
for (i = 0; i < XVECLEN (pat, 0); i++)
{
rtx x = XVECEXP (pat, 0, i);
- if (GET_CODE (x) == SET
- && expr_equiv_p (SET_SRC (x), expr->expr))
+ if (GET_CODE (x) == SET)
{
- set = x;
- break;
+ /* If the source was a REG_EQUAL or REG_EQUIV note, we
+ may not find an equivalent expression, but in this
+ case the PARALLEL will have a single set. */
+ if (first_set == NULL_RTX)
+ first_set = x;
+ if (expr_equiv_p (SET_SRC (x), expr->expr))
+ {
+ set = x;
+ break;
+ }
}
}
+
+ gcc_assert (first_set);
+ if (set == NULL_RTX)
+ set = first_set;
break;
default: