From: Richard Guenther <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH][varmap] Preserve bitmaps on SETs in the face of splitters
Date: Tue, 13 Nov 2007 13:20:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.64.0711131221560.4401@zhemvz.fhfr.qr> (raw)
Applied to var-mappings-branch.
Richard.
2007-11-07 Michael Matz <matz@suse.de>
* 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 ----
}
\f
+ 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" } } */
reply other threads:[~2007-11-13 11:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0711131221560.4401@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).