]> git.ipfire.org Git - thirdparty/gcc.git/commit
path solver: Compute all PHI ranges simultaneously.
authorAldy Hernandez <aldyh@redhat.com>
Sat, 13 Nov 2021 11:37:25 +0000 (12:37 +0100)
committerAldy Hernandez <aldyh@redhat.com>
Sat, 13 Nov 2021 13:41:47 +0000 (14:41 +0100)
commitb7a23949b0dcc4205fcc2be6b84b91441faa384d
treeaf283f4673b4ba1548de8fad4e79f5875e1743f4
parent380fc3b69f6e7006d72ca270f909468426de3ab7
path solver: Compute all PHI ranges simultaneously.

PHIs must be resolved simulatenously, otherwise we may not pick up the
ranges incoming to the block.

For example.  If we put p3_7 in the cache before all PHIs have been
computed, we will pick up the wrong p3_7 value for p2_17:

    # p3_7 = PHI <1(2), 0(5)>
    # p2_17 = PHI <1(2), p3_7(5)>

This patch delays updating the cache until all PHIs have been
analyzed.

gcc/ChangeLog:

PR tree-optimization/103222
* gimple-range-path.cc (path_range_query::compute_ranges_in_phis):
New.
(path_range_query::compute_ranges_in_block): Call
compute_ranges_in_phis.
* gimple-range-path.h (path_range_query::compute_ranges_in_phis):
New.

gcc/testsuite/ChangeLog:

* gcc.dg/pr103222.c: New test.
gcc/gimple-range-path.cc
gcc/gimple-range-path.h
gcc/testsuite/gcc.dg/pr103222.c [new file with mode: 0644]