diff mbox series

aarch64: Use is_attribute_namespace_p and get_attribute_name inside aarch64_lookup_shared_state_flags [PR116598]

Message ID 20240905051010.3490388-1-quic_apinski@quicinc.com
State New
Headers show
Series aarch64: Use is_attribute_namespace_p and get_attribute_name inside aarch64_lookup_shared_state_flags [PR116598] | expand

Commit Message

Andrew Pinski Sept. 5, 2024, 5:10 a.m. UTC
The code in aarch64_lookup_shared_state_flags all C++11 attributes on the function type
had a namespace associated with them. But with the addition of reproducible/unsequenced,
this is not true.

This fixes the issue by using is_attribute_namespace_p instead of manually figuring out
the namespace is named "arm" and uses get_attribute_name instead of manually grabbing
the attribute name.

Built and tested for aarch64-linux-gnu.

gcc/ChangeLog:

	PR target/116598
	* config/aarch64/aarch64.cc (aarch64_lookup_shared_state_flags): Use
	is_attribute_namespace_p and get_attribute_name instead of manually grabbing
	the namespace and name of the attribute.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
 gcc/config/aarch64/aarch64.cc | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Richard Sandiford Sept. 6, 2024, 12:09 p.m. UTC | #1
Andrew Pinski <quic_apinski@quicinc.com> writes:
> The code in aarch64_lookup_shared_state_flags all C++11 attributes on the function type
> had a namespace associated with them. But with the addition of reproducible/unsequenced,
> this is not true.
>
> This fixes the issue by using is_attribute_namespace_p instead of manually figuring out
> the namespace is named "arm" and uses get_attribute_name instead of manually grabbing
> the attribute name.
>
> Built and tested for aarch64-linux-gnu.
>
> gcc/ChangeLog:
>
> 	PR target/116598
> 	* config/aarch64/aarch64.cc (aarch64_lookup_shared_state_flags): Use
> 	is_attribute_namespace_p and get_attribute_name instead of manually grabbing
> 	the namespace and name of the attribute.

OK, thanks.

Richard

> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
>  gcc/config/aarch64/aarch64.cc | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
> index 27e24ba70ab..6a3f1a23a9f 100644
> --- a/gcc/config/aarch64/aarch64.cc
> +++ b/gcc/config/aarch64/aarch64.cc
> @@ -594,14 +594,10 @@ aarch64_lookup_shared_state_flags (tree attrs, const char *state_name)
>  {
>    for (tree attr = attrs; attr; attr = TREE_CHAIN (attr))
>      {
> -      if (!cxx11_attribute_p (attr))
> +      if (!is_attribute_namespace_p ("arm", attr))
>  	continue;
>  
> -      auto ns = IDENTIFIER_POINTER (TREE_PURPOSE (TREE_PURPOSE (attr)));
> -      if (strcmp (ns, "arm") != 0)
> -	continue;
> -
> -      auto attr_name = IDENTIFIER_POINTER (TREE_VALUE (TREE_PURPOSE (attr)));
> +      auto attr_name = IDENTIFIER_POINTER (get_attribute_name (attr));
>        auto flags = aarch64_attribute_shared_state_flags (attr_name);
>        if (!flags)
>  	continue;
diff mbox series

Patch

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 27e24ba70ab..6a3f1a23a9f 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -594,14 +594,10 @@  aarch64_lookup_shared_state_flags (tree attrs, const char *state_name)
 {
   for (tree attr = attrs; attr; attr = TREE_CHAIN (attr))
     {
-      if (!cxx11_attribute_p (attr))
+      if (!is_attribute_namespace_p ("arm", attr))
 	continue;
 
-      auto ns = IDENTIFIER_POINTER (TREE_PURPOSE (TREE_PURPOSE (attr)));
-      if (strcmp (ns, "arm") != 0)
-	continue;
-
-      auto attr_name = IDENTIFIER_POINTER (TREE_VALUE (TREE_PURPOSE (attr)));
+      auto attr_name = IDENTIFIER_POINTER (get_attribute_name (attr));
       auto flags = aarch64_attribute_shared_state_flags (attr_name);
       if (!flags)
 	continue;