From patchwork Wed Oct 7 17:47:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 527390 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 D5967140D71 for ; Thu, 8 Oct 2015 04:47:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ksE1ufBu; 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 :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=WpsTQBZfc6YId009HPa9NO0SeBBiM92yC0KcpqOxX8mLix bK50wyzCMXWwbaXGQvbHslchaOp5eOD7KCk8KpHkSWRzvKt+QISA/YjZrheqJ2Gv 6I9VF4BOpnVg5VYRyex5D2PVK2UQhsIo4ZCl1XFlmjzSnGWrTlHxH7/mvvGWI= 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:date:message-id:subject:from:to:content-type; s= default; bh=wJrF++OqQNrrfBWQ94hPrBH31V4=; b=ksE1ufBu7doueT+HyA2M 0fSrC152t7rr/sIn/hZ63Oejs47lbVMJhzAMsAgPYBUZC9cQTmPLUd5F4IEwprJG mOVw3jzAaB9twMESRwPF902jHhD6fDkMZ0/UX50EfpA/208EDY+69Ay/2/u/2JQY dIVL6h/UW2pjFEMzWZMpIzY= Received: (qmail 45607 invoked by alias); 7 Oct 2015 17:47:51 -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 45592 invoked by uid 89); 7 Oct 2015 17:47:51 -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, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-io0-f177.google.com Received: from mail-io0-f177.google.com (HELO mail-io0-f177.google.com) (209.85.223.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 07 Oct 2015 17:47:50 +0000 Received: by ioiz6 with SMTP id z6so30869736ioi.2 for ; Wed, 07 Oct 2015 10:47:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=F2TPLz4GXy44kajZVw682pcrRs78iihoxqf3K3NXtSg=; b=fRHzvOkFFq61F8+Gve/PnozsiucraA55Y/fgolDuVE9N1B0xistV6CI+Zt7GEiDkEv wC6tP587lP8sNQzI/03aXPbNjIqtjlaDKYchrbhApIGNI9MtFzfwLSd2Jn5dYTqQZuAh tfTUcR+u/eYGYGTj6LxREqFiMCFVw914R5rHnnGwwDOSy8pmktq7UVrELwP9F8Ru0iGs j6w7UShsnhivu05yIhm3DHxrNVePvnjBJxWqpXIJK0SyfzwE7+SovRPe0Ypn+RX9q5M/ ZRDvORehWmWy+mDu/ConptcmfLpi0B4WCff/vk0Xv9ipNKsyBledRz9f6atTl7n5zMAy N8pw== X-Gm-Message-State: ALoCoQk/0UMzb+s9GaHQcfsJH3q2XU8XwwEdUTmmkm1sQxsgG3pqgONlq0sifciEavJsc2lbw4F5 MIME-Version: 1.0 X-Received: by 10.107.10.11 with SMTP id u11mr3744840ioi.36.1444240067966; Wed, 07 Oct 2015 10:47:47 -0700 (PDT) Received: by 10.79.81.134 with HTTP; Wed, 7 Oct 2015 10:47:47 -0700 (PDT) Date: Wed, 7 Oct 2015 10:47:47 -0700 Message-ID: Subject: Go patch committed: Don't make temporaries for constant operands From: Ian Lance Taylor To: gcc-patches , "gofrontend-dev@googlegroups.com" This patch by Chris Manghane changes the Go frontend to not make temporaries for constant operands in binary expressions. This fixes https://golang.org/issue/12616 . Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 228576) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -651e71a729e5dcbd9dc14c1b59b6eff05bfe3d26 +a4bcd319d98ddc52b3e7d16ec87d92aad868ab05 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/expressions.cc =================================================================== --- gcc/go/gofrontend/expressions.cc (revision 228306) +++ gcc/go/gofrontend/expressions.cc (working copy) @@ -5200,13 +5200,13 @@ Binary_expression::do_flatten(Gogo* gogo || (is_idiv_op && (gogo->check_divide_by_zero() || gogo->check_divide_overflow()))) { - if (!this->left_->is_variable()) + if (!this->left_->is_variable() && !this->left_->is_constant()) { temp = Statement::make_temporary(NULL, this->left_, loc); inserter->insert(temp); this->left_ = Expression::make_temporary_reference(temp, loc); } - if (!this->right_->is_variable()) + if (!this->right_->is_variable() && !this->right_->is_constant()) { temp = Statement::make_temporary(NULL, this->right_, loc);