From patchwork Mon May 30 18:08:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 97944 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 44A6AB6F73 for ; Tue, 31 May 2011 04:08:36 +1000 (EST) Received: (qmail 22519 invoked by alias); 30 May 2011 18:08:34 -0000 Received: (qmail 22503 invoked by uid 22791); 30 May 2011 18:08:33 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI X-Spam-Check-By: sourceware.org Received: from cantor.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 May 2011 18:08:18 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 1561D8FEA2; Mon, 30 May 2011 20:08:17 +0200 (CEST) Date: Mon, 30 May 2011 20:08:16 +0200 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka Subject: [PATCH] Fix ipa_reduced_postorder with respect to overwritable functions Message-ID: <20110530180816.GA8867@virgil.arch.suse.de> Mail-Followup-To: GCC Patches , Jan Hubicka 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, I ran into issues caused by ipa_reduced_postorder not really topologically sorting functions while compiling some part of the java library (yes, this is the first time java has caught a bug for me). The problem was that all the functions are apparently AVAIL_OVERWRITABLE and even though I have instructed ipa_reduced_postorder by its allow_overwritable parameter to include such functions, it still blatantly ignores edges to such functions which leads to all sorts of unexpectedly broken assumptions and weird bugs. Fixed thusly, bootstrapped and tested on x86_64-linux (and verified that my problems caused by this went away too). OK for trunk? Thanks, Martin 2011-05-30 Martin Jambor * ipa-utils.c (searchc_env): New field allow_overwritable. (searchc): do not ignore edges to overwritable nodes if indicated by env->allow_overwritable. (ipa_reduced_postorder): Set env.allow_overwritable. Index: src/gcc/ipa-utils.c =================================================================== --- src.orig/gcc/ipa-utils.c +++ src/gcc/ipa-utils.c @@ -67,6 +67,7 @@ struct searchc_env { int order_pos; splay_tree nodes_marked_new; bool reduce; + bool allow_overwritable; int count; }; @@ -101,11 +102,14 @@ searchc (struct searchc_env* env, struct { struct ipa_dfs_info * w_info; struct cgraph_node *w = edge->callee; + enum availability avail = cgraph_function_body_availability (w); if (ignore_edge && ignore_edge (edge)) continue; - if (w->aux && cgraph_function_body_availability (edge->callee) > AVAIL_OVERWRITABLE) + if (w->aux + && (avail > AVAIL_OVERWRITABLE + || (env->allow_overwritable && avail == AVAIL_OVERWRITABLE))) { w_info = (struct ipa_dfs_info *) w->aux; if (w_info->new_node) @@ -171,6 +175,7 @@ ipa_reduced_postorder (struct cgraph_nod env.nodes_marked_new = splay_tree_new (splay_tree_compare_ints, 0, 0); env.count = 1; env.reduce = reduce; + env.allow_overwritable = allow_overwritable; for (node = cgraph_nodes; node; node = node->next) {