From: Jakub Jelinek Date: Tue, 3 Oct 2017 09:49:37 +0000 (+0200) Subject: re PR target/82386 (internal compiler error: Segmentation fault on 32-bit powerpc... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bb81a576f259256b38d46dd41d3bd5f5a36cfd6f;p=gcc.git re PR target/82386 (internal compiler error: Segmentation fault on 32-bit powerpc BE targets) PR target/82386 * combine.c (combine_instructions): Don't combine in unreachable basic blocks. * gcc.dg/pr82386.c: New test. From-SVN: r253378 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c0b2f2b1c6d..934dd76fa85 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-10-03 Jakub Jelinek + + PR target/82386 + * combine.c (combine_instructions): Don't combine in unreachable + basic blocks. + 2017-08-18 Peter Bergner PR target/80210 diff --git a/gcc/combine.c b/gcc/combine.c index e502fa14726..400cef3495a 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1232,6 +1232,12 @@ combine_instructions (rtx_insn *f, unsigned int nregs) FOR_EACH_BB_FN (this_basic_block, cfun) { rtx_insn *last_combined_insn = NULL; + + /* Ignore instruction combination in basic blocks that are going to + be removed as unreachable anyway. See PR82386. */ + if (EDGE_COUNT (this_basic_block->preds) == 0) + continue; + optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block); last_call_luid = 0; mem_last_set = -1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 004af663545..74023abc015 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-03 Jakub Jelinek + + PR target/82386 + * gcc.dg/pr82386.c: New test. + 2017-10-02 Paolo Carlini PR c++/70570 diff --git a/gcc/testsuite/gcc.dg/pr82386.c b/gcc/testsuite/gcc.dg/pr82386.c new file mode 100644 index 00000000000..8901f2b4cc7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr82386.c @@ -0,0 +1,38 @@ +/* PR target/82386 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -w" } */ +/* { dg-additional-options "-misel" { target powerpc*-*-* } } */ + +long long int fs; +int vm; + +void +sd (void) +{ + fs = 1; + vm = 2; + goto zf; + + if (0) + { + int y6 = 0; + int *uu = &y6; + short int he; + int of = 0; + + zf: + for (;;) + { + he = of; + if (he || (fs |= vm)) + { + *uu = fs; + fs += vm; + } + if (y6 == vm) + fs |= he; + he = y6 || fs; + fs /= 0; + } + } +}