From patchwork Thu Aug 8 22:59:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 265865 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 DC9EB2C007E for ; Fri, 9 Aug 2013 08:59:16 +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:subject:message-id:mime-version:content-type; q=dns; s= default; b=lK0uUCMIV6Ru/4cL0G8tNHU75dHyl/hYQcI9UJObR9g3IkoR2DoV2 7Hq9takOPC2XAMj9jt7Y/8g30eZ1j+PtHQHAiI0oqItWFlb0PFSjHjJ+hUK8CN2H eVAGkTc5Fkx+AeakYTWmZ8SFSeb/abDgbjpGaMWtv8qK01/3ZRI4Xc= 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=63/Z3tI9izeo5sdYdv39DoAiWnQ=; b=St38VmCKbOfNqM7ntige AxEnQpcnkSIZBYgqGPxhWJnUkkyOBECX56hzBVBQxWwRAf9zEFXJlapoV2Ujw/pt M3bgm2i0+d9SOTGncIhswnIVxgJ2CW/L/FHjIKaXUITFfB89jbE960s1p5QRp3Ox ufyOqnGevM6rH60hONC8SvU= Received: (qmail 18198 invoked by alias); 8 Aug 2013 22:59:09 -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 18185 invoked by uid 89); 8 Aug 2013 22:59:09 -0000 X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_50, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RDNS_NONE autolearn=no version=3.3.1 Received: from Unknown (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 08 Aug 2013 22:59:08 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 2EB5C543065; Fri, 9 Aug 2013 00:59:00 +0200 (CEST) Date: Fri, 9 Aug 2013 00:59:00 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix PHI IDs in LTO streaming Message-ID: <20130808225900.GA20989@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Hi, LTO streaming renumbers gimple statements. It however forgets about PHIs that causes duplicated gimple ids and later fun everywhere (especially for me when I want to use them for reference streaming). This patch assign numbers to SSA names too. Since virtual PHIs are not stored, we have to ignore them on stream-out time. I do not think it is cool that they get duplicated ids so I just renumber them afterwards. Bootstrapped/regtested x86_64-linux, comitted as obvious. Honza * lto-streamer-out.c (output_function): Renumber PHIs. * lto-streamer-in.c (input_function): Likewise. Index: lto-streamer-out.c =================================================================== --- lto-streamer-out.c (revision 201568) +++ lto-streamer-out.c (working copy) @@ -1792,12 +1792,32 @@ output_function (struct cgraph_node *nod FOR_ALL_BB (bb) { gimple_stmt_iterator gsi; + for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + + /* Virtual PHIs are not going to be streamed. */ + if (!virtual_operand_p (gimple_phi_result (stmt))) + gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun)); + } for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple stmt = gsi_stmt (gsi); gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun)); } } + /* To avoid keeping duplicate gimple IDs in the statements, renumber + virtual phis now. */ + FOR_ALL_BB (bb) + { + gimple_stmt_iterator gsi; + for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + if (virtual_operand_p (gimple_phi_result (stmt))) + gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun)); + } + } /* Output the code for the function. */ FOR_ALL_BB_FN (bb, fn) Index: lto-streamer-in.c =================================================================== --- lto-streamer-in.c (revision 201568) +++ lto-streamer-in.c (working copy) @@ -908,6 +908,11 @@ input_function (tree fn_decl, struct dat FOR_ALL_BB (bb) { gimple_stmt_iterator gsi; + for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun)); + } for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple stmt = gsi_stmt (gsi); @@ -917,7 +922,14 @@ input_function (tree fn_decl, struct dat stmts = (gimple *) xcalloc (gimple_stmt_max_uid (fn), sizeof (gimple)); FOR_ALL_BB (bb) { - gimple_stmt_iterator bsi = gsi_start_bb (bb); + gimple_stmt_iterator bsi = gsi_start_phis (bb); + while (!gsi_end_p (bsi)) + { + gimple stmt = gsi_stmt (bsi); + gsi_next (&bsi); + stmts[gimple_uid (stmt)] = stmt; + } + bsi = gsi_start_bb (bb); while (!gsi_end_p (bsi)) { gimple stmt = gsi_stmt (bsi);