]> gcc.gnu.org Git - gcc.git/commit
Fix PR tree-optimization/103228 and 103228: folding of (type) X op CST where type...
authorAndrew Pinski <apinski@marvell.com>
Mon, 15 Nov 2021 09:31:20 +0000 (09:31 +0000)
committerAndrew Pinski <apinski@marvell.com>
Wed, 17 Nov 2021 23:39:48 +0000 (23:39 +0000)
commit32221357007666124409ec3ee0d3a1cf263ebc9e
treebc6326db16958cb79de85d32acaca9d9c34f05df
parent0e4a8656e818b669129a670057cbc21e5b723c18
Fix PR tree-optimization/103228 and 103228: folding of (type) X op CST where type is a nop convert

Currently we fold (type) X op CST into (type) (X op ((type-x) CST)) when the conversion widens
but not when the conversion is a nop. For the same reason why we move the widening conversion
(the possibility of removing an extra conversion), we should do the same if the conversion is a
nop.

Committed as approved with the comment change.

PR tree-optimization/103228
PR tree-optimization/55177

gcc/ChangeLog:

* match.pd ((type) X bitop CST): Also do this
transformation for nop conversions.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr103228-1.c: New test.
* gcc.dg/tree-ssa/pr55177-1.c: New test.
gcc/match.pd
gcc/testsuite/gcc.dg/tree-ssa/pr103228-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr55177-1.c [new file with mode: 0644]
This page took 0.073439 seconds and 6 git commands to generate.