From patchwork Sun Sep 23 08:46:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 186186 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]) by ozlabs.org (Postfix) with SMTP id 852992C0081 for ; Sun, 23 Sep 2012 18:51:06 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1348995066; h=Comment: DomainKey-Signature:Received:Received:Received:Received:From:To: Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=lDli0YC6UqgdwJxXZ4tM21GKLRk=; b=GhteRTAgpQiEjEC qNfsgncBew5gXZ+VrKZq9SgCGAt/9WQIhbKUxRGII1jAby1dYvQ/QqYg0HPWUlz4 BX55L5/M3lxYff1kbVoLpTVDly70e+1to1YMCT9YyStl7xxKRTP1MfKDt/FYL527 uKNxHv4SuPZeR87I7kULxdBDcrps= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=k4iZ6BWNJaPCrXFrqDhMdMXePXFcSRGXH3oI4H2ClQnGZXhhu/Bg8d+U9hAFpZ 1fmxR7ZPGyAtRnjrcxIPV6F6l/CpPpZSrV3G0yogciPak+ysbzkhOLYjCwg9CnbW FaCJNRO0wOnrABk2xLGeUS1j+Mn7vJjs0xiSJJXUXNI2s=; Received: (qmail 11149 invoked by alias); 23 Sep 2012 08:51:01 -0000 Received: (qmail 11135 invoked by uid 22791); 23 Sep 2012 08:50:59 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from smtp1-g21.free.fr (HELO smtp1-g21.free.fr) (212.27.42.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 23 Sep 2012 08:50:43 +0000 Received: from polaris.localnet (unknown [IPv6:2a01:e35:8a16:3850:1a03:73ff:fe45:373a]) by smtp1-g21.free.fr (Postfix) with ESMTPS id 135B79400A0 for ; Sun, 23 Sep 2012 10:50:37 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [RFC] Move ehcleanup pass to before early SRA Date: Sun, 23 Sep 2012 10:46:38 +0200 Message-ID: <1489654.ccaA29ro9n@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.16-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 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 Hi, we have run into optimization regressions in Ada caused by the interaction between the new GIMPLE clobbers and SRA: on the one hand GIMPLE clobbers create artificial EH handlers for aggregate variables, on the other hand SRA refuses to scalarize objects that appear in a statement that can throw internally. The result is that GIMPLE clobbers block the scalarization of variables that used to be possible up to the 4.6 series. Therefore the attached patch moves the ehcleanup pass to before early SRA in the pipeline. It has a small but measurable positive effect on some of our benchmarks (with a 4.7-based compiler). Tested on x86-64/Linux. 2012-09-23 Eric Botcazou * passes.c (init_optimization_passes): Run first EH cleanup pass early. Index: passes.c =================================================================== --- passes.c (revision 191365) +++ passes.c (working copy) @@ -1303,6 +1303,10 @@ init_optimization_passes (void) /* pass_build_ealias is a dummy pass that ensures that we execute TODO_rebuild_alias at this point. */ NEXT_PASS (pass_build_ealias); + /* SRA refuses to scalarize objects that appear in a statement + that can throw internally so we need to cleanup the EH tree + early to remove handlers that contain only clobbers. */ + NEXT_PASS (pass_cleanup_eh); NEXT_PASS (pass_sra_early); NEXT_PASS (pass_fre); NEXT_PASS (pass_copy_prop); @@ -1311,7 +1315,6 @@ init_optimization_passes (void) NEXT_PASS (pass_early_ipa_sra); NEXT_PASS (pass_tail_recursion); NEXT_PASS (pass_convert_switch); - NEXT_PASS (pass_cleanup_eh); NEXT_PASS (pass_profile); NEXT_PASS (pass_local_pure_const); /* Split functions creates parts that are not run through