From patchwork Tue Jan 31 13:49:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 721969 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vCSLm4N1vz9s65 for ; Wed, 1 Feb 2017 00:50:06 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="fXSFt7bq"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=qBMLsWG6A5cV4At9sohNDjflUIvUN2t8JqEGyK5ITZDDgrItO1 XZv2su/+RPq2PZVk9FL7JKLDxTCRdsD9qWS/ldBXST3WtFXIDd4+Vl32C57pCIDL ww16P4hfhDqBAZLkW59z36ULnuzdqNT9s/dxN73bkNA6ugO25zH51k8a8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=8ZQ1/1deQAnnKDq9VLeHcbHMh3s=; b=fXSFt7bqOIwZlRgaQna/ EU/ZZK9fNygPII+IlXMlGPLqVu0d3nTj/CHRF9Zij4pDnZkQNWZoROsO0ummxNkE LoNsZCm9POiD6kqTOHarJFDT8Zo5CGng2aLRz8c+ffqNbONgJOsZf1/59D+fG3cj X3T5wUlVshDNBlvg0k7rWME= Received: (qmail 67387 invoked by alias); 31 Jan 2017 13:49:52 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 67378 invoked by uid 89); 31 Jan 2017 13:49:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_PASS autolearn=no version=3.3.2 spammy=bail, loop_i, nb_iters, isl_space_copy X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 31 Jan 2017 13:49:42 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F1198AC53; Tue, 31 Jan 2017 13:49:39 +0000 (UTC) Date: Tue, 31 Jan 2017 14:49:39 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: grosser@fim.uni-passau.de, sebpop@gmail.com Subject: [PATCH] Fix PR71824 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The following fixes an ICE that happens because instantiate_scev doesn't really work as expected for SESE regions (a FIXME comment hints at this already). So instead of asserting all goes well just bail out (add_loop_constraints seems to add constraints not required for correctness?). Bootstrap & regtest in progress (though the patch can at most turn an ICE into wrong-code). This fixes build of 445.gobmk with -floop-nest-optimize. Ok? Thanks, Richard 2017-01-31 Richard Biener PR tree-optimization/71824 * graphite-sese-to-poly.c (add_loop_constraints): Bail out instead of asserting. * gcc.dg/graphite/pr71824.c: New testcase. Index: gcc/graphite-sese-to-poly.c =================================================================== --- gcc/graphite-sese-to-poly.c (revision 245058) +++ gcc/graphite-sese-to-poly.c (working copy) @@ -930,7 +931,11 @@ add_loop_constraints (scop_p scop, __isl /* loop_i <= expr_nb_iters */ gcc_assert (!chrec_contains_undetermined (nb_iters)); nb_iters = scalar_evolution_in_region (region, loop, nb_iters); - gcc_assert (!chrec_contains_undetermined (nb_iters)); + if (chrec_contains_undetermined (nb_iters)) + { + isl_space_free (space); + return domain; + } isl_pw_aff *aff_nb_iters = extract_affine (scop, nb_iters, isl_space_copy (space)); Index: gcc/testsuite/gcc.dg/graphite/pr71824.c =================================================================== --- gcc/testsuite/gcc.dg/graphite/pr71824.c (nonexistent) +++ gcc/testsuite/gcc.dg/graphite/pr71824.c (working copy) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-nest-optimize" } */ + +int a, b, d; +int **c; +int fn1() { + while (a) + if (d) { + int e = -d; + for (; b < e; b++) + c[b] = &a; + } else { + for (; b; b++) + c[b] = &b; + d = 0; + } +}