aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcse.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-07 21:12:03 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-07 21:12:03 +0000
commite899b9f2437d9fff55668d09076cc71e5aadb6fc (patch)
treea681c7cd97e0f0aece92ad93a8795a5e3edcab26 /gcc/gcse.c
parent4be182b923d4c72db0b6dcade8e617fbe95c22b6 (diff)
* gcse.c (can_assign_to_reg_without_clobbers_p): Do not let pointers
from test_insn into GGC space escape via SET_SRC. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211347 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r--gcc/gcse.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 84a114799b2..a49cc65b7bf 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -849,6 +849,7 @@ can_assign_to_reg_without_clobbers_p (rtx x)
{
int num_clobbers = 0;
int icode;
+ bool can_assign = false;
/* If this is a valid operand, we are OK. If it's VOIDmode, we aren't. */
if (general_operand (x, GET_MODE (x)))
@@ -866,6 +867,7 @@ can_assign_to_reg_without_clobbers_p (rtx x)
FIRST_PSEUDO_REGISTER * 2),
const0_rtx));
NEXT_INSN (test_insn) = PREV_INSN (test_insn) = 0;
+ INSN_LOCATION (test_insn) = UNKNOWN_LOCATION;
}
/* Now make an insn like the one we would make when GCSE'ing and see if
@@ -874,16 +876,19 @@ can_assign_to_reg_without_clobbers_p (rtx x)
SET_SRC (PATTERN (test_insn)) = x;
icode = recog (PATTERN (test_insn), test_insn, &num_clobbers);
- if (icode < 0)
- return false;
- if (num_clobbers > 0 && added_clobbers_hard_reg_p (icode))
- return false;
+ /* If the test insn is valid and doesn't need clobbers, and the target also
+ has no objections, we're good. */
+ if (icode >= 0
+ && (num_clobbers == 0 || !added_clobbers_hard_reg_p (icode))
+ && ! (targetm.cannot_copy_insn_p
+ && targetm.cannot_copy_insn_p (test_insn)))
+ can_assign = true;
- if (targetm.cannot_copy_insn_p && targetm.cannot_copy_insn_p (test_insn))
- return false;
+ /* Make sure test_insn doesn't have any pointers into GC space. */
+ SET_SRC (PATTERN (test_insn)) = NULL_RTX;
- return true;
+ return can_assign;
}
/* Return nonzero if the operands of expression X are unchanged from the