]> git.ipfire.org Git - thirdparty/gcc.git/commit
[ifcombine] check and extend constants to compare with bitfields
authorAlexandre Oliva <oliva@adacore.com>
Mon, 13 Jan 2025 17:53:25 +0000 (14:53 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Tue, 14 Jan 2025 16:14:56 +0000 (13:14 -0300)
commit22fe3c05d86b52c35850918bfb21e1f597e1b5c7
tree01ff7b06230e5ec8b99f30552b019162467063c6
parente5e9e50fc6816713d012f1d96ae308a0946d5a14
[ifcombine] check and extend constants to compare with bitfields

Add logic to check and extend constants compared with bitfields, so
that fields are only compared with constants they could actually
equal.  This involves making sure the signedness doesn't change
between loads and conversions before shifts: we'd need to carry a lot
more data to deal with all the possibilities.

for  gcc/ChangeLog

PR tree-optimization/118456
* gimple-fold.cc (decode_field_reference): Punt if shifting
after changing signedness.
(fold_truth_andor_for_ifcombine): Check extension bits in
constants before clipping.

for  gcc/testsuite/ChangeLog

PR tree-optimization/118456
* gcc.dg/field-merge-21.c: New.
* gcc.dg/field-merge-22.c: New.
gcc/gimple-fold.cc
gcc/testsuite/gcc.dg/field-merge-21.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/field-merge-22.c [new file with mode: 0644]