From patchwork Sat Dec 8 11:08:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1009769 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-491936-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="RDDPMIuL"; dkim-atps=neutral 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 43Bmm81zmcz9s8r for ; Sat, 8 Dec 2018 22:08:21 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=Y077TeSKzVnI06JA UCt/OlYzWSsBnQf1tBzX+gbYJckCQjpe7Um19zGEGv+ki/YuHd0CX4+iVGnYCW3Y TWzefIPc0Y/Rg5gMbhLmx2GXyufoOr12Das7kO+IQWAfBgmxOnLgYGZB+odRVJlw fDqgERlGnqYvtGH3o6Ey2SiqyhQ= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=2Xca1/7j+paVQHl3lpyNFd fUbhU=; b=RDDPMIuLoo21Vuy5G4E+U2YP6GfXje5lIUirt/E5U8d1Fo1LTzLRj0 uIodIT6Be/jxlI1381ytSl56GRnLw876xDiVIBLORmQIU/Nae0nu1SccSxHOAC5X MZGU0TllvhyQ1ZYjWewXQ4hknw5IdEo+1ot7oQgpDcmkRjPOcuzg8= Received: (qmail 119483 invoked by alias); 8 Dec 2018 11:08:13 -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 119468 invoked by uid 89); 8 Dec 2018 11:08:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=U*ebotcazou, sk:ebotcaz, HX-Envelope-From:sk:ebotcaz, H*F:U*ebotcazou X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 08 Dec 2018 11:08:08 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 226F381386 for ; Sat, 8 Dec 2018 12:08:06 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 660kTeb9F1mh for ; Sat, 8 Dec 2018 12:08:06 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id EDF5A8137C for ; Sat, 8 Dec 2018 12:08:05 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR rtl-optimization/88390 Date: Sat, 08 Dec 2018 12:08:03 +0100 Message-ID: <2670184.ocz1KtPm3k@polaris> MIME-Version: 1.0 This is the failure of g++.dg/tree-prof/pr57451.C on the SPARC, caused by the -freorder-blocks-and-partition RTL optimization. The optimization splits the getData function into hold and cold parts, with the cold part throwing an exception. Now the CFI for the cold part is emitted as a second, independent FDE, although there is still a single function for the RTL machinery, so there is specific code in dwarf2cfi to patch things up. The problem is that it doesn't take into account the DW_CFA_GNU_window_save operation used on the SPARC so the second FDE lacks it entirely. That's fixed by adding a flag to dw_cfi_row to record whether the operation has been seen. Tested on SPARC/Solaris 11, applied on the mainline. 2018-12-08 Eric Botcazou PR rtl-optimization/88390 * dwarf2cfi.c (struct dw_cfi_row): Add window_save field. (cfi_row_equal_p): Compare it. (dwarf2out_frame_debug_cfa_window_save): Add FAKE parameter. If FAKE is false, set window_save of the current row. (dwarf2out_frame_debug) : Call above function with FAKE parameter set to true. : Likewise but with FAKE parameter set to false. (change_cfi_row): Emit a DW_CFA_GNU_window_save if necessary. Index: dwarf2cfi.c =================================================================== --- dwarf2cfi.c (revision 266884) +++ dwarf2cfi.c (working copy) @@ -68,6 +68,9 @@ struct GTY(()) dw_cfi_row /* The expressions for any register column that is saved. */ cfi_vec reg_save; + + /* True if the register window is saved. */ + bool window_save; }; /* The caller's ORIG_REG is saved in SAVED_IN_REG. */ @@ -766,6 +769,9 @@ cfi_row_equal_p (dw_cfi_row *a, dw_cfi_r return false; } + if (a->window_save != b->window_save) + return false; + return true; } @@ -1364,16 +1370,20 @@ dwarf2out_frame_debug_cfa_restore (rtx r } /* A subroutine of dwarf2out_frame_debug, process a REG_CFA_WINDOW_SAVE. - ??? Perhaps we should note in the CIE where windows are saved (instead of - assuming 0(cfa)) and what registers are in the window. */ + FAKE is true if this is not really a window save but something else. + + ??? Perhaps we should note in the CIE where windows are saved (instead + of assuming 0(cfa)) and what registers are in the window. */ static void -dwarf2out_frame_debug_cfa_window_save (void) +dwarf2out_frame_debug_cfa_window_save (bool fake) { dw_cfi_ref cfi = new_cfi (); cfi->dw_cfi_opc = DW_CFA_GNU_window_save; add_cfi (cfi); + if (!fake) + cur_row->window_save = true; } /* Record call frame debugging information for an expression EXPR, @@ -2133,9 +2143,13 @@ dwarf2out_frame_debug (rtx_insn *insn) break; case REG_CFA_TOGGLE_RA_MANGLE: + /* This uses the same DWARF opcode as the next operation. */ + dwarf2out_frame_debug_cfa_window_save (true); + handled_one = true; + break; + case REG_CFA_WINDOW_SAVE: - /* We overload both of these operations onto the same DWARF opcode. */ - dwarf2out_frame_debug_cfa_window_save (); + dwarf2out_frame_debug_cfa_window_save (false); handled_one = true; break; @@ -2199,6 +2213,14 @@ change_cfi_row (dw_cfi_row *old_row, dw_ else if (!cfi_equal_p (r_old, r_new)) add_cfi (r_new); } + + if (!old_row->window_save && new_row->window_save) + { + dw_cfi_ref cfi = new_cfi (); + + cfi->dw_cfi_opc = DW_CFA_GNU_window_save; + add_cfi (cfi); + } } /* Examine CFI and return true if a cfi label and set_loc is needed