]> gcc.gnu.org Git - gcc.git/commit
reassoc: Fix up another ICE with returns_twice call [PR109410]
authorJakub Jelinek <jakub@redhat.com>
Wed, 12 Apr 2023 14:55:15 +0000 (16:55 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 3 May 2023 13:15:17 +0000 (15:15 +0200)
commitdc457bc1c72c53ee8c4800bac84264e0c8085f24
tree031b0333c631505ff58247a1807e144eff4f39d5
parent9ae5c50751ef4217b22cc24b67a44a55efef59b9
reassoc: Fix up another ICE with returns_twice call [PR109410]

The following testcase ICEs in reassoc, unlike the last case I've fixed
there here SSA_NAME_USED_IN_ABNORMAL_PHI is not the case anywhere.
build_and_add_sum places new statements after the later appearing definition
of an operand but if both operands are default defs or constants, we place
statement at the start of the function.

If the very first statement of a function is a call to returns_twice
function, this doesn't work though, because that call has to be the first
thing in its basic block, so the following patch splits the entry successor
edge such that the new statements are added into a different block from the
returns_twice call.

I think we should in stage1 reconsider such placements, I think it
unnecessarily enlarges the lifetime of the new lhs if its operand(s)
are used more than once in the function.  Unless something sinks those
again.  Would be nice to place it closer to the actual uses (or where
they will be placed).

2023-04-12  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/109410
* tree-ssa-reassoc.c (build_and_add_sum): Split edge from entry
block if first statement of the function is a call to returns_twice
function.

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

(cherry picked from commit 51856718a82ce60f067910d9037ca255645b37eb)
gcc/testsuite/gcc.dg/pr109410.c [new file with mode: 0644]
gcc/tree-ssa-reassoc.c
This page took 0.062424 seconds and 6 git commands to generate.