[Bug tree-optimization/107342] Optimization opportunity where integer '/' corresponds to '>>'
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 4 14:18:43 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107342
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Aldy Hernandez <aldyh@gcc.gnu.org>:
https://gcc.gnu.org/g:679be32e66428f0ba81d1c1b55f7bd47f01cb295
commit r13-3688-g679be32e66428f0ba81d1c1b55f7bd47f01cb295
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Fri Nov 4 10:20:46 2022 +0100
Set nonzero bits for multiplication and divisions by a power of 2.
We're missing a lot of TLC in keeping track of nonzero bits across
range-ops. It isn't an oversight, but just limited amount of hours to
implement stuff.
This patch keeps better track of the nonzero mask (really
maybe_nonzero bits as discussed) across multiplication and division
when the RHS is a power of 2.
It fixes PR107342 and also touches on PR55157. In the latter, the
nonzero mask is being set quite late (CCP2) but could be set by evrp
time if we enhanced range-ops. I have added tests from both PRs.
Tested
PR tree-optimization/107342
gcc/ChangeLog:
* range-op.cc (operator_mult::fold_range): New.
(operator_div::fold_range): New.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/vrp122.c: New test.
* gcc.dg/tree-ssa/vrp123.c: New test.
More information about the Gcc-bugs
mailing list