From patchwork Thu Aug 4 00:10:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 655643 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 3s4Vhw1Hm9z9sxb for ; Thu, 4 Aug 2016 10:11:10 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=atB1Ea4x; 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:from:date:message-id:subject:to:content-type; q= dns; s=default; b=gIE2MQcAfue4dDuaasFfFyl2thgkb7Xj0GNW8hj0DPDbu0 gQl4yc8oLu42kzxkjitlMO5SjCUvzTznCbB4BF8T+xJ3T8yW9AjcOMJ1b5aBcpnA F8Do6XOYu/hbUdvG2COCqBfebP97gvAvM1pFYGov40f8ei1R/wRjTQtiGmZq4= 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:from:date:message-id:subject:to:content-type; s= default; bh=O+1+RqxULRqwSaArvY9bFMvMErw=; b=atB1Ea4xBsg6y1enBVd/ Ms/81KASYQBM2uxYadu+WR2bu2s/Gev1c1r3LeH7hZ91IXcq6RkF6A5A0hN/4Ppx oRRsg8SruV88owKGr6HfUxzdKx3oGwU01f8rFp2w3D59oVcuCzR9ACdBjYqCVHRp zpySql0VPaAr7V/IaNmzHrk= Received: (qmail 11294 invoked by alias); 4 Aug 2016 00:11:03 -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 11261 invoked by uid 89); 4 Aug 2016 00:10:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=AWL, BAYES_50, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=MERGE, gofrontend, gogo, Manghane X-HELO: mail-it0-f41.google.com Received: from mail-it0-f41.google.com (HELO mail-it0-f41.google.com) (209.85.214.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 04 Aug 2016 00:10:45 +0000 Received: by mail-it0-f41.google.com with SMTP id j124so249667894ith.1 for ; Wed, 03 Aug 2016 17:10:45 -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:from:date:message-id:subject:to; bh=b6Gn/k+3cgUUbaLKzQXj4fmryuIoXS2H4BvP6tjRf0I=; b=DeMynrH8jqGKfblciPxdJvNQUKJIqDwGBSTeuOZvsINae2O/oRVWZz1sEcx1z7Ain4 Urycmmg6wlQ9y3RY5A9Mn6HtlkfNAtXOsahI19Lww6/UZjcirVjxvH0Sr6fMbySK9rnm zuOGzpEhHzRzO7iPEDdbJwkWvLGxUx7Uc7erQ3OBY80lCu4DPbhlZOnIG1HFQx/5vgFL 76v1HhgM1dLOlV8Qkk3+4Q8+pZbS3xN4AUesNvLAJLxDXdoL7m5kX0GmPYEjGjyCcmyT q+zYyUPMkct6bKdaL4/44BMznrG94/ZeRtpp7XI4JEwYqRuzeY5Y6cHE7sq6Z8N+sI+M nU9A== X-Gm-Message-State: AEkoout61O/TpqCuc0MkJqqeXvlYrI+y7v1g/6oYZ0S0uRzQ3rjEJ2nsSJgNwdbJUIZ71y8imZJmqdjYLKKW0w== X-Received: by 10.36.66.2 with SMTP id i2mr26209575itb.53.1470269439230; Wed, 03 Aug 2016 17:10:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.82.195 with HTTP; Wed, 3 Aug 2016 17:10:38 -0700 (PDT) From: Ian Lance Taylor Date: Wed, 3 Aug 2016 17:10:38 -0700 Message-ID: Subject: Go patch committed: add -fgo-optimize-allocs option To: gcc-patches , "gofrontend-dev@googlegroups.com" This patch to the Go frontend, by Chris Manghane, adds the -fgo-optimize-allocs option. This turns on escape analysis. However, escape analysis is still not turned on by default. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 239100) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -3096ac81185edacbf800783f0f803d1c419dccdd +4ba387176e8a826dd5dd6cad4caa2f93434d0b14 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/escape.cc =================================================================== --- gcc/go/gofrontend/escape.cc (revision 239002) +++ gcc/go/gofrontend/escape.cc (working copy) @@ -14,6 +14,7 @@ #include "statements.h" #include "escape.h" #include "ast-dump.h" +#include "go-optimize.h" // class Node. @@ -678,11 +679,19 @@ Escape_note::parse_tag(std::string* tag) return encoding; } + +// The -fgo-optimize-alloc flag activates this escape analysis. + +Go_optimize optimize_allocation_flag("allocs"); + // Analyze the program flow for escape information. void Gogo::analyze_escape() { + if (!optimize_allocation_flag.is_enabled() || saw_errors()) + return; + // Discover strongly connected groups of functions to analyze for escape // information in this package. this->discover_analysis_sets(); Index: gcc/go/gofrontend/go.cc =================================================================== --- gcc/go/gofrontend/go.cc (revision 239002) +++ gcc/go/gofrontend/go.cc (working copy) @@ -112,6 +112,8 @@ go_parse_input_files(const char** filena if (only_check_syntax) return; + ::gogo->analyze_escape(); + // Export global identifiers as appropriate. ::gogo->do_exports();