From: Jakub Jelinek Date: Mon, 16 Jan 2017 21:34:35 +0000 (+0100) Subject: re PR target/79080 (ICE: internal consistency failure (error: invalid rtl sharing... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e1bcfb924ae9b6dffd7757a6f1a193793af58c2f;p=gcc.git re PR target/79080 (ICE: internal consistency failure (error: invalid rtl sharing found in the insn) (error: shared rtx)) PR target/79080 * loop-doloop.c (doloop_modify): Call unshare_all_rtl_in_chain on sequence. Formatting fixes. (doloop_optimize): Formatting fixes. * gcc.dg/pr79080.c: New test. From-SVN: r244506 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a69094cb506..cc2e1d0c9f0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2017-01-16 Jakub Jelinek + PR target/79080 + * loop-doloop.c (doloop_modify): Call unshare_all_rtl_in_chain on + sequence. Formatting fixes. + (doloop_optimize): Formatting fixes. + PR driver/49726 * gcc.c (debug_level_greater_than_spec_func): New function. (static_spec_functions): Add debug-level-gt spec function. diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c index 5616709776e..3b9a96034ab 100644 --- a/gcc/loop-doloop.c +++ b/gcc/loop-doloop.c @@ -479,9 +479,13 @@ doloop_modify (struct loop *loop, struct niter_desc *desc, /* Insert initialization of the count register into the loop header. */ start_sequence (); + /* count has been already copied through copy_rtx. */ + reset_used_flags (count); + set_used_flags (condition); tmp = force_operand (count, counter_reg); convert_move (counter_reg, tmp, 1); sequence = get_insns (); + unshare_all_rtl_in_chain (sequence); end_sequence (); emit_insn_after (sequence, BB_END (loop_preheader_edge (loop)->src)); @@ -489,10 +493,8 @@ doloop_modify (struct loop *loop, struct niter_desc *desc, { rtx ass = copy_rtx (desc->noloop_assumptions); basic_block preheader = loop_preheader_edge (loop)->src; - basic_block set_zero - = split_edge (loop_preheader_edge (loop)); - basic_block new_preheader - = split_edge (loop_preheader_edge (loop)); + basic_block set_zero = split_edge (loop_preheader_edge (loop)); + basic_block new_preheader = split_edge (loop_preheader_edge (loop)); edge te; /* Expand the condition testing the assumptions and if it does not pass, @@ -688,8 +690,7 @@ doloop_optimize (struct loop *loop) rtx_insn *doloop_seq = targetm.gen_doloop_end (doloop_reg, start_label); word_mode_size = GET_MODE_PRECISION (word_mode); - word_mode_max - = (HOST_WIDE_INT_1U << (word_mode_size - 1) << 1) - 1; + word_mode_max = (HOST_WIDE_INT_1U << (word_mode_size - 1) << 1) - 1; if (! doloop_seq && mode != word_mode /* Before trying mode different from the one in that # of iterations is diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e8f00c195a7..2ac159733c4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-01-16 Jakub Jelinek + + PR target/79080 + * gcc.dg/pr79080.c: New test. + 2017-01-16 David Malcolm PR c/78304 diff --git a/gcc/testsuite/gcc.dg/pr79080.c b/gcc/testsuite/gcc.dg/pr79080.c new file mode 100644 index 00000000000..de0969d4647 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr79080.c @@ -0,0 +1,19 @@ +/* PR target/79080 */ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +/* { dg-additional-options "-mcpu=8548" { target { powerpc*-*-* && ilp32 } } } */ + +int +foo (char x) +{ + int a; + + for (;;) + { + x += 59; + if (x != 0) + a = 0; + else + return 0; + } +}