From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24703 invoked by alias); 25 Jun 2010 09:26:16 -0000 Received: (qmail 24692 invoked by uid 22791); 25 Jun 2010 09:26:15 -0000 X-SWARE-Spam-Status: No, hits=-5.9 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; Fri, 25 Jun 2010 09:26:09 +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 F191C93A00 for ; Fri, 25 Jun 2010 11:26:06 +0200 (CEST) Date: Fri, 25 Jun 2010 11:43:00 -0000 From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH][mem-ref2] Fixup tree-affine.c Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-06/txt/msg02560.txt.bz2 Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2010-06-25 Richard Guenther * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. Index: gcc/tree-affine.c =================================================================== --- gcc/tree-affine.c (revision 161366) +++ gcc/tree-affine.c (working copy) @@ -309,6 +309,15 @@ tree_to_aff_combination (tree expr, tree return; case ADDR_EXPR: + /* Handle &MEM[ptr + CST] which is equivalent to POINTER_PLUS_EXPR. */ + if (TREE_CODE (TREE_OPERAND (expr, 0)) == MEM_REF) + { + expr = TREE_OPERAND (expr, 0); + tree_to_aff_combination (TREE_OPERAND (expr, 0), type, comb); + tree_to_aff_combination (TREE_OPERAND (expr, 1), sizetype, &tmp); + aff_combination_add (comb, &tmp); + return; + } core = get_inner_reference (TREE_OPERAND (expr, 0), &bitsize, &bitpos, &toffset, &mode, &unsignedp, &volatilep, false); @@ -331,6 +340,25 @@ tree_to_aff_combination (tree expr, tree } return; + case MEM_REF: + if (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR) + tree_to_aff_combination (TREE_OPERAND (TREE_OPERAND (expr, 0), 0), + type, comb); + else if (integer_zerop (TREE_OPERAND (expr, 1))) + { + aff_combination_elt (comb, type, expr); + return; + } + else + aff_combination_elt (comb, type, + build2 (MEM_REF, TREE_TYPE (expr), + TREE_OPERAND (expr, 0), + build_int_cst + (TREE_TYPE (TREE_OPERAND (expr, 1)), 0))); + tree_to_aff_combination (TREE_OPERAND (expr, 1), sizetype, &tmp); + aff_combination_add (comb, &tmp); + return; + default: break; }