On Thu, May 13, 2021 at 11:43 AM Hongtao Liu via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Hi: > When arg0 is same as arg1 in __builtin_ia32_pcmpgtw, > gimple_build (&stmts, GT_EXPR, cmp_type, arg0, arg1) will simplify the > comparison to vector constant 0, no stmts is generated, which causes > ICE in gsi_insert_before (gsi, stmts, GSI_SAME_STMT). So don't insert > stmts when it's NULL. > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,} > Ok for trunk?
It should use gsi_insert_seq_before (gsi, stmts, ...) otherwise it will only insert the first stmt in the sequence and gsi_insert_seq_before handles a NULL seq just fine. (you might want to scan ix86_gimple_fold_builtin for more similar errors). OK with that change. Richard. > gcc/ChangeLog: > > PR target/100549 > * config/i386/i386.c (ix86_gimple_fold_builtin): Insert gimple > stmts if stmts is not NULL. > > gcc/testsuite/ChangeLog: > > PR target/100549 > * gcc.target/i386/pr100549.c: New test. > > -- > BR, > Hongtao