[Bug tree-optimization/108166] [12/13 Regression] Wrong code with -O2 since r12-8078-ga42aa68bf1ad745a
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 22 11:53:28 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108166
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:5c17adfb5d08e34da7a7f234dfc2ed1f0aaadaa9
commit r13-4845-g5c17adfb5d08e34da7a7f234dfc2ed1f0aaadaa9
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Dec 22 12:52:48 2022 +0100
phiopt: Drop SSA_NAME_RANGE_INFO in maybe equal case [PR108166]
The following place in value_replacement is after proving that
x == cst1 ? cst2 : x
phi result is only used in a comparison with constant which doesn't
care if it compares cst1 or cst2 and replaces it with x.
The testcase is miscompiled because we have after the replacement
incorrect range info for the phi result, we would need to
effectively union the phi result range with cst1 (oarg in the code)
because previously that constant might be missing in the range, but
newly it can appear (we've just verified that the single use stmt
of the phi result doesn't care about that value in particular).
The following patch just resets the info, bootstrapped/regtested
on x86_64-linux and i686-linux, ok for trunk?
Aldy/Andrew, how would one instead union the SSA_NAME_RANGE_INFO
with some INTEGER_CST and store it back into SSA_NAME_RANGE_INFO
(including adjusting non-zero bits and the like)?
2022-12-22 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/108166
* tree-ssa-phiopt.cc (value_replacement): For the maybe_equal_p
case turned into equal_p reset SSA_NAME_RANGE_INFO of phi result.
* g++.dg/torture/pr108166.C: New test.
More information about the Gcc-bugs
mailing list