Commit 30776a14 by Jakub Jelinek Committed by Jakub Jelinek

re PR target/79430 (action of statement incorrectly optimised away)

	PR target/79430
	* rtlanal.c (reg_set_p): If reg is a stack_pointer_rtx, also
	check for stack push/pop autoinc.
	* config/i386/i386.c (ix86_agi_dependent): Return false
	if the only reason why modified_in_p returned true is that
	addr is SP based and set_insn is a push or pop.

From-SVN: r247429
parent f16b9dc2
2017-05-01 Jakub Jelinek <jakub@redhat.com>
PR target/79430
* rtlanal.c (reg_set_p): If reg is a stack_pointer_rtx, also
check for stack push/pop autoinc.
* config/i386/i386.c (ix86_agi_dependent): Return false
if the only reason why modified_in_p returned true is that
addr is SP based and set_insn is a push or pop.
2017-04-29 Jan Hubicka <hubicka@ucw.cz> 2017-04-29 Jan Hubicka <hubicka@ucw.cz>
PR ipa/79224 PR ipa/79224
......
...@@ -29243,7 +29243,26 @@ ix86_agi_dependent (rtx_insn *set_insn, rtx_insn *use_insn) ...@@ -29243,7 +29243,26 @@ ix86_agi_dependent (rtx_insn *set_insn, rtx_insn *use_insn)
if (MEM_P (recog_data.operand[i])) if (MEM_P (recog_data.operand[i]))
{ {
rtx addr = XEXP (recog_data.operand[i], 0); rtx addr = XEXP (recog_data.operand[i], 0);
return modified_in_p (addr, set_insn) != 0; if (modified_in_p (addr, set_insn) != 0)
{
/* No AGI stall if SET_INSN is a push or pop and USE_INSN
has SP based memory (unless index reg is modified in a pop). */
rtx set = single_set (set_insn);
if (set
&& (push_operand (SET_DEST (set), GET_MODE (SET_DEST (set)))
|| pop_operand (SET_SRC (set), GET_MODE (SET_SRC (set)))))
{
struct ix86_address parts;
if (ix86_decompose_address (addr, &parts)
&& parts.base == stack_pointer_rtx
&& (parts.index == NULL_RTX
|| MEM_P (SET_DEST (set))
|| !modified_in_p (parts.index, set_insn)))
return false;
}
return true;
}
return false;
} }
return false; return false;
} }
...@@ -1221,6 +1221,24 @@ reg_set_p (const_rtx reg, const_rtx insn) ...@@ -1221,6 +1221,24 @@ reg_set_p (const_rtx reg, const_rtx insn)
|| find_reg_fusage (insn, CLOBBER, reg))))) || find_reg_fusage (insn, CLOBBER, reg)))))
return true; return true;
/* There are no REG_INC notes for SP autoinc. */
if (reg == stack_pointer_rtx && INSN_P (insn))
{
subrtx_var_iterator::array_type array;
FOR_EACH_SUBRTX_VAR (iter, array, PATTERN (insn), NONCONST)
{
rtx mem = *iter;
if (mem
&& MEM_P (mem)
&& GET_RTX_CLASS (GET_CODE (XEXP (mem, 0))) == RTX_AUTOINC)
{
if (XEXP (XEXP (mem, 0), 0) == stack_pointer_rtx)
return true;
iter.skip_subrtxes ();
}
}
}
return set_of (reg, insn) != NULL_RTX; return set_of (reg, insn) != NULL_RTX;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment