diff options
author | Claudiu Zissulescu <claziss@synopsys.com> | 2017-11-02 11:20:18 +0100 |
---|---|---|
committer | Claudiu Zissulescu <claziss@gcc.gnu.org> | 2017-11-02 11:20:18 +0100 |
commit | 5b5905bb077f26ba6f4a3167817da888b736d623 (patch) | |
tree | 6c4860ad31f42bf04b31db047573a2697ecef415 | |
parent | 331b46738ccd56303d226aeedf3c9ed0c6b02175 (diff) | |
download | gcc-5b5905bb077f26ba6f4a3167817da888b736d623.zip gcc-5b5905bb077f26ba6f4a3167817da888b736d623.tar.gz gcc-5b5905bb077f26ba6f4a3167817da888b736d623.tar.bz2 |
[ARC][ZOL] Account for empty body loops
gcc/
2017-11-02 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.c (hwloop_optimize): Account for empty
body loops.
testsuite/
2017-11-02 Claudiu Zissulescu <claziss@synopsys.com>
* gcc.target/arc/loop-1.c: Add test.
From-SVN: r254339
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/arc/arc.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rwxr-xr-x | gcc/testsuite/gcc.target/arc/loop-1.c | 12 |
4 files changed, 32 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc871f8..d80fa53 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-11-02 Claudiu Zissulescu <claziss@synopsys.com> + + * config/arc/arc.c (hwloop_optimize): Account for empty + body loops. + 2017-11-02 Richard Biener <rguenther@suse.de> PR middle-end/82765 diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index a0b66758..7336fad 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -7183,6 +7183,12 @@ hwloop_optimize (hwloop_info loop) fprintf (dump_file, ";; loop %d too long\n", loop->loop_no); return false; } + else if (!loop->length) + { + if (dump_file) + fprintf (dump_file, ";; loop %d is empty\n", loop->loop_no); + return false; + } /* Check if we use a register or not. */ if (!REG_P (loop->iter_reg)) @@ -7254,8 +7260,11 @@ hwloop_optimize (hwloop_info loop) && INSN_P (last_insn) && (JUMP_P (last_insn) || CALL_P (last_insn) || GET_CODE (PATTERN (last_insn)) == SEQUENCE - || get_attr_type (last_insn) == TYPE_BRCC - || get_attr_type (last_insn) == TYPE_BRCC_NO_DELAY_SLOT)) + /* At this stage we can have (insn (clobber (mem:BLK + (reg)))) instructions, ignore them. */ + || (GET_CODE (PATTERN (last_insn)) != CLOBBER + && (get_attr_type (last_insn) == TYPE_BRCC + || get_attr_type (last_insn) == TYPE_BRCC_NO_DELAY_SLOT)))) { if (loop->length + 2 > ARC_MAX_LOOP_LENGTH) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c951510..a8bb8ca 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-11-02 Claudiu Zissulescu <claziss@synopsys.com> + + * gcc.target/arc/loop-1.c: Add test. + 2017-11-02 Tom de Vries <tom@codesourcery.com> PR testsuite/82415 diff --git a/gcc/testsuite/gcc.target/arc/loop-1.c b/gcc/testsuite/gcc.target/arc/loop-1.c new file mode 100755 index 0000000..274bb46 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/loop-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +/* Check how we handle empty body loops. */ + +int a; +void fn1(void) { + int i; + for (; i < 8; i++) { + double A[a]; + } +} |