From patchwork Mon Feb 6 13:39:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 139732 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 BB453B723A for ; Tue, 7 Feb 2012 00:39:37 +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=1329140378; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=k41TwtEs9btxUMpELCBW FndfH0g=; b=PawY/x7ZPP+GDGlVnJPPWtckXBBDTQ0NwsDQhAbR/OlgSmbl1VlF DSJrBzzGgdN7HhET9a6VJWNIeUjf/dz7h2IhwO12d1qOSo/luU5V8cZ/rYCFwai5 jevZwcba4BpMsBuKPstz+lTIAEl7q6UhmVsB5J7l1dCSZrEK2OkjExs= 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:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=FcCd+YvImFoojp0ycH4U6yF+bs1xsJT0qGS4ZooCUI/sl9E8kCvWbckHhqOGF/ nnJjAlwt5QH/OCexpq/eMg9eiYM93yh5kl9sAHyPDWIHWK3XRdrJY9A+70GPWwf4 Z23M+kqFjhPy9tmRafN6fEblgzeQh5YBSTH1Uz2IUAxjg=; Received: (qmail 14533 invoked by alias); 6 Feb 2012 13:39:34 -0000 Received: (qmail 14508 invoked by uid 22791); 6 Feb 2012 13:39:33 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD 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; Mon, 06 Feb 2012 13:39:20 +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 6CBF09043F for ; Mon, 6 Feb 2012 14:39:19 +0100 (CET) Date: Mon, 6 Feb 2012 14:39:19 +0100 (CET) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR50955 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 PR50955 - IVOPTs can end up expressing a pointer value using unrelated pointer bases. This confuses alias analysis. The fix is to extend the existing stop-gap we have in place to cover the case in question. Bootstrapped and tested on x86_64-unknonw-linux-gnu. I have also benchmarked the patch on SPEC 2k6 and SPEC 2k (both 64bit and 32bit codegen) with only a single visible regression at 64bit 191.fma32 at -O2 -ffast-math (-O3 -ffast-math is fine). The patch shows small consistent wins on 32bit SPEC 2k when using SSE math. Committed to trunk. Richard. 2012-02-06 Richard Guenther PR tree-optimization/50955 * tree-ssa-loop-ivopts.c (get_computation_cost_at): Artificially raise cost of expressions that replace an address with an expression based on a different pointer. Index: gcc/tree-ssa-loop-ivopts.c =================================================================== --- gcc/tree-ssa-loop-ivopts.c (revision 183757) +++ gcc/tree-ssa-loop-ivopts.c (working copy) @@ -4048,7 +4048,11 @@ get_computation_cost_at (struct ivopts_d return infinite_cost; } - if (address_p) + if (address_p + || (use->iv->base_object + && cand->iv->base_object + && POINTER_TYPE_P (TREE_TYPE (use->iv->base_object)) + && POINTER_TYPE_P (TREE_TYPE (cand->iv->base_object)))) { /* Do not try to express address of an object with computation based on address of a different object. This may cause problems in rtl