diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-12-10 16:50:39 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-12-10 16:50:39 +0100 |
commit | 7676235f690e624b7ed41a22b22ce8ccfac1492f (patch) | |
tree | cd434c2391ad6eb6707b64888f94c4f9aa5d43ea /gcc/fortran/simplify.cc | |
parent | ea4b23d9c82d9be3b982c3519fe5e8e9d833a6a8 (diff) | |
download | gcc-7676235f690e624b7ed41a22b22ce8ccfac1492f.zip gcc-7676235f690e624b7ed41a22b22ce8ccfac1492f.tar.gz gcc-7676235f690e624b7ed41a22b22ce8ccfac1492f.tar.bz2 |
ivopts: Fix IP_END handling for asm goto [PR107997]
The following testcase ICEs, because the latch bb ends with
asm goto which has both fallthrough to the header and one or more labels
in the header too. In that case there is just a single edge out of the
latch block, but still the asm goto is stmt_ends_bb_p statement, yet
ivopts decides to emit an IV bump at the IP_END position and inserts
it into the same bb as the asm goto after it, which then fails verification
(control flow in the middle of bb).
The following patch fixes it by splitting the latch -> header edge in that
case and inserting into the newly created bb, where split_edge ->
redirect_edge_and_branch is able to deal with this case correctly.
2022-12-10 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/107997
* tree-ssa-loop-ivopts.cc: Include cfganal.h.
(create_new_iv) <case IP_END>: If ip_end_pos bb is non-empty and ends
with a stmt which ends bb, instead of adding iv update after it split
the latch edge and insert iterator into the new latch bb.
* gcc.c-torture/compile/pr107997.c: New test.
Diffstat (limited to 'gcc/fortran/simplify.cc')
0 files changed, 0 insertions, 0 deletions