diff options
author | Jeff Law <law@redhat.com> | 2017-01-16 16:43:05 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2017-01-16 16:43:05 -0700 |
commit | a59afbe2fecf938caff8462378acc0506ea4ff5c (patch) | |
tree | 11d8f3ff64aa25c82afcf28c2a86958b42e643b3 /gcc/tree-ssa-dse.c | |
parent | af995bf0190c406341949d0e6a24636ac906b1b1 (diff) | |
download | gcc-a59afbe2fecf938caff8462378acc0506ea4ff5c.zip gcc-a59afbe2fecf938caff8462378acc0506ea4ff5c.tar.gz gcc-a59afbe2fecf938caff8462378acc0506ea4ff5c.tar.bz2 |
re PR tree-optimization/79090 (DSE wrongly removes store at variable offset)
2017-01-16 Jeff Law <law@redhat.com>
PR tree-optimization/79090
PR tree-optimization/33562
PR tree-optimization/61912
PR tree-optimization/77485
* tree-ssa-dse.c (compute_trims): Accept STMT argument. Dump STMT
and computed trims into the dump file.
PR tree-optimization/79090
PR tree-optimization/33562
PR tree-optimization/61912
PR tree-optimization/77485
* tree-ssa-dse.c (compute_trims): Accept STMT argument. Dump STMT
and computed trims into the dump file.
From-SVN: r244509
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r-- | gcc/tree-ssa-dse.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 65dcb12..84c0b11 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -212,10 +212,14 @@ setup_live_bytes_from_ref (ao_ref *ref, sbitmap live_bytes) tail of ORIG resulting in a bitmap that is a superset of LIVE. Store the number of elements trimmed from the head and tail in - TRIM_HEAD and TRIM_TAIL. */ + TRIM_HEAD and TRIM_TAIL. + + STMT is the statement being trimmed and is used for debugging dump + output only. */ static void -compute_trims (ao_ref *ref, sbitmap live, int *trim_head, int *trim_tail) +compute_trims (ao_ref *ref, sbitmap live, int *trim_head, int *trim_tail, + gimple *stmt) { /* We use sbitmaps biased such that ref->offset is bit zero and the bitmap extends through ref->size. So we know that in the original bitmap @@ -231,6 +235,15 @@ compute_trims (ao_ref *ref, sbitmap live, int *trim_head, int *trim_tail) int first_orig = 0; int first_live = bitmap_first_set_bit (live); *trim_head = (first_live - first_orig) & ~0x1; + + if ((*trim_head || *trim_tail) + && dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, " Trimming statement (head = %d, tail = %d): ", + *trim_head, *trim_tail); + print_gimple_stmt (dump_file, stmt, dump_flags, 0); + fprintf (dump_file, "\n"); + } } /* STMT initializes an object from COMPLEX_CST where one or more of the @@ -244,7 +257,7 @@ static void maybe_trim_complex_store (ao_ref *ref, sbitmap live, gimple *stmt) { int trim_head, trim_tail; - compute_trims (ref, live, &trim_head, &trim_tail); + compute_trims (ref, live, &trim_head, &trim_tail, stmt); /* The amount of data trimmed from the head or tail must be at least half the size of the object to ensure we're trimming @@ -296,7 +309,7 @@ maybe_trim_constructor_store (ao_ref *ref, sbitmap live, gimple *stmt) int head_trim = 0; int tail_trim = 0; - compute_trims (ref, live, &head_trim, &tail_trim); + compute_trims (ref, live, &head_trim, &tail_trim, stmt); /* Now we want to replace the constructor initializer with memset (object + head_trim, 0, size - head_trim - tail_trim). */ @@ -384,7 +397,7 @@ maybe_trim_memstar_call (ao_ref *ref, sbitmap live, gimple *stmt) case BUILT_IN_MEMMOVE: { int head_trim, tail_trim; - compute_trims (ref, live, &head_trim, &tail_trim); + compute_trims (ref, live, &head_trim, &tail_trim, stmt); /* Tail trimming is easy, we can just reduce the count. */ if (tail_trim) @@ -405,7 +418,7 @@ maybe_trim_memstar_call (ao_ref *ref, sbitmap live, gimple *stmt) case BUILT_IN_MEMSET: { int head_trim, tail_trim; - compute_trims (ref, live, &head_trim, &tail_trim); + compute_trims (ref, live, &head_trim, &tail_trim, stmt); /* Tail trimming is easy, we can just reduce the count. */ if (tail_trim) |