From c3a50ca3a820618098bbcc991d5d3a38764933f0 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sun, 9 Apr 2006 10:06:20 +0000 Subject: [PATCH] re PR rtl-optimization/27073 (invalid gcse manipulation of REG_EQUIV notes) PR rtl-optimization/27073 * gcse.c (try_replace_reg): Just propagate into REG_EQUAL notes, not REG_EQUIVs. gcc/testsuite/ * gcc.c-torture/execute/pr27073.c: New test. From-SVN: r112803 --- gcc/ChangeLog | 6 ++++++ gcc/gcse.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/execute/pr27073.c | 25 +++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr27073.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e344f9e..60ce740 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-04-09 Richard Sandiford + + PR rtl-optimization/27073 + * gcse.c (try_replace_reg): Just propagate into REG_EQUAL notes, + not REG_EQUIVs. + 2006-04-08 Daniel Berlin * tree.h (tree_memory_tag): Add old_used_alone. diff --git a/gcc/gcse.c b/gcc/gcse.c index f0e25a2..0dbbe0b 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -2642,7 +2642,7 @@ find_used_regs (rtx *xptr, void *data ATTRIBUTE_UNUSED) static int try_replace_reg (rtx from, rtx to, rtx insn) { - rtx note = find_reg_equal_equiv_note (insn); + rtx note = find_reg_note (insn, REG_EQUAL, NULL); rtx src = 0; int success = 0; rtx set = single_set (insn); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3492c4b..41ba91e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-04-09 Richard Sandiford + + PR rtl-optimization/27073 + * gcc.c-torture/execute/pr27073.c: New test. + 2006-04-08 Mike Stump * gcc.dg/pragma-darwin.c: Improve for ppc64. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr27073.c b/gcc/testsuite/gcc.c-torture/execute/pr27073.c new file mode 100644 index 0000000..a58e9ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr27073.c @@ -0,0 +1,25 @@ +void __attribute__((noinline)) +foo (int *p, int d1, int d2, int d3, + short count, int s1, int s2, int s3, int s4, int s5) +{ + int n = count; + while (n--) + { + *p++ = s1; + *p++ = s2; + *p++ = s3; + *p++ = s4; + *p++ = s5; + } +} + +int main() +{ + int x[10], i; + + foo (x, 0, 0, 0, 2, 100, 200, 300, 400, 500); + for (i = 0; i < 10; i++) + if (x[i] != (i % 5 + 1) * 100) + abort (); + exit (0); +} -- 2.7.4