aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2023-12-11 15:09:13 -0300
committerAlexandre Oliva <oliva@gnu.org>2023-12-11 15:09:13 -0300
commite4fc59e0d50cd3d2bb3a004fff135f5955621d01 (patch)
treee3f0db58c5cb78ec92dfaa4cf72945eadd59367a
parentb806c88fab3f9c6833563f9a44b608dd5dd14de9 (diff)
downloadgcc-e4fc59e0d50cd3d2bb3a004fff135f5955621d01.zip
gcc-e4fc59e0d50cd3d2bb3a004fff135f5955621d01.tar.gz
gcc-e4fc59e0d50cd3d2bb3a004fff135f5955621d01.tar.bz2
strub: add note on attribute access
Document why attribute access doesn't need the same treatment as fn spec, and check that the assumption behind it holds. for gcc/ChangeLog * ipa-strub.cc (pass_ipa_strub::execute): Check that we don't add indirection to pointer parameters, and document attribute access non-interactions.
-rw-r--r--gcc/ipa-strub.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc
index 2afb7a4..8ec6824 100644
--- a/gcc/ipa-strub.cc
+++ b/gcc/ipa-strub.cc
@@ -2889,6 +2889,13 @@ pass_ipa_strub::execute (function *)
&& (tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (nparm)))
<= 4 * UNITS_PER_WORD))))
{
+ /* No point in indirecting pointer types. Presumably they
+ won't ever pass the size-based test above, but check the
+ assumption here, because getting this wrong would mess
+ with attribute access and possibly others. We deal with
+ fn spec below. */
+ gcc_checking_assert (!POINTER_TYPE_P (TREE_TYPE (nparm)));
+
indirect_nparms.add (nparm);
/* ??? Is there any case in which it is not safe to suggest the parms
@@ -2976,7 +2983,9 @@ pass_ipa_strub::execute (function *)
}
}
- /* ??? Maybe we could adjust it instead. */
+ /* ??? Maybe we could adjust it instead. Note we don't need
+ to mess with attribute access: pointer-typed parameters are
+ not modified, so they can remain unchanged. */
if (drop_fnspec)
remove_named_attribute_unsharing ("fn spec",
&TYPE_ATTRIBUTES (nftype));