]> git.ipfire.org Git - thirdparty/gcc.git/commit
Simplify X * C1 == C2 with undefined overflow
authorMarc Glisse <marc.glisse@inria.fr>
Tue, 4 Aug 2020 15:30:16 +0000 (17:30 +0200)
committerGiuliano Belinassi <giuliano.belinassi@usp.br>
Mon, 17 Aug 2020 18:07:33 +0000 (15:07 -0300)
commitb1e9d65bf185e9e3807257d54377878c954a0873
treecdb9e26db9a42bdf1ee0af4bcb8c5243a7188514
parentc4a716a3b2a78bfa74e828daa60a84a5b8a9d5a9
Simplify X * C1 == C2 with undefined overflow

this transformation is quite straightforward, without overflow, 3*X==15 is
the same as X==5 and 3*X==5 cannot happen. Adding a single_use restriction
for the first case didn't seem necessary, although of course it can
slightly increase register pressure in some cases.

2020-08-04  Marc Glisse  <marc.glisse@inria.fr>

PR tree-optimization/95433
* match.pd (X * C1 == C2): New transformation.

* gcc.c-torture/execute/pr23135.c: Add -fwrapv to avoid
undefined behavior.
* gcc.dg/tree-ssa/pr95433.c: New file.
gcc/match.pd
gcc/testsuite/gcc.c-torture/execute/pr23135.c
gcc/testsuite/gcc.dg/tree-ssa/pr95433.c [new file with mode: 0644]