aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/coarray.cc
diff options
context:
space:
mode:
authorFilip Kastl <fkastl@suse.cz>2025-05-01 15:31:30 +0200
committerFilip Kastl <fkastl@suse.cz>2025-05-02 11:51:22 +0200
commit1381a5114788a2e9234ff54e0cd7a3c810f0d02d (patch)
tree9b418c6f4a6ce11876767812ed32bbd3940509c7 /gcc/fortran/coarray.cc
parent5274db0c9b8c0e2d2879b237eb2ab576543b6c37 (diff)
downloadgcc-1381a5114788a2e9234ff54e0cd7a3c810f0d02d.zip
gcc-1381a5114788a2e9234ff54e0cd7a3c810f0d02d.tar.gz
gcc-1381a5114788a2e9234ff54e0cd7a3c810f0d02d.tar.bz2
gimple: Make bit-test switch lowering more powerful
A reasonable goal for bit-test lowering is to produce the least amount of clusters for a given switch (a cluster is basically a group of cases that can be handled by constantly many operations). The current algorithm doesn't always give optimal solutions in that sense. This patch should fix this. The important thing is basically just to ask if a cluster is_beneficial() more proactively. The patch also has a fix for a mistake which made bit-test lowering only create BITS_IN_WORD - 1 big clusters. There are also some new comments that go into more detail on the dynamic programming algorithm. gcc/ChangeLog: * tree-switch-conversion.cc (bit_test_cluster::find_bit_tests): Modify the dynamic programming algorithm to take is_beneficial() into account earlier. To do this efficiently, copy some logic from is_beneficial() here. Add detailed comments about how the DP algorithm works. (bit_test_cluster::can_be_handled): Check that the cluster range is >, not >= BITS_IN_WORD. Remove the "vec<cluster *> &, unsigned, unsigned" overloaded variant since we no longer need it. (bit_test_cluster::is_beneficial): Add a comment that this function is closely tied to m_max_case_bit_tests. Remove the "vec<cluster *> &, unsigned, unsigned" overloaded variant since we no longer need it. * tree-switch-conversion.h: Remove the vec overloaded variants of bit_test_cluster::is_beneficial and bit_test_cluster::can_be_handled. Signed-off-by: Filip Kastl <fkastl@suse.cz>
Diffstat (limited to 'gcc/fortran/coarray.cc')
0 files changed, 0 insertions, 0 deletions