From patchwork Thu Nov 4 21:46:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 70171 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 D4153B70A9 for ; Fri, 5 Nov 2010 08:46:55 +1100 (EST) Received: (qmail 18318 invoked by alias); 4 Nov 2010 21:46:54 -0000 Received: (qmail 18310 invoked by uid 22791); 4 Nov 2010 21:46:53 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Nov 2010 21:46:49 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oA4Lkmg8014386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 4 Nov 2010 17:46:48 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oA4LklAx014428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 4 Nov 2010 17:46:47 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id oA4LkkHI008720 for ; Thu, 4 Nov 2010 22:46:46 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id oA4LkkXu008719 for gcc-patches@gcc.gnu.org; Thu, 4 Nov 2010 22:46:46 +0100 Date: Thu, 4 Nov 2010 22:46:46 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Handle MEM_REF with non-zero offset in expand_debug_expr Message-ID: <20101104214646.GC29412@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek 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! Each of x86_64-linux and i686-linux bootstrap/regtests triggers MEM_REF with non-zero offset more than 68000 times, so IMNSHO it is worth to handle it. Fixed thusly, bootstrapped/regtested it on x86_64-linux and i686-linux, ok for trunk? 2010-11-04 Jakub Jelinek * cfgexpand.c (expand_debug_expr): Handle MEM_REF with non-zero offset. Jakub --- gcc/cfgexpand.c.jj 2010-11-04 20:12:19.000000000 +0100 +++ gcc/cfgexpand.c 2010-11-04 20:46:12.160386088 +0100 @@ -2552,15 +2552,20 @@ expand_debug_expr (tree exp) } case MEM_REF: - /* ??? FIXME. */ - if (!integer_zerop (TREE_OPERAND (exp, 1))) - return NULL; - /* Fallthru. */ case INDIRECT_REF: op0 = expand_debug_expr (TREE_OPERAND (exp, 0)); if (!op0) return NULL; + if (TREE_CODE (exp) == MEM_REF) + { + op1 = expand_debug_expr (TREE_OPERAND (exp, 1)); + if (!op1 || !CONST_INT_P (op1)) + return NULL; + + op0 = plus_constant (op0, INTVAL (op1)); + } + if (POINTER_TYPE_P (TREE_TYPE (exp))) as = TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (exp))); else