{"id":808670,"url":"http://patchwork.ozlabs.org/api/patches/808670/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/1504269130-29760-1-git-send-email-claziss@synopsys.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504269130-29760-1-git-send-email-claziss@synopsys.com>","list_archive_url":null,"date":"2017-09-01T12:32:10","name":"[ARC,ZOL] Account for empty body loops","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"7ea58f0b036c3958921406f6c1a7614023c59a51","submitter":{"id":67086,"url":"http://patchwork.ozlabs.org/api/people/67086/?format=json","name":"Claudiu Zissulescu","email":"Claudiu.Zissulescu@synopsys.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/1504269130-29760-1-git-send-email-claziss@synopsys.com/mbox/","series":[{"id":1015,"url":"http://patchwork.ozlabs.org/api/series/1015/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=1015","date":"2017-09-01T12:32:10","name":"[ARC,ZOL] Account for empty body loops","version":1,"mbox":"http://patchwork.ozlabs.org/series/1015/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808670/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808670/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461279-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461279-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"oRyvktPS\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkJdG6wkCz9s7c\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 22:36:18 +1000 (AEST)","(qmail 10426 invoked by alias); 1 Sep 2017 12:36:12 -0000","(qmail 10417 invoked by uid 89); 1 Sep 2017 12:36:11 -0000","from us01smtprelay-2.synopsys.com (HELO smtprelay.synopsys.com)\n\t(198.182.47.9) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 01 Sep 2017 12:36:10 +0000","from mailhost.synopsys.com (mailhost2.synopsys.com\n\t[10.13.184.66])\tby smtprelay.synopsys.com (Postfix) with\n\tESMTP id F07CD24E171D; Fri,  1 Sep 2017 05:36:08 -0700 (PDT)","from mailhost.synopsys.com (localhost [127.0.0.1])\tby\n\tmailhost.synopsys.com (Postfix) with ESMTP id D9E6964E;\n\tFri,  1 Sep 2017 05:36:08 -0700 (PDT)","from us01wehtc1.internal.synopsys.com\n\t(us01wehtc1.internal.synopsys.com [10.12.239.235])\tby\n\tmailhost.synopsys.com (Postfix) with ESMTP id A5652609;\n\tFri,  1 Sep 2017 05:36:04 -0700 (PDT)","from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by\n\tus01wehtc1.internal.synopsys.com (10.12.239.231) with\n\tMicrosoft SMTP Server (TLS) id 14.3.266.1;\n\tFri, 1 Sep 2017 05:35:44 -0700","from IN01WEHTCA.internal.synopsys.com (10.144.199.104) by\n\tIN01WEHTCB.internal.synopsys.com (10.144.199.105) with\n\tMicrosoft SMTP Server (TLS) id 14.3.266.1;\n\tFri, 1 Sep 2017 18:05:41 +0530","from nl20droid1.internal.synopsys.com (10.100.24.228) by\n\tIN01WEHTCA.internal.synopsys.com (10.144.199.243) with\n\tMicrosoft SMTP Server (TLS) id 14.3.266.1;\n\tFri, 1 Sep 2017 18:05:40 +0530"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-type; q=dns; s=default; b=ITabox+CWObgSZb7\n\tVqzqBuZ1fvHHWsJ1iPS38Xvs/YGLNqCeu86EGhZDtj/m276g8NCHHpqIuC80LLZH\n\tGrtUUxxyIxdfNvuCcw5m+GucWd7t5WfcIkk7i7CADCJpxxxl2zppnwUp3y0kHplO\n\tmIy6n7TDjalmd9aIM+Ayv5yti+g=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:from\n\t:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-type; s=default; bh=UFTjMF7coq/32of2nCTXPd\n\tkXIrg=; b=oRyvktPS/aYUGc2OOhduQh6tVLmKWXJMwNorUgnXmeHIDoIzGXchPg\n\tRyuUwMLEtoPrlOy2odzAzVCh+Vc/tCp+6t8ApNzPkItDDbnsAmFDQGoB8j4idHnI\n\t/JTg/KQJ11rwqg24A1ocGbSdNqFiTZt75sPYOI9wcJ1vJjdvyJAKs=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-23.9 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3,\n\tKAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE,\n\tRP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*F:D*synopsys.com,\n\tH*r:10.100.24","X-HELO":"smtprelay.synopsys.com","From":"Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com>","To":"<gcc-patches@gcc.gnu.org>","CC":"<Claudiu.Zissulescu@synopsys.com>, <Francois.Bedard@synopsys.com>,\n\t<andrew.burgess@embecosm.com>","Subject":"[PATCH] [ARC][ZOL] Account for empty body loops","Date":"Fri, 1 Sep 2017 14:32:10 +0200","Message-ID":"<1504269130-29760-1-git-send-email-claziss@synopsys.com>","In-Reply-To":"<20170831190757.GO22260@embecosm.com>","References":"<20170831190757.GO22260@embecosm.com>","MIME-Version":"1.0","Content-Type":"text/plain"},"content":"From: claziss <claziss@synopsys.com>\n\nHi Andrew,\n\nBy mistake I've pushed an incoplete ZOL-rework patch, and it missing the attached parts. Please can you check if it is ok?\n\nThank you,\nClaudiu\n\ngcc/\n2017-09-01  Claudiu Zissulescu <claziss@synopsys.com>\n\n\t    * config/arc/arc.c (hwloop_optimize): Account for empty\n\t    body loops.\n\ntestsuite/\n2017-09-01  Claudiu Zissulescu <claziss@synopsys.com>\n\n \t        * gcc.target/arc/loop-1.c: Add test.\n---\n gcc/config/arc/arc.c                  | 13 +++++++++++--\n gcc/testsuite/gcc.target/arc/loop-1.c | 12 ++++++++++++\n 2 files changed, 23 insertions(+), 2 deletions(-)\n create mode 100755 gcc/testsuite/gcc.target/arc/loop-1.c","diff":"diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c\nindex 52a9b24..d519063 100644\n--- a/gcc/config/arc/arc.c\n+++ b/gcc/config/arc/arc.c\n@@ -7240,6 +7240,12 @@ hwloop_optimize (hwloop_info loop)\n \tfprintf (dump_file, \";; loop %d too long\\n\", loop->loop_no);\n       return false;\n     }\n+  else if (!loop->length)\n+    {\n+      if (dump_file)\n+\tfprintf (dump_file, \";; loop %d is empty\\n\", loop->loop_no);\n+      return false;\n+    }\n \n   /* Check if we use a register or not.  */\n   if (!REG_P (loop->iter_reg))\n@@ -7311,8 +7317,11 @@ hwloop_optimize (hwloop_info loop)\n       && INSN_P (last_insn)\n       && (JUMP_P (last_insn) || CALL_P (last_insn)\n \t  || GET_CODE (PATTERN (last_insn)) == SEQUENCE\n-\t  || get_attr_type (last_insn) == TYPE_BRCC\n-\t  || get_attr_type (last_insn) == TYPE_BRCC_NO_DELAY_SLOT))\n+\t  /* At this stage we can have (insn (clobber (mem:BLK\n+\t     (reg)))) instructions, ignore them.  */\n+\t  || (GET_CODE (PATTERN (last_insn)) != CLOBBER\n+\t      && (get_attr_type (last_insn) == TYPE_BRCC\n+\t\t  || get_attr_type (last_insn) == TYPE_BRCC_NO_DELAY_SLOT))))\n     {\n       if (loop->length + 2 > ARC_MAX_LOOP_LENGTH)\n \t{\ndiff --git a/gcc/testsuite/gcc.target/arc/loop-1.c b/gcc/testsuite/gcc.target/arc/loop-1.c\nnew file mode 100755\nindex 0000000..274bb46\n--- /dev/null\n+++ b/gcc/testsuite/gcc.target/arc/loop-1.c\n@@ -0,0 +1,12 @@\n+/* { dg-do compile } */\n+/* { dg-options \"-O2\" } */\n+\n+/* Check how we handle empty body loops.  */\n+\n+int a;\n+void fn1(void) {\n+  int i;\n+  for (; i < 8; i++) {\n+    double A[a];\n+  }\n+}\n","prefixes":["ARC","ZOL"]}