From 9b5d50b7c6e34267b40bdeb4c145e9132d83762d Mon Sep 17 00:00:00 2001 From: liuhongt Date: Wed, 21 Oct 2020 13:05:16 +0800 Subject: Simplify trivial VEC_COND_EXPR in expander. gcc/ChangeLog: PR target/97506 * config/i386/i386-expand.c (ix86_expand_sse_movcc): Move op_true to dest directly when op_true equals op_false. gcc/testsuite/ChangeLog: PR target/97506 * gcc.target/i386/pr97506.c: New test. --- gcc/config/i386/i386-expand.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/config/i386/i386-expand.c') diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index 02d5ca5783d..d0d7a969637 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -3525,6 +3525,13 @@ ix86_expand_sse_movcc (rtx dest, rtx cmp, rtx op_true, rtx op_false) machine_mode mode = GET_MODE (dest); machine_mode cmpmode = GET_MODE (cmp); + /* Simplify trivial VEC_COND_EXPR to avoid ICE in pr97506. */ + if (rtx_equal_p (op_true, op_false)) + { + emit_move_insn (dest, op_true); + return; + } + /* In AVX512F the result of comparison is an integer mask. */ bool maskcmp = mode != cmpmode && ix86_valid_mask_cmp_mode (mode); -- cgit v1.2.3