On Wed, Jul 22, 2026 at 01:41:31PM +0000, Karl Meakin via Sourceware Forge 
wrote:
> From: Karl Meakin <[email protected]>
> 
> Make `aarch64_update_ipa_fn_target_info` more conservative, by setting
> the `AARCH64_IPA_SM_FIXED` bit by default. The bit will only be unset if
> the function is annotated with `[[arm::streaming_compatible]]`. This
> matches the ACLE's specification which states that functions are by
> default non-streaming.
> 
> This fixes PR 126133 by causing inlining to fail, even with
> `[[gnu::always_inline]]`, because the target features do not match.
> 
> gcc/ChangeLog:
> 
>       * config/aarch64/aarch64.cc (aarch64_update_ipa_fn_target_info):
>       set the `AARCH64_IPA_SM_FIXED` bit unless the function is
>       annotated with `[[arm::streaming_compatible]]`.
> 
> gcc/testsuite/ChangeLog:
> 
>       * gcc.target/aarch64/pr126133-1.c: New test.
>       * gcc.target/aarch64/pr126133-2.c: New test.
>       * gcc.target/aarch64/pr126133-3.c: New test.
> ---
>  gcc/config/aarch64/aarch64.cc                 | 15 ++++++-------
>  gcc/testsuite/gcc.target/aarch64/pr126133-1.c | 19 +++++++++++++++++
>  gcc/testsuite/gcc.target/aarch64/pr126133-2.c | 21 +++++++++++++++++++
>  gcc/testsuite/gcc.target/aarch64/pr126133-3.c | 19 +++++++++++++++++
>  4 files changed, 65 insertions(+), 9 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/aarch64/pr126133-1.c
>  create mode 100644 gcc/testsuite/gcc.target/aarch64/pr126133-2.c
>  create mode 100644 gcc/testsuite/gcc.target/aarch64/pr126133-3.c
> 
> diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
> index 61562c94a553..d4ed42ce73e1 100644
> --- a/gcc/config/aarch64/aarch64.cc
> +++ b/gcc/config/aarch64/aarch64.cc
> @@ -22185,15 +22185,12 @@ aarch64_update_ipa_fn_target_info (unsigned int 
> &info, const gimple *stmt)
>      }
>    if (auto *call = dyn_cast<const gcall *> (stmt))
>      {
> -      if (gimple_call_builtin_p (call, BUILT_IN_MD))
> -     {
> -       /* The attributes on AArch64 builtins are supposed to be accurate.
> -          If the function isn't marked streaming-compatible then it
> -          needs whichever SM mode it selects.  */
> -       tree decl = gimple_call_fndecl (call);
> -       if (aarch64_fndecl_pstate_sm (decl) != 0)
> -         info |= AARCH64_IPA_SM_FIXED;
> -     }
> +      /* Assume functions are non-streaming by default.
> +     They are only streaming or streaming-compatible if they have the
> +     corresponding attribute.  */
> +      tree decl = gimple_call_fndecl (call);
> +      if (!decl || aarch64_fndecl_pstate_sm (decl) != 0)
> +     info |= AARCH64_IPA_SM_FIXED;
>      }
>    return true;
>  }

This change doesn't go far enough.  I have proposed a more comprehensive fix -
see https://gcc.gnu.org/pipermail/gcc-patches/2026-August/728155.html.

Alice

Reply via email to