]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-ssa-math-opts: Fix up gsi_remove order in match_uaddc_usubc [PR112430]
authorJakub Jelinek <jakub@redhat.com>
Sat, 11 Nov 2023 19:15:53 +0000 (20:15 +0100)
committerJakub Jelinek <jakub@redhat.com>
Sat, 11 Nov 2023 19:15:53 +0000 (20:15 +0100)
commit7610e5cc82bd6316cfe0bfee6d9f12d8c2cfa9c3
tree7e67c3df9d1da88574de1fd486e4625a40dcfcb6
parentfc8458e20a524d053f576d64a606e21f8bd03b84
tree-ssa-math-opts: Fix up gsi_remove order in match_uaddc_usubc [PR112430]

The following testcase ICEs, because the temp_stmts were removed in
wrong order, from the ones appearing earlier in the IL to the later ones,
so insert_debug_temps_for_defs can reintroduce dead SSA_NAMEs back into the
IL.

The following patch fixes that by removing them in the order they were
pushed into the vector, which is from later ones to earlier ones.
Additionally, I've noticed I forgot to call release_defs on the removed
stmts.

2023-11-11  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/112430
* tree-ssa-math-opts.cc (match_uaddc_usubc): Remove temp_stmts in the
order they were pushed rather than in reverse order.  Call
release_defs after gsi_remove.

* gcc.dg/pr112430.c: New test.
gcc/testsuite/gcc.dg/pr112430.c [new file with mode: 0644]
gcc/tree-ssa-math-opts.cc