Simplify X * C1 == C2 with undefined overflow

Marc Glisse marc.glisse@inria.fr
Sat Aug 1 07:28:15 GMT 2020


Hello,

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.

Bootstrap+regtest on x86_64-pc-linux-gnu.

2020-08-03  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.

-- 
Marc Glisse
-------------- next part --------------
A non-text attachment was scrubbed...
Name: equal.patch
Type: text/x-diff
Size: 2026 bytes
Desc: 
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200801/35194a7d/attachment.bin>


More information about the Gcc-patches mailing list