From patchwork Fri Dec 10 19:48:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 75130 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 A96D6B6F1E for ; Sat, 11 Dec 2010 06:48:34 +1100 (EST) Received: (qmail 13782 invoked by alias); 10 Dec 2010 19:48:31 -0000 Received: (qmail 13768 invoked by uid 22791); 10 Dec 2010 19:48:30 -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; Fri, 10 Dec 2010 19:48:25 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBAJmOxx015992 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 10 Dec 2010 14:48:24 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oBAJmN8r002018 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 10 Dec 2010 14:48:24 -0500 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 oBAJmNl3018219 for ; Fri, 10 Dec 2010 20:48:23 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id oBAJmNPn018218 for gcc-patches@gcc.gnu.org; Fri, 10 Dec 2010 20:48:23 +0100 Date: Fri, 10 Dec 2010 20:48:22 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Remove --enable-checking=rtl var-tracking verification (PR debug/46867) Message-ID: <20101210194822.GS29412@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! As the testcase below shows, even the strip_pointer_flags hack can't cure in some cases the differences caused by REG_POINTER vs. lack thereof, as simplify-rtx.c doesn't try to swap anything if both operands have the same precedence. The following patch just nukes the extra checking, other alternative would be only to hack up swap_commutative_operands_p etc. to consider some global flag which var-tracking.c would set and which would say that REG_POINTER/MEM_POINTER should be disregarded. Bootstrapped/regtested on x86_64-linux and i686-linux (with rtl checking), ok for trunk? 2010-12-10 Jakub Jelinek PR debug/46867 * var-tracking.c (emitted_notes, string_pointer_flags): Removed. (emit_note_insn_var_location): Remove ENABLE_RTL_CHECKING verification. (vt_emit_notes): Don't initialize and destroy emitted_notes. * gcc.dg/pr46867.c: New test. Jakub --- gcc/var-tracking.c.jj 2010-12-02 11:51:32.000000000 +0100 +++ gcc/var-tracking.c 2010-12-10 15:16:06.000000000 +0100 @@ -7095,24 +7095,6 @@ vt_expand_loc_dummy (rtx loc, htab_t var return ret; } -#ifdef ENABLE_RTL_CHECKING -/* Used to verify that cur_loc_changed updating is safe. */ -static struct pointer_map_t *emitted_notes; - -/* Strip REG_POINTER from REGs and MEM_POINTER from MEMs in order to - avoid differences in commutative operand simplification. */ -static rtx -strip_pointer_flags (rtx x, const_rtx old_rtx ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) -{ - if (REG_P (x) && REG_POINTER (x)) - return gen_rtx_REG (GET_MODE (x), REGNO (x)); - if (MEM_P (x) && MEM_POINTER (x)) - return gen_rtx_MEM (GET_MODE (x), XEXP (x, 0)); - return NULL_RTX; -} -#endif - /* Emit the NOTE_INSN_VAR_LOCATION for variable *VARP. DATA contains additional parameters: WHERE specifies whether the note shall be emitted before or after instruction INSN. */ @@ -7157,10 +7139,8 @@ emit_note_insn_var_location (void **varp if (var->n_var_parts == 0) var->cur_loc_changed = true; } -#ifndef ENABLE_RTL_CHECKING if (!var->cur_loc_changed) goto clear; -#endif for (i = 0; i < var->n_var_parts; i++) { enum machine_mode mode, wider_mode; @@ -7302,36 +7282,6 @@ emit_note_insn_var_location (void **varp parallel, (int) initialized); } -#ifdef ENABLE_RTL_CHECKING - if (note_vl) - { - void **note_slot = pointer_map_insert (emitted_notes, decl); - rtx pnote = (rtx) *note_slot; - if (!var->cur_loc_changed && (pnote || PAT_VAR_LOCATION_LOC (note_vl))) - { - rtx old_vl, new_vl; - gcc_assert (pnote); - old_vl = PAT_VAR_LOCATION_LOC (pnote); - new_vl = PAT_VAR_LOCATION_LOC (note_vl); - if (!rtx_equal_p (old_vl, new_vl)) - { - /* There might be differences caused by REG_POINTER - differences. REG_POINTER affects - swap_commutative_operands_p. */ - old_vl = simplify_replace_fn_rtx (old_vl, NULL_RTX, - strip_pointer_flags, NULL); - new_vl = simplify_replace_fn_rtx (new_vl, NULL_RTX, - strip_pointer_flags, NULL); - gcc_assert (rtx_equal_p (old_vl, new_vl)); - PAT_VAR_LOCATION_LOC (note_vl) = new_vl; - } - } - *note_slot = (void *) note_vl; - } - if (!var->cur_loc_changed) - goto clear; -#endif - if (where != EMIT_NOTE_BEFORE_INSN) { note = emit_note_after (NOTE_INSN_VAR_LOCATION, insn); @@ -7960,9 +7910,6 @@ vt_emit_notes (void) basic_block bb; dataflow_set cur; -#ifdef ENABLE_RTL_CHECKING - emitted_notes = pointer_map_create (); -#endif gcc_assert (!htab_elements (changed_variables)); /* Free memory occupied by the out hash tables, as they aren't used @@ -8022,9 +7969,6 @@ vt_emit_notes (void) VEC_free (rtx, heap, changed_values_stack); } -#ifdef ENABLE_RTL_CHECKING - pointer_map_destroy (emitted_notes); -#endif emit_notes = false; } --- gcc/testsuite/gcc.dg/pr46867.c.jj 2010-12-10 16:21:14.000000000 +0100 +++ gcc/testsuite/gcc.dg/pr46867.c 2010-12-10 15:20:53.000000000 +0100 @@ -0,0 +1,32 @@ +/* PR debug/46867 */ +/* { dg-do compile } */ +/* { dg-options "-O -g" } */ + +typedef __PTRDIFF_TYPE__ ptrdiff_t; + +extern void *bar (void); + +void +foo (int x, char *r1, char *r2, __INTPTR_TYPE__ *rp, char *t) +{ + char *tx = tx; + char **cc = bar (); + ptrdiff_t rx = r1 - r2; + for (;;) + { + char *cp1 = (char *) *rp; + char *cp2 = t; + char *s; + ptrdiff_t len = cp1 - tx + rx * (cp2 - cp1); + while (len) + ; + for (s = tx; s; s++) + ; + while (s) + if (s == cc[s - r1]) + if (x) + bar (); + if (cp1) + tx = cp2; + } +}