[PATCH, rtl-optimization]: Fix PR rtl-optimization/33638
Eric Botcazou
ebotcazou@libertysurf.fr
Tue Oct 9 19:37:00 GMT 2007
> It does. The problem is that CALL_INSN_FUNCTION_USAGE has a mem with
> virtual-outgoing-args, but the actual store is done via a reg. The
> address was copied into the reg due to -fforce-addr.
No, I don't think it does. Apply
Index: cselib.c
===================================================================
--- cselib.c (revision 129158)
+++ cselib.c (working copy)
@@ -1687,7 +1687,8 @@ cselib_process_insn (rtx insn)
if (CALL_P (insn))
{
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (call_used_regs[i]
+ if ((call_used_regs[i]
+ && !(ACCUMULATE_OUTGOING_ARGS && i == STACK_POINTER_REGNUM))
|| (REG_VALUES (i) && REG_VALUES (i)->elt
&& HARD_REGNO_CALL_PART_CLOBBERED (i,
GET_MODE (REG_VALUES (i)->elt->val_rtx))))
and comment out the special code in dse.c for const functions that invalidates
all the stores into the frame. Now compile the testcase without -fforce-addr
and you'll get in cse2:
(insn 1039 1038 1040 149 comunpack.f:61 (set (mem:SF (plus:SI (reg/f:SI 7 sp)
(const_int 4 [0x4])) [0 S4 A32])
(reg:SF 374)) 66 {*movsf_1} (expr_list:REG_DEAD (reg:SF 374)
(nil)))
[...]
(call_insn/u 1042 1041 1043 149 comunpack.f:61 (set (reg:SF 8 st)
(call (mem:QI (symbol_ref:SI ("powf") [flags 0x41] <function_decl
0x55704200 __builtin_powf>) [0 S1 A8])
(const_int 8 [0x8]))) 611 {*call_value_0} (nil)
(expr_list:REG_DEP_TRUE (use (mem/i:SF (reg/f:SI 7 sp) [0 S4 A32]))
(expr_list:REG_DEP_TRUE (use (mem/i:SF (plus:SI (reg/f:SI 7 sp)
(const_int 4 [0x4])) [0 S4 A32]))
(nil))))
[...]
(insn 1048 1047 1049 149 comunpack.f:62 (set (mem:SF (plus:SI (reg/f:SI 7 sp)
(const_int 4 [0x4])) [0 S4 A32])
(reg:SF 379)) 66 {*movsf_1} (expr_list:REG_DEAD (reg:SF 379)
(nil)))
And then in dse1:
**scanning insn=1048
mem: (plus:SI (reg/f:SI 7 sp)
(const_int 4 [0x4]))
after cselib_expand address: (plus:SI (reg/f:SI 7 sp)
(const_int 4 [0x4]))
after canon_rtx address: (plus:SI (reg/f:SI 7 sp)
(const_int 4 [0x4]))
varying cselib base=2 offset = 4
processing cselib store [4..8)
trying store in insn=1041 gid=-1[0..4)
trying store in insn=1039 gid=-1[4..8)
Locally deleting insn 1039
deferring deletion of insn with uid = 1039.
mems_found = 1, cannot_delete = false
[...]
deleting insn with uid = 1039.
and yet there is an explicit use for the store in CALL_INSN_FUNCTION_USAGE.
> dse.c is not smart enough to see that the address in the
> CALL_INSN_FUNCTION_USAGE is the same as the address in the register.
I think that dse.c doesn't even look into CALL_INSN_FUNCTION_USAGE.
--
Eric Botcazou
More information about the Gcc-patches
mailing list