]> git.ipfire.org Git - thirdparty/gcc.git/commit
lower-bitint: Fix up additions of EH edges [PR113818]
authorJakub Jelinek <jakub@redhat.com>
Fri, 9 Feb 2024 10:07:34 +0000 (11:07 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 9 Feb 2024 10:07:34 +0000 (11:07 +0100)
commit6c124873f5197ca8aac5acfada4b0e7fba49807f
tree0234de86a8278db66dab081a326e787fca58c278
parent97e49bf00d1a7b7a2a02531a1c5362fad27348d9
lower-bitint: Fix up additions of EH edges [PR113818]

Due to -fnon-call-exceptions the bitint lowering adds new EH edges
in various places, so that the EH edge points from handling (e.g. load or
store) of each of the limbs.  The problem is that the EH edge destination
as shown in the testcase can have some PHIs.  If it is just a virtual
PHI, no big deal, the pass uses TODO_update_ssa_only_virtuals, but if
it has other PHIs, I think we need to copy the values from the preexisting
corresponding EH edge (which is from the original stmt to the EH pad)
to the newly added EH edge, so that the PHI arguments are the same rather
than missing (which ICEs during checking at the end of the pass).

This patch adds a function to do that and uses it whenever adding EH edges.

2024-02-09  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/113818
* gimple-lower-bitint.cc (add_eh_edge): New function.
(bitint_large_huge::handle_load,
bitint_large_huge::lower_mergeable_stmt,
bitint_large_huge::lower_muldiv_stmt): Use it.

* gcc.dg/bitint-89.c: New test.
gcc/gimple-lower-bitint.cc
gcc/testsuite/gcc.dg/bitint-89.c [new file with mode: 0644]