xtensa: fix PR target/91880
authorMax Filippov <jcmvbkbc@gmail.com>
Thu, 26 Sep 2019 20:51:27 +0000 (20:51 +0000)
committerMax Filippov <jcmvbkbc@gcc.gnu.org>
Thu, 26 Sep 2019 20:51:27 +0000 (20:51 +0000)
commitd7326aaf20871a81feb39673d78922c1bc83efec
treef946f3aba697deed6752d518e37e3d3e810b5e03
parent25b45c7c6cea24f85d2f87c11c0e3c99ef20b655
xtensa: fix PR target/91880

Xtensa hwloop_optimize segfaults when zero overhead loop is about to be
inserted as the first instruction of the function.
Insert zero overhead loop instruction into new basic block before the
loop when basic block that precedes the loop is empty.

2019-09-26  Max Filippov  <jcmvbkbc@gmail.com>
gcc/
* config/xtensa/xtensa.c (hwloop_optimize): Insert zero overhead
loop instruction into new basic block before the loop when basic
block that precedes the loop is empty.

gcc/testsuite/
* gcc.target/xtensa/pr91880.c: New test case.
* gcc.target/xtensa/xtensa.exp: New test suite.

From-SVN: r276166
gcc/ChangeLog
gcc/config/xtensa/xtensa.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/xtensa/pr91880.c [new file with mode: 0644]
gcc/testsuite/gcc.target/xtensa/xtensa.exp [new file with mode: 0644]