From 6bddea17a0464f674bf71d019af4c50c44ed6ed6 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 13 Nov 2018 10:45:50 +0100 Subject: re PR rtl-optimization/87918 (ICE in simplify_binary_operation, at simplify-rtx.c:2153 since r264688) PR rtl-optimization/87918 * simplify-rtx.c (simplify_merge_mask): For COMPARISON_P, use simplify_gen_relational rather than simplify_gen_binary. * gcc.target/i386/pr87918.c: New test. From-SVN: r266062 --- gcc/simplify-rtx.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'gcc/simplify-rtx.c') diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 0d53135..db8af2f 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -5647,9 +5647,19 @@ simplify_merge_mask (rtx x, rtx mask, int op) rtx top0 = simplify_merge_mask (XEXP (x, 0), mask, op); rtx top1 = simplify_merge_mask (XEXP (x, 1), mask, op); if (top0 || top1) - return simplify_gen_binary (GET_CODE (x), GET_MODE (x), - top0 ? top0 : XEXP (x, 0), - top1 ? top1 : XEXP (x, 1)); + { + if (COMPARISON_P (x)) + return simplify_gen_relational (GET_CODE (x), GET_MODE (x), + GET_MODE (XEXP (x, 0)) != VOIDmode + ? GET_MODE (XEXP (x, 0)) + : GET_MODE (XEXP (x, 1)), + top0 ? top0 : XEXP (x, 0), + top1 ? top1 : XEXP (x, 1)); + else + return simplify_gen_binary (GET_CODE (x), GET_MODE (x), + top0 ? top0 : XEXP (x, 0), + top1 ? top1 : XEXP (x, 1)); + } } if (GET_RTX_CLASS (GET_CODE (x)) == RTX_TERNARY && VECTOR_MODE_P (GET_MODE (XEXP (x, 0))) -- cgit v1.1