diff mbox series

target/100784 - avoid ICE with folding __builtin_ia32_shufpd

Message ID p9n52r9q-2o79-q3ps-8s42-87nq72q56877@fhfr.qr
State New
Headers show
Series target/100784 - avoid ICE with folding __builtin_ia32_shufpd | expand

Commit Message

Richard Biener Jan. 20, 2022, 1:58 p.m. UTC
This avoids ICEing when there is no LHS on the call by following
what foldings of other builtins do in , namely not folding.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Will push as obvious.

Richard.

2022-01-20  Richard Biener  <rguenther@suse.de>

	PR target/100784
	* config/i386/i386.cc (ix86_gimple_fold_builtin): Check for
	LHS before folding __builtin_ia32_shufpd and friends.
---
 gcc/config/i386/i386.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index af828868205..ad5a5caa413 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -18710,7 +18710,7 @@  ix86_gimple_fold_builtin (gimple_stmt_iterator *gsi)
 				    gimple_call_arg (stmt, n_args - 1)))
 	break;
       arg2 = gimple_call_arg (stmt, 2);
-      if (TREE_CODE (arg2) == INTEGER_CST)
+      if (TREE_CODE (arg2) == INTEGER_CST && gimple_call_lhs (stmt))
 	{
 	  unsigned HOST_WIDE_INT shuffle_mask = TREE_INT_CST_LOW (arg2);
 	  /* Check valid imm, refer to gcc.target/i386/testimm-10.c.  */