From: jakub Date: Thu, 13 Dec 2018 23:33:57 +0000 (+0000) Subject: PR rtl-optimization/88470 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=060f0b578e0d6ea6518e7bca6d200a2357976a3c;p=thirdparty%2Fgcc.git PR rtl-optimization/88470 * cfgcleanup.c (outgoing_edges_match): If the function is shrink-wrapped and bb1 ends with a JUMP_INSN with a single fake edge to EXIT, return false. * gcc.target/i386/pr88470.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267112 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 98c6fc02dd01..3f1eeb7ba418 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-12-13 Jakub Jelinek + + PR rtl-optimization/88470 + * cfgcleanup.c (outgoing_edges_match): If the function is + shrink-wrapped and bb1 ends with a JUMP_INSN with a single fake + edge to EXIT, return false. + 2018-12-13 Martin Sebor * doc/extend.texi: Consistently use @code for const and volatile diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index bc4a78889db6..1b5e931be0a4 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -1592,10 +1592,13 @@ outgoing_edges_match (int mode, basic_block bb1, basic_block bb2) if (crtl->shrink_wrapped && single_succ_p (bb1) && single_succ (bb1) == EXIT_BLOCK_PTR_FOR_FN (cfun) - && !JUMP_P (BB_END (bb1)) + && (!JUMP_P (BB_END (bb1)) + /* Punt if the only successor is a fake edge to exit, the jump + must be some weird one. */ + || (single_succ_edge (bb1)->flags & EDGE_FAKE) != 0) && !(CALL_P (BB_END (bb1)) && SIBLING_CALL_P (BB_END (bb1)))) return false; - + /* If BB1 has only one successor, we may be looking at either an unconditional jump, or a fake edge to exit. */ if (single_succ_p (bb1) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2fe17d2d54e0..b0dae2b68d89 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-13 Jakub Jelinek + + PR rtl-optimization/88470 + * gcc.target/i386/pr88470.c: New test. + 2018-12-13 Vladimir Makarov PR rtl-optimization/88414 diff --git a/gcc/testsuite/gcc.target/i386/pr88470.c b/gcc/testsuite/gcc.target/i386/pr88470.c new file mode 100644 index 000000000000..8d4400da87d1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr88470.c @@ -0,0 +1,16 @@ +/* PR rtl-optimization/88470 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -maccumulate-outgoing-args -ftrapv -fno-ivopts -fno-reorder-blocks-and-partition" } */ + +void +foo (long x, long *y) +{ + long *a = y - 64, i; + for (i = 0; i < x; i++) + { + long v = y[i]; + *a++ = v; + } + register void **c __asm__ ("di"); + goto **c; +}