From patchwork Fri Apr 15 12:56:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 91366 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 A25F81007D1 for ; Fri, 15 Apr 2011 23:00:26 +1000 (EST) Received: (qmail 19487 invoked by alias); 15 Apr 2011 13:00:07 -0000 Received: (qmail 19344 invoked by uid 22791); 15 Apr 2011 13:00:04 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL,BAYES_00 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, 15 Apr 2011 12:59:59 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 5AD6D8726A for ; Fri, 15 Apr 2011 14:59:58 +0200 (CEST) Resent-From: Martin Jambor Resent-Date: Fri, 15 Apr 2011 14:59:58 +0200 Resent-Message-ID: <20110415125958.GD16443@virgil.arch.suse.de> Resent-To: GCC Patches Message-Id: <20110415125645.503701727@virgil.suse.cz> User-Agent: quilt/0.48-16.4 Date: Fri, 15 Apr 2011 14:56:22 +0200 From: Martin Jambor To: GCC Patches Cc: Richard Guenther Subject: [PATCH 3/4] Simple relaxation of dynamic type change detection routine References: <20110415125619.325556455@virgil.suse.cz> Content-Disposition: inline; filename=relax_dyn_type_non_pointers.diff 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, in order to speed up astar, I had to persuade the function that decides whether a statement potentially modifies the dynamic type of an object by storing a new value to the VMT pointer to consider the following statement harmless (all types are integers of some sort): MEM[(i32 *)b2arp_3(D) + 8B] = 0; I'd like to experiment with this routine a bit more once I have some other IPA-CP infrastructure in place but at the moment I opted for a simple solution: All scalar non-pointer stores are deemed safe. VMT pointer is a compiler generated field which is a pointer so legal user code is not able to store stuff there through some fancy type casts and compiler generated code should have no reason whatsoever to that either. Therefore I believe this change is safe and useful. I have bootstrapped and tested the patch on x886_64-linux. OK for trunk? Thanks, Martin 2011-04-14 Martin Jambor * ipa-prop.c (stmt_may_be_vtbl_ptr_store): Return false for scalar non-pointer assignments. Index: src/gcc/ipa-prop.c =================================================================== --- src.orig/gcc/ipa-prop.c +++ src/gcc/ipa-prop.c @@ -405,13 +405,18 @@ stmt_may_be_vtbl_ptr_store (gimple stmt) { tree lhs = gimple_assign_lhs (stmt); - if (TREE_CODE (lhs) == COMPONENT_REF - && !DECL_VIRTUAL_P (TREE_OPERAND (lhs, 1)) - && !AGGREGATE_TYPE_P (TREE_TYPE (lhs))) + if (!AGGREGATE_TYPE_P (TREE_TYPE (lhs))) + { + if (!POINTER_TYPE_P (TREE_TYPE (lhs))) return false; - /* In the future we might want to use get_base_ref_and_offset to find - if there is a field corresponding to the offset and if so, proceed - almost like if it was a component ref. */ + + if (TREE_CODE (lhs) == COMPONENT_REF + && !DECL_VIRTUAL_P (TREE_OPERAND (lhs, 1))) + return false; + /* In the future we might want to use get_base_ref_and_offset to find + if there is a field corresponding to the offset and if so, proceed + almost like if it was a component ref. */ + } } return true; }