{"id":810295,"url":"http://patchwork.ozlabs.org/api/1.2/patches/810295/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20170905213646.GI2323@tucnak/","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":"<20170905213646.GI2323@tucnak>","list_archive_url":null,"date":"2017-09-05T21:36:46","name":"[committed] Fix OpenMP simd expansion ICE (PR middle-end/81768)","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"ae22ce4b94b9cafb1cb4e5b16932b9edb67ee9f9","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/1.2/people/671/?format=json","name":"Jakub Jelinek","email":"jakub@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20170905213646.GI2323@tucnak/mbox/","series":[{"id":1654,"url":"http://patchwork.ozlabs.org/api/1.2/series/1654/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=1654","date":"2017-09-05T21:36:46","name":"[committed] Fix OpenMP simd expansion ICE (PR middle-end/81768)","version":1,"mbox":"http://patchwork.ozlabs.org/series/1654/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810295/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810295/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461543-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-461543-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=\"dK5B0vA+\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jakub@redhat.com"],"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 3xn0RP18wdz9t2R\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  6 Sep 2017 07:37:04 +1000 (AEST)","(qmail 15914 invoked by alias); 5 Sep 2017 21:36:56 -0000","(qmail 14746 invoked by uid 89); 5 Sep 2017 21:36:55 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tTue, 05 Sep 2017 21:36:51 +0000","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.15])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id CB6FA3F74D\tfor\n\t<gcc-patches@gcc.gnu.org>; Tue,  5 Sep 2017 21:36:49 +0000 (UTC)","from tucnak.zalov.cz (ovpn-116-33.ams2.redhat.com\n\t[10.36.116.33])\tby smtp.corp.redhat.com (Postfix) with ESMTPS\n\tid 7510B5D6A3\tfor <gcc-patches@gcc.gnu.org>;\n\tTue,  5 Sep 2017 21:36:49 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\tby tucnak.zalov.cz\n\t(8.15.2/8.15.2) with ESMTP id v85LalFT002720\tfor\n\t<gcc-patches@gcc.gnu.org>; Tue, 5 Sep 2017 23:36:47 +0200","(from jakub@localhost)\tby tucnak.zalov.cz (8.15.2/8.15.2/Submit)\n\tid v85LakU0002719\tfor gcc-patches@gcc.gnu.org;\n\tTue, 5 Sep 2017 23:36:46 +0200"],"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:reply-to:mime-version:content-type;\n\tq=dns; s=default; b=ZLzYxQzZ2FRinagBORaPJz5calWiDo1YNaAnABzPmLT\n\ttKKiNtJrBeKoJBS2TLLeFwEWnf8n0k0xPItToCtDnP5OGh+4+szLS7sF8AzidZ30\n\tdD0xDTn7gIKOZ3ysOjJrOVsD37ovTYuGXoXjtg8LxoplmLJGDg6TSaDyp0KcHdl4\n\t=","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:reply-to:mime-version:content-type;\n\ts=default; bh=/+i2cr+lq4IdEFGtBkTni7exoo4=; b=dK5B0vA+hl5die8Ox\n\tseI7vC6QmfuLNuPQHHpidmvPsOF9Yd/lKqRxu2cunGnfct/awvpPRfzADeKQFzZR\n\tyZ3HCnK/YqusIO93om/arU/EjUlMskOOvllgrt5wiajY4ZZwbNBMnUSP1GnnosBH\n\t9Xw5rgqvsBj3yKJG1ns3R02SY8=","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=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com CB6FA3F74D","Date":"Tue, 5 Sep 2017 23:36:46 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"gcc-patches@gcc.gnu.org","Subject":"[committed] Fix OpenMP simd expansion ICE (PR middle-end/81768)","Message-ID":"<20170905213646.GI2323@tucnak>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","User-Agent":"Mutt/1.7.1 (2016-10-04)","X-IsSubscribed":"yes"},"content":"Hi!\n\nOn the following testcase when trying to gimplify a COND_EXPR that we expect\nto stay a COND_EXPR in GIMPLE, the gimplifier actually produces code with\nbranches and labels, which is of course invalid inside of a bb.  The reason\nfor that is that a former global VAR_DECL is being replaced through\nDECL_VALUE_EXPR with a target mapping thereof and so is considered as\npotentially trapping.  Fixed by pre-gimplifying the operand. \nBootstrapped/regtested on x86_64-linux and i686-linux, committed so far to\ntrunk.\n\n2017-09-05  Jakub Jelinek  <jakub@redhat.com>\n\n\tPR middle-end/81768\n\t* omp-expand.c (expand_omp_simd): Force second operands of COND_EXPR\n\tinto gimple val before gimplification fo the COND_EXPR.\n\n\t* gcc.dg/gomp/pr81768-1.c: New test.\n\n\n\tJakub","diff":"--- gcc/omp-expand.c.jj\t2017-09-01 09:26:27.000000000 +0200\n+++ gcc/omp-expand.c\t2017-09-05 13:13:49.303159003 +0200\n@@ -4730,24 +4730,28 @@ expand_omp_simd (struct omp_region *regi\n \t      tree itype2 = TREE_TYPE (fd->loops[i - 1].v);\n \t      if (POINTER_TYPE_P (itype2))\n \t\titype2 = signed_type_for (itype2);\n+\t      t = fold_convert (itype2, fd->loops[i - 1].step);\n+\t      t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true,\n+\t\t\t\t\t    GSI_SAME_STMT);\n \t      t = build3 (COND_EXPR, itype2,\n \t\t\t  build2 (fd->loops[i].cond_code, boolean_type_node,\n \t\t\t\t  fd->loops[i].v,\n \t\t\t\t  fold_convert (itype, fd->loops[i].n2)),\n-\t\t\t  build_int_cst (itype2, 0),\n-\t\t\t  fold_convert (itype2, fd->loops[i - 1].step));\n+\t\t\t  build_int_cst (itype2, 0), t);\n \t      if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i - 1].v)))\n \t\tt = fold_build_pointer_plus (fd->loops[i - 1].v, t);\n \t      else\n \t\tt = fold_build2 (PLUS_EXPR, itype2, fd->loops[i - 1].v, t);\n \t      expand_omp_build_assign (&gsi, fd->loops[i - 1].v, t);\n \n+\t      t = fold_convert (itype, fd->loops[i].n1);\n+\t      t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true,\n+\t\t\t\t\t    GSI_SAME_STMT);\n \t      t = build3 (COND_EXPR, itype,\n \t\t\t  build2 (fd->loops[i].cond_code, boolean_type_node,\n \t\t\t\t  fd->loops[i].v,\n \t\t\t\t  fold_convert (itype, fd->loops[i].n2)),\n-\t\t\t  fd->loops[i].v,\n-\t\t\t  fold_convert (itype, fd->loops[i].n1));\n+\t\t\t  fd->loops[i].v, t);\n \t      expand_omp_build_assign (&gsi, fd->loops[i].v, t);\n \t    }\n \t}\n--- gcc/testsuite/gcc.dg/gomp/pr81768-1.c.jj\t2017-09-05 13:59:57.821977911 +0200\n+++ gcc/testsuite/gcc.dg/gomp/pr81768-1.c\t2017-09-05 13:50:24.000000000 +0200\n@@ -0,0 +1,15 @@\n+/* PR middle-end/81768 */\n+/* { dg-do compile } */\n+\n+float b[10][15][10];\n+\n+void\n+foo (void)\n+{\n+  float *i;\n+#pragma omp target parallel for simd schedule(static, 32) collapse(3)\n+  for (i = &b[0][0][0]; i < &b[0][0][10]; i++)\n+    for (float *j = &b[0][15][0]; j > &b[0][0][0]; j -= 10)\n+      for (float *k = &b[0][0][10]; k > &b[0][0][0]; --k)\n+\tb[i - &b[0][0][0]][(j - &b[0][0][0]) / 10 - 1][(k - &b[0][0][0]) - 1] -= 3.5;\n+}\n","prefixes":["committed"]}