{"id":814918,"url":"http://patchwork.ozlabs.org/api/1.2/patches/814918/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/alpine.LSU.2.20.1709181520360.26836@zhemvz.fhfr.qr/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/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":"<alpine.LSU.2.20.1709181520360.26836@zhemvz.fhfr.qr>","list_archive_url":null,"date":"2017-09-18T13:22:13","name":"[GRAPHITE] Fix PR69728","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"b983620817f0751f2595ef8920816fb6cb8d3035","submitter":{"id":4338,"url":"http://patchwork.ozlabs.org/api/1.2/people/4338/?format=json","name":"Richard Biener","email":"rguenther@suse.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/alpine.LSU.2.20.1709181520360.26836@zhemvz.fhfr.qr/mbox/","series":[{"id":3644,"url":"http://patchwork.ozlabs.org/api/1.2/series/3644/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=3644","date":"2017-09-18T13:22:13","name":"[GRAPHITE] Fix PR69728","version":1,"mbox":"http://patchwork.ozlabs.org/series/3644/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814918/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814918/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-462399-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-462399-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=\"GK6gSZnC\"; 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 3xwmrh2Y1jz9s3w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 23:22:26 +1000 (AEST)","(qmail 27993 invoked by alias); 18 Sep 2017 13:22:18 -0000","(qmail 24847 invoked by uid 89); 18 Sep 2017 13:22:17 -0000","from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tMon, 18 Sep 2017 13:22:15 +0000","from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254])\tby\n\tmx1.suse.de (Postfix) with ESMTP id 50677AAB2\tfor\n\t<gcc-patches@gcc.gnu.org>; Mon, 18 Sep 2017 13:22:13 +0000 (UTC)"],"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:date\n\t:from:to:subject:message-id:mime-version:content-type; q=dns; s=\n\tdefault; b=ilvR7JuJXPm7QS+r6BG1KgwQqIb26CZpmKYwkDYUdAB/kZPnSZ77i\n\t1igTlwG6JX5OWos9qf7t2UBgAuxCOWvUTug1Lbpo+VOsS0eQLPhhODsW8o0hfAOH\n\tjKqJijRi8N1T8ukfT5iHTiR9KiE/m5542Uw5BpQPDMTtnBndXFC70Q=","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:date\n\t:from:to:subject:message-id:mime-version:content-type; s=\n\tdefault; bh=buvCsReFAYiB41cHLuml2BlxTRM=; b=GK6gSZnCIJKS/dbJ8nn6\n\tLJ/o0zvWheUI0Jg25joQKaC5CXuCtef6I3vxlOfv58lb0uV6sUuyx61r9f4sRVkv\n\tNZvkfMfpZ4l+pjXfulnxYquC4uHmIqmBstK+BMQyg4mN6RCQPeX8AEBcFKXiD4P/\n\tbPZeXcxd6rPQ+xOpdQBNAtg=","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=-16.1 required=5.0 tests=BAYES_00, GIT_PATCH_1,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mx1.suse.de","Date":"Mon, 18 Sep 2017 15:22:13 +0200 (CEST)","From":"Richard Biener <rguenther@suse.de>","To":"gcc-patches@gcc.gnu.org","Subject":"[PATCH][GRAPHITE] Fix PR69728","Message-ID":"<alpine.LSU.2.20.1709181520360.26836@zhemvz.fhfr.qr>","User-Agent":"Alpine 2.20 (LSU 67 2015-01-07)","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII"},"content":"The following fixes the (old) ICE in outer_projection_mupa we now run\ninto with SPEC CPU 2006 as well.  As I don't understand what the\ncode does or how it should behave when the scheduling domain is empty\nthe following simply adds a way to indicate failure when we'd\npreviously ICE.\n\nBootstrap and regtest running on x86_64-unknown-linux-gnu, will apply\nonce that finished.\n\nRichard.\n\n2017-09-18  Richard Biener  <rguenther@suse.de>\n\n\tPR tree-optimization/69728\n\t* graphite-sese-to-poly.c (schedule_error): New global.\n\t(add_loop_schedule): Handle empty domain by failing the\n\tschedule.\n\t(build_original_schedule): Handle schedule_error.\n\n\t* gfortran.dg/graphite/pr69728.f90: New testcase.\n\t* gcc.dg/graphite/pr69728.c: Likewise.","diff":"Index: gcc/graphite-sese-to-poly.c\n===================================================================\n--- gcc/graphite-sese-to-poly.c\t(revision 252920)\n+++ gcc/graphite-sese-to-poly.c\t(working copy)\n@@ -1030,6 +1035,8 @@ outer_projection_mupa (__isl_take isl_un\n   return isl_multi_union_pw_aff_from_union_pw_multi_aff (data.res);\n }\n \n+static bool schedule_error;\n+\n /* Embed SCHEDULE in the constraints of the LOOP domain.  */\n \n static isl_schedule *\n@@ -1043,6 +1050,14 @@ add_loop_schedule (__isl_take isl_schedu\n   if (empty < 0 || empty)\n     return empty < 0 ? isl_schedule_free (schedule) : schedule;\n \n+  isl_union_set *domain = isl_schedule_get_domain (schedule);\n+  if (isl_union_set_is_empty (domain))\n+    {\n+      schedule_error = true;\n+      isl_union_set_free (domain);\n+      return schedule;\n+    }\n+\n   isl_space *space = isl_set_get_space (iterators);\n   int loop_index = isl_space_dim (space, isl_dim_set) - 1;\n \n@@ -1063,7 +1078,6 @@ add_loop_schedule (__isl_take isl_schedu\n   prefix = isl_multi_aff_set_tuple_id (prefix, isl_dim_out, label);\n \n   int n = isl_multi_aff_dim (prefix, isl_dim_in);\n-  isl_union_set *domain = isl_schedule_get_domain (schedule);\n   isl_multi_union_pw_aff *mupa = outer_projection_mupa (domain, n);\n   mupa = isl_multi_union_pw_aff_apply_multi_aff (mupa, prefix);\n   return isl_schedule_insert_partial_schedule (schedule, mupa);\n@@ -1169,6 +1183,8 @@ build_schedule_loop_nest (scop_p scop, i\n static bool\n build_original_schedule (scop_p scop)\n {\n+  schedule_error = false;\n+\n   int i = 0;\n   int n = scop->pbbs.length ();\n   while (i < n)\n@@ -1183,6 +1199,14 @@ build_original_schedule (scop_p scop)\n       scop->original_schedule = add_in_sequence (scop->original_schedule, s);\n     }\n \n+  if (schedule_error)\n+    {\n+      if (dump_file)\n+\tfprintf (dump_file, \"[sese-to-poly] failed to build \"\n+\t\t \"original schedule\\n\");\n+      return false;\n+    }\n+\n   if (dump_file)\n     {\n       fprintf (dump_file, \"[sese-to-poly] original schedule:\\n\");\nIndex: gcc/testsuite/gfortran.dg/graphite/pr69728.f90\n===================================================================\n--- gcc/testsuite/gfortran.dg/graphite/pr69728.f90\t(nonexistent)\n+++ gcc/testsuite/gfortran.dg/graphite/pr69728.f90\t(working copy)\n@@ -0,0 +1,26 @@\n+! { dg-do compile }\n+! { dg-options \"-O3 -floop-nest-optimize\" }\n+SUBROUTINE rk_addtend_dry ( t_tend, t_tendf, t_save, rk_step, &\n+                            h_diabatic, mut, msft, ide, jde,  &\n+                            ims,ime, jms,jme, kms,kme,        &\n+                            its,ite, jts,jte, kts,kte)\n+   IMPLICIT NONE\n+   INTEGER ,  INTENT(IN   ) :: ide, jde, ims, ime, jms, jme, kms, kme, &\n+                               its, ite, jts, jte, kts, kte\n+   INTEGER ,  INTENT(IN   ) :: rk_step\n+   REAL , DIMENSION( ims:ime , kms:kme, jms:jme  ), &\n+       INTENT(INOUT) :: t_tend, t_tendf\n+   REAL , DIMENSION( ims:ime , kms:kme, jms:jme  ) , &\n+       INTENT(IN   ) ::  t_save, h_diabatic\n+   REAL , DIMENSION( ims:ime , jms:jme ) , INTENT(IN   ) :: mut, msft\n+   INTEGER :: i, j, k\n+   DO j = jts,MIN(jte,jde-1)\n+   DO k = kts,kte-1\n+   DO i = its,MIN(ite,ide-1)\n+     IF(rk_step == 1)t_tendf(i,k,j) = t_tendf(i,k,j) +  t_save(i,k,j)\n+      t_tend(i,k,j) =  t_tend(i,k,j) +  t_tendf(i,k,j)/msft(i,j)  &\n+                                     +  mut(i,j)*h_diabatic(i,k,j)/msft(i,j)\n+   ENDDO\n+   ENDDO\n+   ENDDO\n+END SUBROUTINE rk_addtend_dry\nIndex: gcc/testsuite/gcc.dg/graphite/pr69728.c\n===================================================================\n--- gcc/testsuite/gcc.dg/graphite/pr69728.c\t(nonexistent)\n+++ gcc/testsuite/gcc.dg/graphite/pr69728.c\t(working copy)\n@@ -0,0 +1,21 @@\n+/* { dg-do compile } */\n+/* { dg-options \"-O3 -floop-nest-optimize\" } */\n+\n+int a[1];\n+int b, c, d, e;\n+void\n+fn1 ()\n+{\n+  d = 9;\n+  for (; c; c++)\n+    {\n+      ++d;\n+      b = 8;\n+      for (; b; b--)\n+\t{\n+\t  if (d)\n+\t    break;\n+\t  a[b] = e;\n+\t}\n+    }\n+}\n","prefixes":["GRAPHITE"]}