From patchwork Wed Mar 28 18:39:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 149297 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 54116B6EF4 for ; Thu, 29 Mar 2012 05:40:21 +1100 (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=1333564822; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:Mail-Followup-To:MIME-Version: Content-Type:Content-Disposition:User-Agent:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=/o3o1f/VN0tx5uNfXg4EIvaqds0=; b=siU0Tf7eDxp24d34r3LhUkvYabNXUEy6CH5RNydcbdJ1nLnDLLtd6Djf8w6T4p 6U+MwTH+IFMreYnEEUB041fmnKoYbggLC+6rC7i4+FwhgQjudc+ljmSqmw3CmcAV eN5bn9H+EE4th1AxwLF2+NvNrDcHZTL0bcsjbD02GGH0o= 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:Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=TKELlGc3UudATrfxdKhq/30KpoVBknk+a6YBMXIDORAywqCDKbO/i+dnqiL4KY xgBpbkdTcNQg/s+pTHDLqCog8mynWgvxGNnBKcLq5j5xmHJ3CAO2rWwldCC/VafB jLSFSJos48+SPB+Q+oIoxzIdaVpmB5BXgAKeCueVZSNsA=; Received: (qmail 21463 invoked by alias); 28 Mar 2012 18:40:12 -0000 Received: (qmail 21340 invoked by uid 22791); 28 Mar 2012 18:40:11 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SUBJ_OBFU_PUNCT_FEW, SUBJ_OBFU_PUNCT_MANY, TW_TM 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; Wed, 28 Mar 2012 18:39:38 +0000 Received: from relay2.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 25EEB90349; Wed, 28 Mar 2012 20:39:37 +0200 (CEST) Date: Wed, 28 Mar 2012 20:39:36 +0200 From: Martin Jambor To: GCC Patches Cc: Richard Guenther , Tom de Vries Subject: [PATCH] Remove bogus assert from CCP's insert_clobbers_for_var Message-ID: <20120328183936.GA2817@virgil.arch.suse.de> Mail-Followup-To: GCC Patches , Richard Guenther , Tom de Vries MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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, when testing a different patch of mine I hit the assert in insert_clobbers_for_var which is there to make sure that there is a call to builtin_stack_save in a BB with or dominating a call to builtin_alloca_with_align. In my case that was not true because the DOM pass duplicated the call to builtin_stack_save and put it onto two different paths to the same BB. On IRC I've been told that is OK and the that CCP cannot make such assumtions. Since it is only a missed-optimization if the call to the builtin is not found and processed (basically PR 51491 again but only in cases like these), I thought it best to just remove the assert by the following simple patch, bootstrapped and tested on x86_64-linux. OK for trunk? Thanks, Martin 2012-03-28 Martin Jambor * tree-ssa-ccp.c (insert_clobbers_for_var): Do not assert that there is a builtin_stack_save in a dominating BB. Index: src/gcc/tree-ssa-ccp.c =================================================================== --- src.orig/gcc/tree-ssa-ccp.c +++ src/gcc/tree-ssa-ccp.c @@ -1769,18 +1769,16 @@ gsi_prev_dom_bb_nondebug (gimple_stmt_it static void insert_clobbers_for_var (gimple_stmt_iterator i, tree var) { - bool save_found; gimple stmt; tree saved_val; htab_t visited = NULL; - for (save_found = false; !gsi_end_p (i); gsi_prev_dom_bb_nondebug (&i)) + for (; !gsi_end_p (i); gsi_prev_dom_bb_nondebug (&i)) { stmt = gsi_stmt (i); if (!gimple_call_builtin_p (stmt, BUILT_IN_STACK_SAVE)) continue; - save_found = true; saved_val = gimple_call_lhs (stmt); if (saved_val == NULL_TREE) @@ -1792,7 +1790,6 @@ insert_clobbers_for_var (gimple_stmt_ite if (visited != NULL) htab_delete (visited); - gcc_assert (save_found); } /* Detects a __builtin_alloca_with_align with constant size argument. Declares