From: Jakub Jelinek Date: Fri, 24 Mar 2017 13:37:01 +0000 (+0100) Subject: re PR rtl-optimization/80112 (ICE in doloop_condition_get at loop-doloop.c:158) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=56010684160c394a1824909e2ac450a6da41db40;p=gcc.git re PR rtl-optimization/80112 (ICE in doloop_condition_get at loop-doloop.c:158) PR rtl-optimization/80112 * loop-doloop.c (doloop_condition_get): Don't check condition if cmp isn't SET with IF_THEN_ELSE src. * gcc.dg/pr80112.c: New test. From-SVN: r246441 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8d4adfbb07f..12525c64953 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-24 Jakub Jelinek + + PR rtl-optimization/80112 + * loop-doloop.c (doloop_condition_get): Don't check condition + if cmp isn't SET with IF_THEN_ELSE src. + 2017-03-24 Bill Schmidt PR tree-optimization/80158 diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c index 3b9a96034ab..3483000aa97 100644 --- a/gcc/loop-doloop.c +++ b/gcc/loop-doloop.c @@ -153,10 +153,13 @@ doloop_condition_get (rtx_insn *doloop_pat) } else inc = PATTERN (prev_insn); - /* We expect the condition to be of the form (reg != 0) */ - cond = XEXP (SET_SRC (cmp), 0); - if (GET_CODE (cond) != NE || XEXP (cond, 1) != const0_rtx) - return 0; + if (GET_CODE (cmp) == SET && GET_CODE (SET_SRC (cmp)) == IF_THEN_ELSE) + { + /* We expect the condition to be of the form (reg != 0) */ + cond = XEXP (SET_SRC (cmp), 0); + if (GET_CODE (cond) != NE || XEXP (cond, 1) != const0_rtx) + return 0; + } } else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5ab5619e8e1..a53ffefb6e3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-24 Jakub Jelinek + + PR rtl-optimization/80112 + * gcc.dg/pr80112.c: New test. + 2017-03-24 Rainer Orth * c-c++-common/Wimplicit-fallthrough-7.c: Adjust dg-warning diff --git a/gcc/testsuite/gcc.dg/pr80112.c b/gcc/testsuite/gcc.dg/pr80112.c new file mode 100644 index 00000000000..7c78aaedd98 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr80112.c @@ -0,0 +1,21 @@ +/* PR rtl-optimization/80112 */ +/* { dg-do compile } */ +/* { dg-options "-Os -fmodulo-sched" } */ + +void **a; + +void +foo (int c) +{ + void *d[] = {&&e, &&f}; + a = d; + switch (c) + { + f: + c = 9; + /* FALLTHRU */ + case 9: + goto *a++; + e:; + } +}