From patchwork Mon Apr 2 09:42:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 150099 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 CF664B6F6E for ; Mon, 2 Apr 2012 19:43:05 +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=1333964587; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=W9rBv5sWD51hrZJXX5CH L2sZLqo=; b=ANUJQwDngVlSyIB18MmoRudf54ORsSarxYR+OQJrIpWd+FRYPuCJ aaYtb/P90mbfMdSd44TIcxP5VqsG12yRRtn2VuvXtPEQv6K7LtL5+50AQSqwsey5 U7N1X/Flu6+nh2ykQWFru7zlHR1UVdy7ZHIgxXfen0cObjZRjmFTzc0= 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:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=L7Zcp/CMXsP7zV56W8osHVOOx1fOdVk7ZcHMCnz1ZguJ7Aomc4do4vbFK3Uime M3H90cMoKPmSoEIqtPQLXNwOXa30zZDM5vQ53dldRz/93XPhZv7mYpN6wB8cw1vd 8aPNg+oEGgDnIcB4tyWmC9xVML74m+yP/wcHsbAlJ+uHk=; Received: (qmail 13385 invoked by alias); 2 Apr 2012 09:42:57 -0000 Received: (qmail 13376 invoked by uid 22791); 2 Apr 2012 09:42:55 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Apr 2012 09:42:42 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 1311B8FD0F for ; Mon, 2 Apr 2012 11:42:41 +0200 (CEST) Date: Mon, 2 Apr 2012 11:42:40 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Cc: Jan Hubicka Subject: [PATCH] Fix PR52803 Message-ID: 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 This fixes PR52803 - when we do not enter the pass_loop2 sub-pass queue nothing will execute pass_rtl_loop_done. But we still need to destroy loops, which are preserved until after pass_loop2. Doing so in the gate of pass_loop2 is ugly, but destroyed properties are ignored if the gate returns false. Another solution would be to destroy loops earlier dependent on gate_handle_loop2 - but that's equally ugly. Another solution would be to add a pass after pass_loop2 that only destroys loops (also ugly). Honza, how is this part of the pass manager supposed to work? Thanks, Richard. 2012-04-02 Richard Guenther PR middle-end/52803 * loop-init.c (gate_handle_loop2): Destroy loops here if we don't enter RTL loop optimizers. * gcc.dg/pr52803.c: New testcase. Index: gcc/loop-init.c =================================================================== --- gcc/loop-init.c (revision 186066) +++ gcc/loop-init.c (working copy) @@ -158,15 +158,24 @@ loop_optimizer_finalize (void) static bool gate_handle_loop2 (void) { - return (optimize > 0 - && (flag_move_loop_invariants - || flag_unswitch_loops - || flag_peel_loops - || flag_unroll_loops + if (optimize > 0 + && (flag_move_loop_invariants + || flag_unswitch_loops + || flag_peel_loops + || flag_unroll_loops #ifdef HAVE_doloop_end - || (flag_branch_on_count_reg && HAVE_doloop_end) + || (flag_branch_on_count_reg && HAVE_doloop_end) #endif - )); + )) + return true; + else + { + /* No longer preserve loops, remove them now. */ + cfun->curr_properties &= ~PROP_loops; + if (current_loops) + loop_optimizer_finalize (); + return false; + } } struct rtl_opt_pass pass_loop2 = Index: gcc/testsuite/gcc.dg/pr52803.c =================================================================== --- gcc/testsuite/gcc.dg/pr52803.c (revision 0) +++ gcc/testsuite/gcc.dg/pr52803.c (revision 0) @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-move-loop-invariants" } */ + +int main () { return 0; }