From 2d9dd4fb867bffd009ebc85896dceb932559d90a Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 10 Mar 2017 08:57:45 +0100 Subject: [PATCH] re PR middle-end/79909 (ICE error: invalid rtl sharing found in the insn on ppc64le) PR rtl-optimization/79909 * combine.c (try_combine): Use simplify_replace_rtx on individual CALL_INSN_FUNCTION_USAGE elements instead of replace_rtx on copy_rtx of the whole CALL_INSN_FUNCTION_USAGE. * gcc.target/powerpc/pr79909.c: New test. From-SVN: r246023 --- gcc/ChangeLog | 5 ++++ gcc/combine.c | 35 +++++++++++----------- gcc/testsuite/ChangeLog | 3 ++ gcc/testsuite/gcc.target/powerpc/pr79909.c | 13 ++++++++ 4 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr79909.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9a4844e2aac..b44a7a57c38 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2017-03-10 Jakub Jelinek + PR rtl-optimization/79909 + * combine.c (try_combine): Use simplify_replace_rtx on individual + CALL_INSN_FUNCTION_USAGE elements instead of replace_rtx on copy_rtx + of the whole CALL_INSN_FUNCTION_USAGE. + PR tree-optimization/79972 * gimple-ssa-warn-alloca.c (alloca_call_type): Only call get_range_info on SSA_NAMEs. Formatting fixes. diff --git a/gcc/combine.c b/gcc/combine.c index b5c0c184a62..66215a607bd 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -4293,26 +4293,25 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, if (CALL_P (i3) && CALL_INSN_FUNCTION_USAGE (i3)) { - rtx call_usage = CALL_INSN_FUNCTION_USAGE (i3); - - reset_used_flags (call_usage); - call_usage = copy_rtx (call_usage); - - if (substed_i2) + for (rtx link = CALL_INSN_FUNCTION_USAGE (i3); link; + link = XEXP (link, 1)) { - /* I2SRC must still be meaningful at this point. Some splitting - operations can invalidate I2SRC, but those operations do not - apply to calls. */ - gcc_assert (i2src); - replace_rtx (call_usage, i2dest, i2src); + if (substed_i2) + { + /* I2SRC must still be meaningful at this point. Some + splitting operations can invalidate I2SRC, but those + operations do not apply to calls. */ + gcc_assert (i2src); + XEXP (link, 0) = simplify_replace_rtx (XEXP (link, 0), + i2dest, i2src); + } + if (substed_i1) + XEXP (link, 0) = simplify_replace_rtx (XEXP (link, 0), + i1dest, i1src); + if (substed_i0) + XEXP (link, 0) = simplify_replace_rtx (XEXP (link, 0), + i0dest, i0src); } - - if (substed_i1) - replace_rtx (call_usage, i1dest, i1src); - if (substed_i0) - replace_rtx (call_usage, i0dest, i0src); - - CALL_INSN_FUNCTION_USAGE (i3) = call_usage; } if (undobuf.other_insn) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b60d750a062..bf1c69d7425 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2017-03-10 Jakub Jelinek + PR rtl-optimization/79909 + * gcc.target/powerpc/pr79909.c: New test. + PR tree-optimization/79972 * gcc.dg/pr79972.c: New test. diff --git a/gcc/testsuite/gcc.target/powerpc/pr79909.c b/gcc/testsuite/gcc.target/powerpc/pr79909.c new file mode 100644 index 00000000000..a9cdc8e4792 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr79909.c @@ -0,0 +1,13 @@ +/* PR rtl-optimization/79909 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mxl-compat" } */ + +typedef float T __attribute__ ((mode (TD))); +T b, c, d, e, f, g; +void bar (T, T, T, T, T, T); + +void +foo (void) +{ + bar (e, b, f, c, g, d); +} -- 2.30.2