diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-04-21 12:59:37 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-04-21 12:59:37 -0400 |
commit | 857c8e3b3bba14bfb078a194993f5f31e0d90391 (patch) | |
tree | 59b11cbdc964155b47fa50c356159e05ce7bb311 /gcc/system.h | |
parent | 7508aacf95dca3e340513e08256c19f8e3d38dae (diff) | |
download | gcc-857c8e3b3bba14bfb078a194993f5f31e0d90391.zip gcc-857c8e3b3bba14bfb078a194993f5f31e0d90391.tar.gz gcc-857c8e3b3bba14bfb078a194993f5f31e0d90391.tar.bz2 |
c++, tree: optimize walk_tree_1 and cp_walk_subtrees
These functions currently repeatedly dereference tp during the subtree
walks, dereferences which the compiler can't CSE because it can't
guarantee that the subtree walking doesn't modify *tp.
But we already implicitly require that TREE_CODE (*tp) remains the same
throughout the subtree walks, so it doesn't seem to be a huge leap to
strengthen that to requiring *tp remains the same.
So this patch manually CSEs the dereferences of *tp. This means that a
callback function can no longer replace *tp with another tree (of the
same TREE_CODE) when walking one of its subtrees, but that doesn't sound
like a useful capability anyway.
gcc/cp/ChangeLog:
* tree.cc (cp_walk_subtrees): Avoid repeatedly dereferencing tp.
<case DECLTYPE_TYPE>: Use cp_unevaluated and WALK_SUBTREE.
<case ALIGNOF_EXPR etc>: Likewise.
gcc/ChangeLog:
* tree.cc (walk_tree_1): Avoid repeatedly dereferencing tp
and type_p.
Diffstat (limited to 'gcc/system.h')
0 files changed, 0 insertions, 0 deletions