]> git.ipfire.org Git - thirdparty/gcc.git/commit
switch-conversion: Mark CSWTCH as mergeable [PR120451]
authorAndrew Pinski <quic_apinski@quicinc.com>
Mon, 2 Jun 2025 22:56:20 +0000 (15:56 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Tue, 3 Jun 2025 05:13:13 +0000 (22:13 -0700)
commitaa935ce40a777eb0b4a4d3d2e03cf2efb4cf9619
tree8b9ead8b480ebe6b4ebe03e364fd3358dfade5b5
parent13699eb9883d6abcfbe971c9c98d113b00553779
switch-conversion: Mark CSWTCH as mergeable [PR120451]

When we have a smallish CSWTCH, it could be placed in the rodata.cst16
section so it can be merged with other constants across TUs.

The fix is simple; just mark the decl as mergable (DECL_MERGEABLE).
DECL_MERGEABLE was added with r14-1500-g4d935f52b0d5c0 specifically
to improve these kind of decls.

PR tree-optimization/120451

gcc/ChangeLog:

* tree-switch-conversion.cc (switch_conversion::build_one_array): Mark
the newly created decl as mergable.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/cswtch-6.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/testsuite/gcc.dg/tree-ssa/cswtch-6.c [new file with mode: 0644]
gcc/tree-switch-conversion.cc