if-conv: Delete dead stmts backwards in ifcvt_local_dce [PR94283]
authorJakub Jelinek <jakub@redhat.com>
Wed, 25 Mar 2020 07:08:04 +0000 (08:08 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 25 Mar 2020 07:08:04 +0000 (08:08 +0100)
commitc2133167ad58d15c2c2df0cb4fa3a3757603144e
treeaa5f492272cdd6ab6f77666daf6686b7973ebf58
parentadaf4b6c66e789d927684003b9ee05ed04c105ea
if-conv: Delete dead stmts backwards in ifcvt_local_dce [PR94283]

> > This patch caused:
> >
> > gcc /home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/compile/990625-2.c -O3 -g -fno-tree-dce -c
> > during GIMPLE pass: ifcvt
> > /home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/compile/990625-2.c: In function ‘broken030599’:
> > /home/marxin/Programming/gcc/gcc/testsuite/gcc.c-torture/compile/990625-2.c:2:1: internal compiler error: Segmentation fault
>
> Likely
>
>   /* Delete dead statements.  */
>   gsi = gsi_start_bb (bb);
>   while (!gsi_end_p (gsi))
>     {
>
> needs to instead work back-to-front for debug stmt adjustment to work

Indeed, that seems to work.

2020-03-25  Richard Biener  <rguenther@suse.de>
    Jakub Jelinek  <jakub@redhat.com>

PR debug/94283
* tree-if-conv.c (ifcvt_local_dce): Delete dead statements backwards.

* gcc.dg/pr94283.c: New test.

Co-authored-by: Richard Biener <rguenther@suse.de>
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr94283.c [new file with mode: 0644]
gcc/tree-if-conv.c