sccvn: Don't use SCALAR_INT_TYPE_MODE on BLKmode BITINT_TYPEs [PR113459]
commitdcd5601c2b7298155c9a8e1bfb93ee8e952eca0b
authorJakub Jelinek <jakub@redhat.com>
Fri, 19 Jan 2024 09:00:16 +0000 (19 10:00 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 19 Jan 2024 09:00:16 +0000 (19 10:00 +0100)
tree61b5f5c71eab390729d15e80326968f8de03db18
parent56778b69ce558bb7e3ab7c561ee4ee48ac20263b
sccvn: Don't use SCALAR_INT_TYPE_MODE on BLKmode BITINT_TYPEs [PR113459]

sccvn uses GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (type)) for INTEGER_TYPEs,
most likely because that is what native_{interpret,encode}_int used.
This obviously doesn't work for larger BITINT_TYPEs which have BLKmode
and the above ICEs on those.  native_{interpret,encode}_int checks whether
the BITINT_TYPE is medium/large/huge (i.e. an array of 2+ ABI limbs)
and uses TYPE_SIZE_UNIT for that case, otherwise SCALAR_INT_TYPE_MODE like
for the INTEGER_TYPE case.

The following patch instead just uses SCALAR_INT_TYPE_MODE for non-BLKmode
TYPE_MODE and TYPE_SIZE_UNIT otherwise.

2024-01-19  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/113459
* tree-ssa-sccvn.cc (vn_walk_cb_data::push_partial_def): Use
TREE_INT_CST_LOW of TYPE_SIZE_UNIT rather than GET_MODE_SIZE
of SCALAR_INT_TYPE_MODE if type has BLKmode.
(vn_reference_lookup_3): Likewise.  Formatting fix.

* gcc.dg/bitint-73.c: New test.
gcc/testsuite/gcc.dg/bitint-73.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.cc