summaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-21 04:41:38 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-21 04:41:38 +0000
commit0ab04fbf45c28653f78852187514c67d86295140 (patch)
tree85a7bc2ffc379e780e1eb3308a7cd52a68bfc9d1 /gcc/cse.c
parentfefdfa6eba783a005677edb3fc8459fd7bb16adb (diff)
downloadgcc-0ab04fbf45c28653f78852187514c67d86295140.tar.gz
gcc/
PR middle-end/20583 * cse.c (cse_insn): Reject invalid forms of CONST earlier. gcc/testsuite/ PR middle-end/20583 * gcc.c-torture/compile/pr20583.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107278 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index ca9087b0c2f..fdcbe19ba65 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5506,6 +5506,22 @@ cse_insn (rtx insn, rtx libcall_insn)
break;
}
+ /* Reject certain invalid forms of CONST that we create. */
+ else if (CONSTANT_P (trial)
+ && GET_CODE (trial) == CONST
+ /* Reject cases that will cause decode_rtx_const to
+ die. On the alpha when simplifying a switch, we
+ get (const (truncate (minus (label_ref)
+ (label_ref)))). */
+ && (GET_CODE (XEXP (trial, 0)) == TRUNCATE
+ /* Likewise on IA-64, except without the
+ truncate. */
+ || (GET_CODE (XEXP (trial, 0)) == MINUS
+ && GET_CODE (XEXP (XEXP (trial, 0), 0)) == LABEL_REF
+ && GET_CODE (XEXP (XEXP (trial, 0), 1)) == LABEL_REF)))
+ /* Do nothing for this case. */
+ ;
+
/* Look for a substitution that makes a valid insn. */
else if (validate_change (insn, &SET_SRC (sets[i].rtl), trial, 0))
{
@@ -5541,17 +5557,6 @@ cse_insn (rtx insn, rtx libcall_insn)
else if (constant_pool_entries_cost
&& CONSTANT_P (trial)
- /* Reject cases that will cause decode_rtx_const to
- die. On the alpha when simplifying a switch, we
- get (const (truncate (minus (label_ref)
- (label_ref)))). */
- && ! (GET_CODE (trial) == CONST
- && GET_CODE (XEXP (trial, 0)) == TRUNCATE)
- /* Likewise on IA-64, except without the truncate. */
- && ! (GET_CODE (trial) == CONST
- && GET_CODE (XEXP (trial, 0)) == MINUS
- && GET_CODE (XEXP (XEXP (trial, 0), 0)) == LABEL_REF
- && GET_CODE (XEXP (XEXP (trial, 0), 1)) == LABEL_REF)
&& (src_folded == 0
|| (!MEM_P (src_folded)
&& ! src_folded_force_flag))