diff options
-rw-r--r-- | gcc/dse.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr99863.c | 33 |
2 files changed, 38 insertions, 6 deletions
@@ -1922,8 +1922,7 @@ get_stored_val (store_info *store_info, machine_mode read_mode, static bool replace_read (store_info *store_info, insn_info_t store_insn, - read_info_t read_info, insn_info_t read_insn, rtx *loc, - bitmap regs_live) + read_info_t read_info, insn_info_t read_insn, rtx *loc) { machine_mode store_mode = GET_MODE (store_info->mem); machine_mode read_mode = GET_MODE (read_info->mem); @@ -1978,7 +1977,8 @@ replace_read (store_info *store_info, insn_info_t store_insn, for (this_insn = insns; this_insn != NULL_RTX; this_insn = NEXT_INSN (this_insn)) note_stores (PATTERN (this_insn), look_for_hardregs, regs_set); - bitmap_and_into (regs_set, regs_live); + if (store_insn->fixed_regs_live) + bitmap_and_into (regs_set, store_insn->fixed_regs_live); if (!bitmap_empty_p (regs_set)) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -2185,7 +2185,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info) offset - store_info->offset, width) && replace_read (store_info, i_ptr, read_info, - insn_info, loc, bb_info->regs_live)) + insn_info, loc)) return; /* The bases are the same, just see if the offsets @@ -2251,8 +2251,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info) store_info->width) && all_positions_needed_p (store_info, offset - store_info->offset, width) - && replace_read (store_info, i_ptr, read_info, insn_info, loc, - bb_info->regs_live)) + && replace_read (store_info, i_ptr, read_info, insn_info, loc)) return; remove = canon_true_dependence (store_info->mem, diff --git a/gcc/testsuite/gcc.target/i386/pr99863.c b/gcc/testsuite/gcc.target/i386/pr99863.c new file mode 100644 index 0000000..3d9d405 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99863.c @@ -0,0 +1,33 @@ +/* PR rtl-optimization/99863 */ +/* { dg-do run } */ +/* { dg-options "-O -fno-tree-forwprop -mno-sse2 -Wno-psabi" } */ + +typedef unsigned char __attribute__((__vector_size__ (8))) A; +typedef unsigned char __attribute__((__vector_size__ (32))) B; +typedef unsigned char __attribute__((__vector_size__ (64))) C; +typedef unsigned int __attribute__((__vector_size__ (32))) D; +typedef unsigned int __attribute__((__vector_size__ (64))) E; +typedef unsigned long long F; + +D a; +A b; + +A +foo (E x, F y) +{ + D c = (y <= 0) * a; + x *= (0 < y); + C d = (C) x; + B e = ((union { C a; B b[2];}) d).b[0] + (B) c; + A f = ((union { B a; A b[4];}) e).b[0] + (A) b; + return f; +} + +int +main () +{ + F x = (F) foo ((E) { 3 }, 5); + if (x != 3) + __builtin_abort (); + return 0; +} |