From patchwork Mon Mar 25 11:26:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 230639 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 7D3F32C00B0 for ; Mon, 25 Mar 2013 22:28:11 +1100 (EST) 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:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=heNnpeiXdl5M7U9i gUAjyo2nrci8OY9laRVgiqExKZAqbnNroZV96gx6hsQ5xL6/XrHXW1i5pvzW4665 Ee2qBsbH68dU0AbBSkWRkLrJG1zRtxfKjh4FD+VzkT8z/T/Df0afMj2YktBxg5Ne hntAp7X9ffGM8RPXLDlwYspkCDc= 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:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=LG483yTT6HyMatvCKO/9MB +WGKg=; b=NsZnuMtdhLnl6HrtPfyHY5l3+rUmPhn+GP5V4t1YnVI0dpphcnZMFi pu+Wd0Yw1AskHCt7zyh6y7UfgMUjf56c3fDnpDTsDlyi9xROZspB+Oy3BsLNd4KT tO8qdKAb2VDKuQwhVuVjlIrzT4dMYQpJBxh4utZ77fGc8UCSKgpXs= Received: (qmail 2207 invoked by alias); 25 Mar 2013 11:28:00 -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 1897 invoked by uid 89); 25 Mar 2013 11:27:53 -0000 X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.1 Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 25 Mar 2013 11:27:50 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 90BE6290044; Mon, 25 Mar 2013 12:27:47 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SQWFPsu5k--U; Mon, 25 Mar 2013 12:27:47 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 47C47290023; Mon, 25 Mar 2013 12:27:47 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Cc: Richard Henderson Subject: Do not disable -fomit-frame-pointer on !ACCUMULATE_OUTGOING_ARGS targets Date: Mon, 25 Mar 2013 12:26:31 +0100 Message-ID: <1376739.Jx8uRcIPDP@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.19-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 X-Virus-Found: No Hi, process_options has had these lines for a couple of releases: /* ??? Unwind info is not correct around the CFG unless either a frame pointer is present or A_O_A is set. Fixing this requires rewriting unwind info generation to be aware of the CFG and propagating states around edges. */ if (flag_unwind_tables && !ACCUMULATE_OUTGOING_ARGS && flag_omit_frame_pointer) { warning (0, "unwind tables currently require a frame pointer " "for correctness"); flag_omit_frame_pointer = 0; } I think that's too broad: for example, it's a common pattern for a target to really enable -fomit-frame-pointer only if the stack pointer is unchanging in the function; in this case, the unwind info will be correct even if !A_O_A. So I'm proposing to disable -fomit-frame-pointer on a per-function basis instead in ira_setup_eliminable_regset. Tested on x86_64-suse-linux, OK for the mainline? 2013-03-25 Eric Botcazou * toplev.c (process_options): Do not disable -fomit-frame-pointer on a general basis if unwind info is requested and ACCUMULATE_OUTGOING_ARGS is not enabled. * ira.c (ira_setup_eliminable_regset): Instead disable it only on a per function basis if the stack pointer is not unchanging in the function. Index: ira.c =================================================================== --- ira.c (revision 196816) +++ ira.c (working copy) @@ -1875,6 +1875,15 @@ ira_setup_eliminable_regset (bool from_i || crtl->stack_realign_needed || targetm.frame_pointer_required ()); + /* ??? Unwind info is not correct around the CFG unless either a frame + pointer is present or A_O_A is set or the stack pointer is unchanging. + Fixing this requires rewriting unwind info generation to be aware of + the CFG and propagating states around edges. */ + if (flag_unwind_tables + && !ACCUMULATE_OUTGOING_ARGS + && !crtl->sp_is_unchanging) + frame_pointer_needed = true; + if (from_ira_p && ira_use_lra_p) /* It can change FRAME_POINTER_NEEDED. We call it only from IRA because it is expensive. */ Index: toplev.c =================================================================== --- toplev.c (revision 196816) +++ toplev.c (working copy) @@ -1527,18 +1527,6 @@ process_options (void) if (!flag_stack_protect) warn_stack_protect = 0; - /* ??? Unwind info is not correct around the CFG unless either a frame - pointer is present or A_O_A is set. Fixing this requires rewriting - unwind info generation to be aware of the CFG and propagating states - around edges. */ - if (flag_unwind_tables && !ACCUMULATE_OUTGOING_ARGS - && flag_omit_frame_pointer) - { - warning (0, "unwind tables currently require a frame pointer " - "for correctness"); - flag_omit_frame_pointer = 0; - } - /* Address Sanitizer needs porting to each target architecture. */ if (flag_asan && (targetm.asan_shadow_offset == NULL