aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorClaudiu Zissulescu <claziss@synopsys.com>2017-11-02 11:20:18 +0100
committerClaudiu Zissulescu <claziss@gcc.gnu.org>2017-11-02 11:20:18 +0100
commit5b5905bb077f26ba6f4a3167817da888b736d623 (patch)
tree6c4860ad31f42bf04b31db047573a2697ecef415 /gcc/config
parent331b46738ccd56303d226aeedf3c9ed0c6b02175 (diff)
downloadgcc-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
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/arc/arc.c13
1 files changed, 11 insertions, 2 deletions
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)
{