Fix ICE when lhs is NULL.
gcc/ChangeLog: PR target/100660 * config/i386/i386.c (ix86_gimple_fold_builtin): Replacing stmt with GIMPLE_NOP when lhs doesn't exist. gcc/testsuite/ChangeLog: PR target/100660 * gcc.target/i386/pr100660.c: New test.
This commit is contained in:
parent
1040a44aa2
commit
dc084c487e
@ -17991,6 +17991,7 @@ ix86_gimple_fold_builtin (gimple_stmt_iterator *gsi)
|
||||
gcc_assert (n_args == 2);
|
||||
arg0 = gimple_call_arg (stmt, 0);
|
||||
arg1 = gimple_call_arg (stmt, 1);
|
||||
if (gimple_call_lhs (stmt))
|
||||
{
|
||||
location_t loc = gimple_location (stmt);
|
||||
tree type = TREE_TYPE (arg0);
|
||||
@ -18006,6 +18007,8 @@ ix86_gimple_fold_builtin (gimple_stmt_iterator *gsi)
|
||||
gimple_set_location (g, loc);
|
||||
gsi_replace (gsi, g, false);
|
||||
}
|
||||
else
|
||||
gsi_replace (gsi, gimple_build_nop (), false);
|
||||
return true;
|
||||
|
||||
case IX86_BUILTIN_PSLLD:
|
||||
|
10
gcc/testsuite/gcc.target/i386/pr100660.c
Normal file
10
gcc/testsuite/gcc.target/i386/pr100660.c
Normal file
@ -0,0 +1,10 @@
|
||||
/* PR target/pr100660. */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-mavx2 -O" } */
|
||||
|
||||
typedef char v16qi __attribute__ ((vector_size (16)));
|
||||
v16qi
|
||||
f5 (v16qi a, v16qi b)
|
||||
{
|
||||
__builtin_ia32_pcmpgtb128 (a, b);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user