tree-optimization/106112 - fix CSE from wider operation
authorRichard Biener <rguenther@suse.de>
Tue, 28 Jun 2022 11:57:29 +0000 (13:57 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 19 Jul 2022 09:26:53 +0000 (11:26 +0200)
commit854ab8be5d9ddfc5b4d57a5c040d1811a89fbe4f
tree8f932529894e476ba5ed1373328a2eaf0cf90c19
parent71c6baa9abc8c378a1aa913398a8f1a2277946e0
tree-optimization/106112 - fix CSE from wider operation

The following fixes a mistake in looking up an extended operand
in the CSE of a truncated operation.

2022-06-28  Richard Biener  <rguenther@suse.de>

PR tree-optimization/106112
* tree-ssa-sccvn.cc (valueized_wider_op): Properly extend
a constant operand according to its type.

* gcc.dg/torture/pr106112.c: New testcase.

(cherry picked from commit 2dbb45d6dc0d20dc159b3d8e27ebb6825074827a)
gcc/testsuite/gcc.dg/torture/pr106112.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.cc