public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com>
To: <gcc-patches@gcc.gnu.org>
Cc: <Claudiu.Zissulescu@synopsys.com>,	<Francois.Bedard@synopsys.com>,
	<andrew.burgess@embecosm.com>
Subject: [PATCH] [ARC][ZOL] Account for empty body loops
Date: Fri, 01 Sep 2017 12:36:00 -0000	[thread overview]
Message-ID: <1504269130-29760-1-git-send-email-claziss@synopsys.com> (raw)
In-Reply-To: <20170831190757.GO22260@embecosm.com>

From: claziss <claziss@synopsys.com>

Hi Andrew,

By mistake I've pushed an incoplete ZOL-rework patch, and it missing the attached parts. Please can you check if it is ok?

Thank you,
Claudiu

gcc/
2017-09-01  Claudiu Zissulescu <claziss@synopsys.com>

	    * config/arc/arc.c (hwloop_optimize): Account for empty
	    body loops.

testsuite/
2017-09-01  Claudiu Zissulescu <claziss@synopsys.com>

 	        * gcc.target/arc/loop-1.c: Add test.
---
 gcc/config/arc/arc.c                  | 13 +++++++++++--
 gcc/testsuite/gcc.target/arc/loop-1.c | 12 ++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100755 gcc/testsuite/gcc.target/arc/loop-1.c

diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 52a9b24..d519063 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -7240,6 +7240,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))
@@ -7311,8 +7317,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/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];
+  }
+}
-- 
1.9.1

  parent reply	other threads:[~2017-09-01 12:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24  8:46 [PATCH 0/7] [ARC] SDATA and ZOL updates Claudiu Zissulescu
2017-07-24  8:46 ` [PATCH 2/7] [ARC] Use -G option to control sdata behavior Claudiu Zissulescu
2017-08-15 13:43   ` Andrew Burgess
2017-08-15 16:26     ` Sandra Loosemore
2017-08-31 16:04     ` Claudiu Zissulescu
2017-07-24  8:46 ` [PATCH 4/7] [ARC] Use TARGET_USE_ANCHORS_FOR_SYMBOL_P Claudiu Zissulescu
2017-08-31 19:13   ` Andrew Burgess
2017-09-01 11:51     ` Claudiu Zissulescu
2017-07-24  8:46 ` [PATCH 1/7] [ARC] Improves and fixes for small data support Claudiu Zissulescu
2017-08-15 13:36   ` Andrew Burgess
2017-08-31 14:37     ` Claudiu Zissulescu
2017-07-24  8:46 ` [PATCH 7/7] [ARC] Fix errors in arc_ifcvt Claudiu Zissulescu
2017-08-31 20:08   ` Andrew Burgess
2017-09-01 11:50     ` Claudiu Zissulescu
2017-07-24  8:46 ` [PATCH 6/7] [ARC] Reimplement ZOL support Claudiu Zissulescu
2017-07-24 22:22   ` Sandra Loosemore
2017-08-31 20:23   ` Andrew Burgess
2017-09-01 11:49     ` Claudiu Zissulescu
2017-09-01 12:36     ` Claudiu Zissulescu [this message]
2017-09-26 18:56       ` [PATCH] [ARC][ZOL] Account for empty body loops Andrew Burgess
2017-11-02 10:22         ` Claudiu Zissulescu
2017-07-24  8:46 ` [PATCH 5/7] [ARC] Update various patterns Claudiu Zissulescu
2017-08-31 19:33   ` Andrew Burgess
2017-09-01 11:50     ` Claudiu Zissulescu
2017-07-24  8:46 ` [PATCH 3/7] [ARC] Update can_follow_jump hook helper Claudiu Zissulescu
2017-08-15 13:56   ` Andrew Burgess
2017-08-31 16:38     ` Claudiu Zissulescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1504269130-29760-1-git-send-email-claziss@synopsys.com \
    --to=claudiu.zissulescu@synopsys.com \
    --cc=Francois.Bedard@synopsys.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).