diff options
author | Jan Hubicka <jh@suse.cz> | 2020-10-29 16:44:48 +0100 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-10-29 16:44:48 +0100 |
commit | 0da3e7668c429cc356d96aac4b72c0c01c027b34 (patch) | |
tree | dbb70764b1ae6a218b9a0fc2757b6b2880f5f444 | |
parent | 815baade9a07d361b1daa1dcfbbda2a79f3ebb52 (diff) | |
download | gcc-0da3e7668c429cc356d96aac4b72c0c01c027b34.zip gcc-0da3e7668c429cc356d96aac4b72c0c01c027b34.tar.gz gcc-0da3e7668c429cc356d96aac4b72c0c01c027b34.tar.bz2 |
Avoid typeless storage in wide-int
* wide-int.h (trailing_wide_ints <N>): Turn len to array of structures
so it does not imply typeless storage.
(trailing_wide_ints <N>::operator): update
(trailing_wide_ints <N>::operator []): Update.
-rw-r--r-- | gcc/wide-int.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/wide-int.h b/gcc/wide-int.h index 39cd5b9..6eae46d 100644 --- a/gcc/wide-int.h +++ b/gcc/wide-int.h @@ -1387,8 +1387,10 @@ private: /* The shared maximum length of each number. */ unsigned char m_max_len; - /* The current length of each number. */ - unsigned char m_len[N]; + /* The current length of each number. + Avoid char array so the whole structure is not a typeless storage + that will, in turn, turn off TBAA on gimple, trees and RTL. */ + struct {unsigned char len;} m_len[N]; /* The variable-length part of the structure, which always contains at least one HWI. Element I starts at index I * M_MAX_LEN. */ @@ -1470,7 +1472,7 @@ template <int N> inline trailing_wide_int trailing_wide_ints <N>::operator [] (unsigned int index) { - return trailing_wide_int_storage (m_precision, &m_len[index], + return trailing_wide_int_storage (m_precision, &m_len[index].len, &m_val[index * m_max_len]); } @@ -1479,7 +1481,7 @@ inline typename trailing_wide_ints <N>::const_reference trailing_wide_ints <N>::operator [] (unsigned int index) const { return wi::storage_ref (&m_val[index * m_max_len], - m_len[index], m_precision); + m_len[index].len, m_precision); } /* Return how many extra bytes need to be added to the end of the structure |