[Bug tree-optimization/104992] [missed optimization] x / y * y == x not optimized to x % y == 0
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Aug 1 13:24:48 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104992
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Sam Feifer <sfeifer@gcc.gnu.org>:
https://gcc.gnu.org/g:388fbbd895e72669909173c3003ae65c6483a3c2
commit r13-1916-g388fbbd895e72669909173c3003ae65c6483a3c2
Author: Sam Feifer <sfeifer@redhat.com>
Date: Fri Jul 29 09:44:48 2022 -0400
match.pd: Add new division pattern [PR104992]
This patch fixes a missed optimization in match.pd. It takes the pattern,
x / y * y == x, and optimizes it to x % y == 0. This produces fewer
instructions. This simplification does not happen for complex types.
This patch also adds tests for the optimization rule.
Bootstrapped/regtested on x86_64-pc-linux-gnu.
PR tree-optimization/104992
gcc/ChangeLog:
* match.pd (x / y * y == x): New simplification.
gcc/testsuite/ChangeLog:
* g++.dg/pr104992-1.C: New test.
* gcc.dg/pr104992.c: New test.
More information about the Gcc-bugs
mailing list