aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index d0aae69..29dfd15 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5803,8 +5803,15 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest,
return x;
}
- /* If the code changed, return a whole new comparison. */
- if (new_code != code)
+ /* If the code changed, return a whole new comparison.
+ We also need to avoid using SUBST in cases where
+ simplify_comparison has widened a comparison with a CONST_INT,
+ since in that case the wider CONST_INT may fail the sanity
+ checks in do_SUBST. */
+ if (new_code != code
+ || (CONST_INT_P (op1)
+ && GET_MODE (op0) != GET_MODE (XEXP (x, 0))
+ && GET_MODE (op0) != GET_MODE (XEXP (x, 1))))
return gen_rtx_fmt_ee (new_code, mode, op0, op1);
/* Otherwise, keep this operation, but maybe change its operands.