This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, rtl-optimization]: Fix PR rtl-optimization/33638
Hello!
Looking a bit further into the problem, I have noticed that actual
argument address becomes different from what CALL_INSN_FUNCTION_USAGE
claims in store_one_arg() function. The problem is in the call to
emit_push_insn() in line 4280. emit_push_insn() calls memory_address()
that fubars the address.
An (less intrusive?) variant of my previous patch is to change call to
memory_address in emit_push_insn() to memory_address_noforce(). I
can't see the benefit of
load reg <- (SP + off)
store (reg) <- regX
since IMO the address of the pushed argument won't be CSE'd with any
other address in any way.
BTW: I have tried to update arg->stack just after the call to
emit_push_insn in store_one_arg with SET_DEST (PATTERN (get_last_insn
())) to update CALL_INSN_FUNCTION_USAGE, but IMO, this is too hacky.
Uros.
Index: expr.c
===================================================================
--- expr.c (revision 129152)
+++ expr.c (working copy)
@@ -3910,13 +3910,12 @@ emit_push_insn (rtx x, enum machine_mode
#endif
{
if (GET_CODE (args_so_far) == CONST_INT)
- addr
- = memory_address (mode,
- plus_constant (args_addr,
- INTVAL (args_so_far)));
+ addr = plus_constant (args_addr, INTVAL (args_so_far));
else
- addr = memory_address (mode, gen_rtx_PLUS (Pmode, args_addr,
- args_so_far));
+ addr = gen_rtx_PLUS (Pmode, args_addr, args_so_far);
+
+ addr = memory_address_noforce (mode, addr);
+
dest = gen_rtx_MEM (mode, addr);
/* We do *not* set_mem_attributes here, because incoming arguments