summaryrefslogtreecommitdiff
path: root/gcc/ira-costs.c
diff options
context:
space:
mode:
authoramker <amker@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-11 03:55:14 +0000
committeramker <amker@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-11 03:55:14 +0000
commita0ca7f3ded60c309d018df2b6f10a438bd30afe4 (patch)
tree7eed9012cafb0b687b25ff31228c05b0ae1f2dd8 /gcc/ira-costs.c
parent826d6e6606c8626414c3671a7de6c654626812db (diff)
downloadgcc-a0ca7f3ded60c309d018df2b6f10a438bd30afe4.tar.gz
PR target/56124
* ira-costs.c (scan_one_insn): Check whether the source rtx of loading has side effect. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197691 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ira-costs.c')
-rw-r--r--gcc/ira-costs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index d2806bdffbd..508394e2962 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -1292,10 +1292,13 @@ scan_one_insn (rtx insn)
a memory requiring special instructions to load it, decreasing
mem_cost might result in it being loaded using the specialized
instruction into a register, then stored into stack and loaded
- again from the stack. See PR52208. */
+ again from the stack. See PR52208.
+
+ Don't do this if SET_SRC (set) has side effect. See PR56124. */
if (set != 0 && REG_P (SET_DEST (set)) && MEM_P (SET_SRC (set))
&& (note = find_reg_note (insn, REG_EQUIV, NULL_RTX)) != NULL_RTX
- && ((MEM_P (XEXP (note, 0)))
+ && ((MEM_P (XEXP (note, 0))
+ && !side_effects_p (SET_SRC (set)))
|| (CONSTANT_P (XEXP (note, 0))
&& targetm.legitimate_constant_p (GET_MODE (SET_DEST (set)),
XEXP (note, 0))