From: Jakub Jelinek Date: Tue, 21 Mar 2017 14:49:51 +0000 (+0100) Subject: re PR target/80125 (r246297 causes segfault in reg_used_between_p()) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=85106b8757d46f80a5993fc75948a82ce16c1f74;p=gcc.git re PR target/80125 (r246297 causes segfault in reg_used_between_p()) PR target/80125 * combine.c (can_combine_p): Revert the 2017-03-20 change, only check reg_used_between_p between insn and one of succ or succ2 depending on if succ is artificial insn not inserted into insn stream. * gcc.target/powerpc/pr80125.c: New test. Co-Authored-By: Segher Boessenkool From-SVN: r246323 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a7a13f1049a..03b2a419331 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-03-21 Jakub Jelinek + Segher Boessenkool + + PR target/80125 + * combine.c (can_combine_p): Revert the 2017-03-20 change, only + check reg_used_between_p between insn and one of succ or succ2 + depending on if succ is artificial insn not inserted into insn + stream. + 2017-03-21 Martin Liska PR gcov-profile/80081 diff --git a/gcc/combine.c b/gcc/combine.c index 17258f0e0c5..c118aa25806 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1954,15 +1954,20 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED, /* Don't substitute into a non-local goto, this confuses CFG. */ || (JUMP_P (i3) && find_reg_note (i3, REG_NON_LOCAL_GOTO, NULL_RTX)) /* Make sure that DEST is not used after INSN but before SUCC, or - between SUCC and SUCC2. */ - || (succ && reg_used_between_p (dest, insn, succ)) - || (succ2 && reg_used_between_p (dest, succ, succ2)) - /* Make sure that DEST is not used after SUCC but before I3. */ + after SUCC and before SUCC2, or after SUCC2 but before I3. */ || (!all_adjacent && ((succ2 && (reg_used_between_p (dest, succ2, i3) || reg_used_between_p (dest, succ, succ2))) - || (!succ2 && succ && reg_used_between_p (dest, succ, i3)))) + || (!succ2 && succ && reg_used_between_p (dest, succ, i3)) + || (succ + /* SUCC and SUCC2 can be split halves from a PARALLEL; in + that case SUCC is not in the insn stream, so use SUCC2 + instead for this test. */ + && reg_used_between_p (dest, insn, + succ2 + && INSN_UID (succ) == INSN_UID (succ2) + ? succ2 : succ)))) /* Make sure that the value that is to be substituted for the register does not use any registers whose values alter in between. However, If the insns are adjacent, a use can't cross a set even though we diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c2be77a3b21..6a87efc180d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-21 Jakub Jelinek + + PR target/80125 + * gcc.target/powerpc/pr80125.c: New test. + 2017-03-21 Bill Schmidt Richard Biener diff --git a/gcc/testsuite/gcc.target/powerpc/pr80125.c b/gcc/testsuite/gcc.target/powerpc/pr80125.c new file mode 100644 index 00000000000..494a6e673b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr80125.c @@ -0,0 +1,23 @@ +/* PR target/80125 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -maltivec" } */ + +#include + +int a[1]; + +void +foo () +{ + vector int b, e, f, g, h, j, n; + vector unsigned c, d; + f = vec_sums (h, b); + vector int i = vec_mergel (f, g); + vector int k = vec_mergel (i, j); + vector int l = vec_sl (k, c); + vector int m = vec_sl (l, d); + vector char o; + vector int p = vec_perm (m, n, o); + e = vec_sra (p, c); + vec_st (e, 0, a); +}