dead code elimination vs find_auto_inc
Richard Henderson
rth@redhat.com
Wed Nov 8 16:30:00 GMT 2000
Hopefully the comment is explanation enough. This bug appeared
on both ia64 and am33.
r~
* flow.c (init_propagate_block_info): Protect the rtx stored in
mem_set_list from modification by find_auto_inc.
(mark_set_1): Likewise.
Index: flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.347
diff -c -p -d -r1.347 flow.c
*** flow.c 2000/11/07 06:28:34 1.347
--- flow.c 2000/11/09 00:23:57
*************** init_propagate_block_info (bb, live, loc
*** 3930,3936 ****
|| (GET_CODE (XEXP (mem, 0)) == PLUS
&& XEXP (XEXP (mem, 0), 0) == frame_pointer_rtx
&& GET_CODE (XEXP (XEXP (mem, 0), 1)) == CONST_INT))
! pbi->mem_set_list = alloc_EXPR_LIST (0, mem, pbi->mem_set_list);
}
}
--- 3930,3950 ----
|| (GET_CODE (XEXP (mem, 0)) == PLUS
&& XEXP (XEXP (mem, 0), 0) == frame_pointer_rtx
&& GET_CODE (XEXP (XEXP (mem, 0), 1)) == CONST_INT))
! {
! #ifdef AUTO_INC_DEC
! /* Store a copy of mem, otherwise the address may be scrogged
! by find_auto_inc. This matters because insn_dead_p uses
! an rtx_equal_p check to determine if two addresses are
! the same. This works before find_auto_inc, but fails
! after find_auto_inc, causing discrepencies between the
! set of live registers calculated during the
! calculate_global_regs_live phase and what actually exists
! after flow completes, leading to aborts. */
! if (flags & PROP_AUTOINC)
! mem = shallow_copy_rtx (mem);
! #endif
! pbi->mem_set_list = alloc_EXPR_LIST (0, mem, pbi->mem_set_list);
! }
}
}
*************** mark_set_1 (pbi, code, reg, cond, insn,
*** 4561,4567 ****
everything that invalidates it. To be safe, don't eliminate any
stores though SP; none of them should be redundant anyway. */
&& ! reg_mentioned_p (stack_pointer_rtx, reg))
! pbi->mem_set_list = alloc_EXPR_LIST (0, reg, pbi->mem_set_list);
}
if (GET_CODE (reg) == REG
--- 4575,4589 ----
everything that invalidates it. To be safe, don't eliminate any
stores though SP; none of them should be redundant anyway. */
&& ! reg_mentioned_p (stack_pointer_rtx, reg))
! {
! #ifdef AUTO_INC_DEC
! /* Store a copy of mem, otherwise the address may be
! scrogged by find_auto_inc. */
! if (flags & PROP_AUTOINC)
! reg = shallow_copy_rtx (reg);
! #endif
! pbi->mem_set_list = alloc_EXPR_LIST (0, reg, pbi->mem_set_list);
! }
}
if (GET_CODE (reg) == REG
More information about the Gcc-patches
mailing list