From patchwork Tue Aug 13 11:51:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 266778 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id A4E2E2C0128 for ; Tue, 13 Aug 2013 21:51:41 +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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=icrUAK+A6Q/fHt38R 3ie2iBW0+uNcBbXhNZqE6cvqgTbm9GrxB6GPtdX5GfA1IRLXDkrm96tamqAoH5CE 7dU/F8fylf9NnW0XyRibfPd7IXBucmwqv/N4gCp9eag0Xzard3pLEnMXty1RsZ77 Kyrk0Nmms27GEvDshjcm3Gqnhw= 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:references:mime-version :content-type:in-reply-to; s=default; bh=B67tCoEtq0JWWoydWqX9375 I3xo=; b=YKmYXCcmloOgDt2VajwNsovUXS5AfU/O/J3fx7zkr7s0rKjaCi9OGDB lwHUP1OCtuK0SchqYQS8+oEqFjREWPrx7HbfmSKpYuhszc/S1ZPaa82nUEpihgcA HiRw/SE4VmkX2F7IEIb99fOSHTzUaDIsYTOV26lmp3Fc1JR/sMhU= Received: (qmail 23617 invoked by alias); 13 Aug 2013 11:51:34 -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 23604 invoked by uid 89); 13 Aug 2013 11:51:34 -0000 X-Spam-SWARE-Status: No, score=-7.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 13 Aug 2013 11:51:33 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7DBpWkv013312 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 Aug 2013 07:51:32 -0400 Received: from redhat.com (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r7DBpRPj023491 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 13 Aug 2013 07:51:30 -0400 Date: Tue, 13 Aug 2013 13:51:27 +0200 From: Marek Polacek To: Jakub Jelinek Cc: Richard Biener , GCC Patches , Marc Glisse Subject: Re: [PATCH] Fix PR57980 Message-ID: <20130813115127.GO17022@redhat.com> References: <20130809143518.GH17022@redhat.com> <20130812085644.GK17022@redhat.com> <20130813102459.GE1814@tucnak.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130813102459.GE1814@tucnak.redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) On Tue, Aug 13, 2013 at 12:24:59PM +0200, Jakub Jelinek wrote: > On Mon, Aug 12, 2013 at 10:56:44AM +0200, Marek Polacek wrote: > > On Fri, Aug 09, 2013 at 08:40:00PM +0200, Richard Biener wrote: > > > Marek Polacek wrote: > > > >In this PR the problem was that when dealing with the gimple assign in > > > >the tailcall optimization, we, when the rhs operand is of a vector > > > >type, need to create -1 also of a vector type, but build_int_cst > > > >doesn't create vectors (ICEs). Instead, we should use > > > >build_minus_one_cst > > > >because that can create even the VECTOR_TYPE constant (and, it can > > > >create even REAL_TYPE/COMPLEX_TYPE), as suggested by Marc. > > > > > > > >Regtested/bootstrapped on x86_64-linux, ok for trunk and 4.8? > > > > > > Ok. Double-check that this function exists on the branch please. > > > > It does not :(. So not backporting to 4.8... > > For 4.8/4.7, I'd say just change those > else > *m = build_int_cst (TREE_TYPE (...), -1); > into > else if (INTEGRAL_TYPE_P (TREE_TYPE (...))) > *m = build_int_cst (TREE_TYPE (...), -1); > else > return false; Sure. Ok to apply this one if it passes regtesting? 2013-08-13 Marek Polacek Jakub Jelinek PR tree-optimization/57980 * tree-tailcall.c (process_assignment): Return false when not dealing with integers or floats. * gcc.dg/pr57980.c: New test. Marek --- gcc/tree-tailcall.c.mp 2013-08-13 13:42:33.969568463 +0200 +++ gcc/tree-tailcall.c 2013-08-13 13:44:57.288121663 +0200 @@ -328,8 +328,10 @@ process_assignment (gimple stmt, gimple_ case NEGATE_EXPR: if (FLOAT_TYPE_P (TREE_TYPE (op0))) *m = build_real (TREE_TYPE (op0), dconstm1); - else + else if (INTEGRAL_TYPE_P (TREE_TYPE (op0))) *m = build_int_cst (TREE_TYPE (op0), -1); + else + return false; *ass_var = dest; return true; @@ -341,8 +343,10 @@ process_assignment (gimple stmt, gimple_ { if (FLOAT_TYPE_P (TREE_TYPE (non_ass_var))) *m = build_real (TREE_TYPE (non_ass_var), dconstm1); - else + else if (INTEGRAL_TYPE_P (TREE_TYPE (non_ass_var))) *m = build_int_cst (TREE_TYPE (non_ass_var), -1); + else + return false; *a = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var), non_ass_var); } --- gcc/testsuite/gcc.dg/pr57980.c.mp 2013-08-13 13:41:55.216418468 +0200 +++ gcc/testsuite/gcc.dg/pr57980.c 2013-08-13 13:41:33.116333703 +0200 @@ -0,0 +1,19 @@ +/* PR tree-optimization/57980 */ +/* { dg-do compile } */ +/* { dg-options "-O -foptimize-sibling-calls -w" } */ + +typedef int V __attribute__ ((vector_size (2 * sizeof (int)))); +extern V f (void); + +V +bar (void) +{ + return -f (); +} + +V +foo (void) +{ + V v = { }; + return v - f (); +}