From patchwork Thu Jul 24 10:09:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gareev X-Patchwork-Id: 373357 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 E76A51401EC for ; Thu, 24 Jul 2014 20:09:43 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=UjURq+GQ+wjfpGKGlV Lrr1E3xKrl3pVNVnlclv6s6WKgc24oveqnbRkowVoSNMu8AkXM759cAcOo9A1KqS K1LllFm4poHe77LJQXMT7x9UH5oJ649iDWzKFQTB5zanGUhmitDPFRLhXA7w8Odx 9ipNm0HGYNB4JPBigPqG+NUek= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=MBHFqIbiDOc7JPpXfJOAAZx8 LiE=; b=ohvgbiMzmLL2MqIa2gwjjtFOjAgis3CIEu5P0IVEKD7VFLpaV6Pa+01n SGuWhp365fTJcatQYn8mwy/QPjEETP4FKDx1Rp+yyQ2r9P1Ud6CtuGjn3fvy4lYQ I2p8w+XDPlQIx1fjRtk15JQDeGd983PDkg/S3PTPriWGzJTtzf0= Received: (qmail 22436 invoked by alias); 24 Jul 2014 10:09:30 -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 22355 invoked by uid 89); 24 Jul 2014 10:09:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f170.google.com Received: from mail-yk0-f170.google.com (HELO mail-yk0-f170.google.com) (209.85.160.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 24 Jul 2014 10:09:27 +0000 Received: by mail-yk0-f170.google.com with SMTP id 9so1658894ykp.29 for ; Thu, 24 Jul 2014 03:09:25 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.236.97.101 with SMTP id s65mr11380942yhf.51.1406196565547; Thu, 24 Jul 2014 03:09:25 -0700 (PDT) Received: by 10.170.91.134 with HTTP; Thu, 24 Jul 2014 03:09:25 -0700 (PDT) In-Reply-To: <53CFD573.5040207@grosser.es> References: <53CFD573.5040207@grosser.es> Date: Thu, 24 Jul 2014 16:09:25 +0600 Message-ID: Subject: Re: [GSoC] A bug related to induction variables and blocks From: Roman Gareev To: Tobias Grosser Cc: Mircea Namolaru , gcc-patches@gcc.gnu.org > Is there a reason you have those global values? To my understanding they > could possibly just be function parameters? Yes, it would be fine for this test case. I've implemented this in the improved version. --- Cheers, Roman Gareev. 2014-07-23 Roman Gareev [gcc/] * graphite-isl-ast-to-gimple.c: (graphite_create_new_loop): Add calling of isl_id_free to properly decrement reference counts. [gcc/testsuite] * gcc.dg/graphite/isl-ast-gen-blocks-4.c: New testcase. Index: gcc/graphite-isl-ast-to-gimple.c =================================================================== --- gcc/graphite-isl-ast-to-gimple.c (revision 212922) +++ gcc/graphite-isl-ast-to-gimple.c (working copy) @@ -383,6 +383,10 @@ isl_ast_expr *for_iterator = isl_ast_node_for_get_iterator (node_for); isl_id *id = isl_ast_expr_get_id (for_iterator); + std::map::iterator res; + res = ip.find (id); + if (ip.count (id)) + isl_id_free (res->first); ip[id] = iv; isl_ast_expr_free (for_iterator); return loop; Index: gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-4.c =================================================================== --- gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-4.c (revision 0) +++ gcc/testsuite/gcc.dg/graphite/isl-ast-gen-blocks-4.c (working copy) @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fgraphite-identity -fgraphite-code-generator=isl" } */ + +static int __attribute__((noinline)) +foo (int k, int n1, int n2, int n3) +{ + int j, res = 0; + for (j = 0; j < k; j++) + { + int i; + for (i = 0; i < n1; i++) + res += i; + for (i = 0; i < n2; i++) + res += i; + for (i = 0; i < n3; i++) + res += i; + } + + return res; +} + +extern void abort (); + +int +main (void) +{ + int res = foo (4, 50, 50, 50); + if (res != 14700) + abort (); + + return 0; +}