]> git.ipfire.org Git - thirdparty/gcc.git/commit
ipa-bit-cp: Fix adjusting value according to mask (PR119803)
authorMartin Jambor <mjambor@suse.cz>
Tue, 15 Apr 2025 13:55:34 +0000 (15:55 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Tue, 15 Apr 2025 13:56:17 +0000 (15:56 +0200)
commitb4cf69503bcb32491dbd7ab63fe7f0f9fcdcca38
treec5f95453c5ce314bf49d5f5810a6b84e78807ca6
parent074b2b0f91f948fe3488ada91ec6a8576c684dea
ipa-bit-cp: Fix adjusting value according to mask (PR119803)

In my fix for PR 119318 I put mask calculation in
ipcp_bits_lattice::meet_with_1 above a final fix to value so that all
the bits in the value which are meaningless according to mask have
value zero, which has tripped a validator in PR 119803.  This patch
fixes that by moving the adjustment down.

Even thought the fix for PR 119318 did a similar thing in
ipcp_bits_lattice::meet_with, the same is not necessary because that
code path then feeds the new value and mask to
ipcp_bits_lattice::set_to_constant which does the final adjustment
correctly.

In both places, however, Jakup proposed a better way of calculating
cap_mask and so I have changed it accordingly.

gcc/ChangeLog:

2025-04-15  Martin Jambor  <mjambor@suse.cz>

PR ipa/119803
* ipa-cp.cc (ipcp_bits_lattice::meet_with_1): Move m_value adjustmed
according to m_mask below the adjustment of the latter according to
cap_mask.  Optimize the  calculation of cap_mask a bit.
(ipcp_bits_lattice::meet_with): Optimize the calculation of cap_mask a
bit.

gcc/testsuite/ChangeLog:

2025-04-15  Martin Jambor  <mjambor@suse.cz>

PR ipa/119803
* gcc.dg/ipa/pr119803.c: New test.

Co-authored-by: Jakub Jelinek <jakub@redhat.com>
gcc/ipa-cp.cc
gcc/testsuite/gcc.dg/ipa/pr119803.c [new file with mode: 0644]