From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17394 invoked by alias); 13 Nov 2007 11:18:25 -0000 Received: (qmail 17385 invoked by uid 22791); 13 Nov 2007 11:18:25 -0000 X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 13 Nov 2007 11:18:22 +0000 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id A27F22AA46 for ; Tue, 13 Nov 2007 12:18:19 +0100 (CET) Date: Tue, 13 Nov 2007 13:20:00 -0000 From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH][varmap] Preserve bitmaps on SETs in the face of splitters Message-ID: 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: 2007-11/txt/msg00702.txt.bz2 Applied to var-mappings-branch. Richard. 2007-11-07 Michael Matz * emit-rtl.c (move_xbitmap): New helper. (try_split): Preserve bitmap of names from splitters. * gcc.dg/tree-ssa/vars-2.c: New testcase. Index: var-mappings-branch/gcc/emit-rtl.c =================================================================== *** var-mappings-branch.orig/gcc/emit-rtl.c 2007-11-12 17:51:42.000000000 +0100 --- var-mappings-branch/gcc/emit-rtl.c 2007-11-12 17:55:40.000000000 +0100 *************** mark_label_nuses (rtx x) *** 3185,3190 **** --- 3185,3204 ---- } + static void + move_xbitmap (rtx x, const_rtx cset, void *data) + { + rtx orig_set = (rtx)data; + rtx set = (rtx)cset; + if (GET_CODE (set) == CLOBBER) + return; + if (!reg_overlap_mentioned_p (x, SET_DEST (orig_set))) + return; + if (XBITMAP (set, 2)) + return; + XBITMAP (set, 2) = XBITMAP (orig_set, 2); + } + /* Try splitting insns that can be split for better scheduling. PAT is the pattern which might split. TRIAL is the insn providing PAT. *************** try_split (rtx pat, rtx trial, int last) *** 3368,3373 **** --- 3382,3416 ---- } } + if (GET_CODE (pat) == SET && XBITMAP (pat, 2)) + { + insn = insn_last; + while (insn != NULL_RTX) + { + if (INSN_P (insn)) + note_stores (PATTERN (insn), move_xbitmap, pat); + insn = PREV_INSN (insn); + } + } + else if (GET_CODE (pat) == PARALLEL) + { + int i; + for (i = 0; i < XVECLEN (pat, 0); i++) + if (GET_CODE (XVECEXP (pat, 0, i)) == SET + && XBITMAP (XVECEXP (pat, 0, i), 2)) + { + rtx set = XVECEXP (pat, 0, i); + insn = insn_last; + while (insn != NULL_RTX) + { + if (INSN_P (insn)) + note_stores (PATTERN (insn), move_xbitmap, set); + insn = PREV_INSN (insn); + } + } + } + + tem = emit_insn_after_setloc (seq, trial, INSN_LOCATOR (trial)); delete_insn (trial); Index: var-mappings-branch/gcc/testsuite/gcc.dg/tree-ssa/vars-2.c =================================================================== *** /dev/null 1970-01-01 00:00:00.000000000 +0000 --- var-mappings-branch/gcc/testsuite/gcc.dg/tree-ssa/vars-2.c 2007-11-12 17:55:40.000000000 +0100 *************** *** 0 **** --- 1,21 ---- + /* { dg-do compile } */ + /* { dg-options "-O -g -fvar-tracking -fdump-tree-final_cleanup-vars -fdump-rtl-vartrack" } */ + + /* In this test we want to keep the name "j" associated with + the expression "i * 2" passed to the inlined function "bar" + even in the presence of RTL splitters. */ + + static int bar(int j) + { + return j; + } + int l; + int foo(int i) + { + l = bar(i*2); + return l; + } + + /* { dg-final { scan-tree-dump "i \\\* 2 E{ j }" "final_cleanup" } } */ + /* { dg-final { scan-rtl-dump "\\\[orig:.* j \\\]" "vartrack" } } */ + /* { dg-final { cleanup-tree-dump "final_cleanup" } } */