tree-optimization/92328 fix value-number with bogus type
authorRichard Biener <rguenther@suse.de>
Tue, 21 Jan 2020 09:37:18 +0000 (10:37 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 21 Jan 2020 11:54:08 +0000 (12:54 +0100)
commit01e9f1812c72c940172700971179d7726b7a3050
treedf25df2f795f0e78d452406e2a8562bfb3c7e364
parent6fc2f9337311c11dabcc464c808cbef205f17a52
tree-optimization/92328 fix value-number with bogus type

We were actually value-numbering two entities with different type
the same rather than just having the same representation in the
hashtable.  The following fixes that by wrapping the value in a
to be inserted VIEW_CONVERT_EXPR.

2020-01-21  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92328
* tree-ssa-sccvn.c (vn_reference_lookup_3): Preserve
type when value-numbering same-sized store by inserting a
VIEW_CONVERT_EXPR.
(eliminate_dom_walker::eliminate_stmt): When eliminating
a redundant store handle bit-reinterpretation of the same value.

* gcc.dg/torture/pr92328.c: New testcase.
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr92328.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c