+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>
PR ipa/79224
if (MEM_P (recog_data.operand[i]))
{
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;
}
|| find_reg_fusage (insn, CLOBBER, reg)))))
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;
}