From patchwork Thu Apr 21 14:25:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 613132 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 3qrLf13rlCz9t3c for ; Fri, 22 Apr 2016 00:26:17 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=SgcX4LY7; 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:subject:message-id:mime-version:content-type; q=dns; s= default; b=SfCQVATTI8Zr72MQ7Y8KcRum87HKsLxzwsonO+4hCUMGhy5VzFlMi bMfZpv7XAnNtWC30E4wD6FIlfqa78jC/nTMsElmspsUdvjei40+rdPDOYkfYSpa+ Q95dtV52PfycyM5JOOLNusSoLZwRGaZTaQnyp5Wci/N6RJnF0210Hk= 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:subject:message-id:mime-version:content-type; s= default; bh=u6ldTXvuHjFv/lR6GMvn/JqTvaE=; b=SgcX4LY7Sc7cmiS45OGx uuALEbb0dN9CF1mVVSuKAkH7MqdEMnlUla2KMwCk7OoNc+3BNFFjDdlpKLgPhtRW a1doF/H0xpqTeA8/93vPIk58bf8DNAoEWhvOC/b2C3qFi0xi3iiybN0qXgvfCfgk r78bEn/t9TwwNKoTKXdj6Ic= Received: (qmail 128576 invoked by alias); 21 Apr 2016 14:26:08 -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 128546 invoked by uid 89); 21 Apr 2016 14:26:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1960 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 (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 21 Apr 2016 14:25:57 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B4CBDAB9D for ; Thu, 21 Apr 2016 14:25:50 +0000 (UTC) Date: Thu, 21 Apr 2016 16:25:52 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Avoid allocating garbage GIMPLE_NOPs at LTO stream in time Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 The following avoids allocating a GIMPLE_NOP as a def for all SSA names (we stream stmts and adjust SSA_NAME_DEF_STMT later). This requires us to make sure we do not have unused SSA names around which we can easily achieve at stream-out time - otherwise passes walking over all SSA names rightfully expect a def stmt for all of them. LTO bootstrap / regtest running on x86_64-unknown-linux-gnu. Richard. 2016-04-21 Richard Biener * lto-streamer-in.c (input_ssa_names): Do not allocate GIMPLE_NOP for all SSA names. * lto-streamer-out.c (output_ssa_names): Do not output SSA names that should have been released. Index: gcc/lto-streamer-in.c =================================================================== --- gcc/lto-streamer-in.c (revision 235305) +++ gcc/lto-streamer-in.c (working copy) @@ -881,10 +881,13 @@ input_ssa_names (struct lto_input_block is_default_def = (streamer_read_uchar (ib) != 0); name = stream_read_tree (ib, data_in); - ssa_name = make_ssa_name_fn (fn, name, gimple_build_nop ()); + ssa_name = make_ssa_name_fn (fn, name, NULL); if (is_default_def) - set_ssa_default_def (cfun, SSA_NAME_VAR (ssa_name), ssa_name); + { + set_ssa_default_def (cfun, SSA_NAME_VAR (ssa_name), ssa_name); + SSA_NAME_DEF_STMT (ssa_name) = gimple_build_nop (); + } i = streamer_read_uhwi (ib); } Index: gcc/lto-streamer-out.c =================================================================== --- gcc/lto-streamer-out.c (revision 235305) +++ gcc/lto-streamer-out.c (working copy) @@ -1816,7 +1816,11 @@ output_ssa_names (struct output_block *o if (ptr == NULL_TREE || SSA_NAME_IN_FREE_LIST (ptr) - || virtual_operand_p (ptr)) + || virtual_operand_p (ptr) + /* Simply skip unreleased SSA names. */ + || (! SSA_NAME_IS_DEFAULT_DEF (ptr) + && (! SSA_NAME_DEF_STMT (ptr) + || ! gimple_bb (SSA_NAME_DEF_STMT (ptr))))) continue; streamer_write_uhwi (ob, i);