From patchwork Fri Jun 29 14:17:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 168110 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 DFBA91007D4 for ; Sat, 30 Jun 2012 00:17:57 +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=1341584279; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To: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=6BjAyAB3PEEAose0KRCBoWq76WM=; b=HA/nxdXNZi3zqMNWR6j/YBusBqshZy2WIIuGG38gYzwNMpwTiRKpYUUEfRBUgS Pgy6Uhkn2OjBJcw0w3XrPlttvsEH2qb+0pPjqJxKvtRHagp1aZCDRqr3Y7jhuTRO 6/FjQeZ7XsPCbEOA+GxPCv7h2Ej4nGJNMOMrklclpMr6w= 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: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=bsY63ZiNP1oJ0SaOA+cX1Doc+40gcaV2aeT2kGtw+OwgoQPO66VXg9Oy28hKuD Gp+8JigNZQMSPpyzZZLwxtR2sv0S1Nggfb4qIybWa2VXoCX2M374RlMQ38f22f0O ceEqARu3lohc1UI94DYi0dYvT5teRHyacYoVCKSfI0SHw=; Received: (qmail 17498 invoked by alias); 29 Jun 2012 14:17:47 -0000 Received: (qmail 17487 invoked by uid 22791); 29 Jun 2012 14:17:46 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W 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; Fri, 29 Jun 2012 14:17:33 +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 779C7A2111 for ; Fri, 29 Jun 2012 16:17:32 +0200 (CEST) Date: Fri, 29 Jun 2012 16:17:31 +0200 From: Martin Jambor To: GCC Patches Subject: [trunk, 4.7, PR 38474] Avoid unnecessary vdef walks in compute_known_type_jump_func Message-ID: <20120629141731.GA3893@virgil.arch.suse.de> Mail-Followup-To: GCC Patches 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, PR 38474 testcase revealed what we can do a lot of entirely unnecessary vdef walking only to throw away the result later because of a much cheaper check. This patch fixes that. The patch applies to both trunk and the 4.7 branch, I have bootstrapped and tested it on both on an x86_64-linux without any problems. Because of Richi's comment #63 in bugzilla, I assume it is approved for both trunk and the branch too and will commit it on Monday, unless someone objects. Thanks, Martin 2012-06-27 Martin Jambor PR middle-end/38474 * ipa-prop.c (compute_known_type_jump_func): Put BINFO check before a dynamic type change check. Index: src/gcc/ipa-prop.c =================================================================== --- src.orig/gcc/ipa-prop.c +++ src/gcc/ipa-prop.c @@ -912,8 +912,8 @@ compute_known_type_jump_func (tree op, s || is_global_var (base)) return; - if (detect_type_change (op, base, call, jfunc, offset) - || !TYPE_BINFO (TREE_TYPE (base))) + if (!TYPE_BINFO (TREE_TYPE (base)) + || detect_type_change (op, base, call, jfunc, offset)) return; ipa_set_jf_known_type (jfunc, offset, TREE_TYPE (base), TREE_TYPE (op));