From patchwork Wed Apr 27 09:08:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 93011 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 B772EB6EF7 for ; Wed, 27 Apr 2011 19:08:55 +1000 (EST) Received: (qmail 29328 invoked by alias); 27 Apr 2011 09:08:53 -0000 Received: (qmail 29319 invoked by uid 22791); 27 Apr 2011 09:08:52 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD 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; Wed, 27 Apr 2011 09:08:20 +0000 Received: from relay1.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 37AF793717 for ; Wed, 27 Apr 2011 11:08:19 +0200 (CEST) Date: Wed, 27 Apr 2011 11:08:19 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH][2/n] Alias housekeeping Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) 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 TARGET_MEM_REF handling in indirect_refs_may_alias_p, unifying handling of it and MEM_REFs where possible. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2011-04-27 Richard Guenther * tree-ssa-alias.c (indirect_refs_may_alias_p): Fix TARGET_MEM_REF handling. Index: gcc/tree-ssa-alias.c =================================================================== --- gcc/tree-ssa-alias.c (revision 172965) +++ gcc/tree-ssa-alias.c (working copy) @@ -925,12 +935,12 @@ indirect_refs_may_alias_p (tree ref1 ATT /* If both references are through the same type, they do not alias if the accesses do not overlap. This does extra disambiguation for mixed/pointer accesses but requires strict aliasing. */ - if ((TREE_CODE (base1) != TARGET_MEM_REF || !TMR_INDEX (base1)) - && (TREE_CODE (base2) != TARGET_MEM_REF || !TMR_INDEX (base2)) - && (TREE_CODE (base1) != MEM_REF - || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1) - && (TREE_CODE (base2) != MEM_REF - || same_type_for_tbaa (TREE_TYPE (base2), TREE_TYPE (ptrtype2)) == 1) + if ((TREE_CODE (base1) != TARGET_MEM_REF + || (!TMR_INDEX (base1) && !TMR_INDEX2 (base1))) + && (TREE_CODE (base2) != TARGET_MEM_REF + || (!TMR_INDEX (base2) && !TMR_INDEX2 (base2))) + && same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1 + && same_type_for_tbaa (TREE_TYPE (base2), TREE_TYPE (ptrtype2)) == 1 && same_type_for_tbaa (TREE_TYPE (ptrtype1), TREE_TYPE (ptrtype2)) == 1) return ranges_overlap_p (offset1, max_size1, offset2, max_size2); @@ -942,14 +952,9 @@ indirect_refs_may_alias_p (tree ref1 ATT /* Do access-path based disambiguation. */ if (ref1 && ref2 - && handled_component_p (ref1) - && handled_component_p (ref2) - && TREE_CODE (base1) != TARGET_MEM_REF - && TREE_CODE (base2) != TARGET_MEM_REF - && (TREE_CODE (base1) != MEM_REF - || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1) - && (TREE_CODE (base2) != MEM_REF - || same_type_for_tbaa (TREE_TYPE (base2), TREE_TYPE (ptrtype2)) == 1)) + && (handled_component_p (ref1) || handled_component_p (ref2)) + && same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1 + && same_type_for_tbaa (TREE_TYPE (base2), TREE_TYPE (ptrtype2)) == 1) return aliasing_component_refs_p (ref1, ref1_alias_set, base1_alias_set, offset1, max_size1,