Hi,

On Mon, Sep 21 2026, Josef Melcr wrote:
> Currently, assume bodies are created with attributes preventing IPA
> optimizations, even if the function from which they were outlined don't
> have them.  In order to make IPA for assume bodies possible, this patch
> changes said behavior to make assumes inherit attributes from the
> function from which they were outlined.  This means that the assume body
> will have the IPA-preventing attribute only if the function which
> spawned it has it.
>
> gcc/ChangeLog:
>
>       * gimple-low.cc (create_assumption_fn): Don't add attributes
>       disabling optimizations.

Have you bootstrapped and tested this patch independently?  If so, this
is OK.

Martin


>
> Signed-off-by: Josef Melcr <[email protected]>
> ---
>  gcc/gimple-low.cc | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/gcc/gimple-low.cc b/gcc/gimple-low.cc
> index 8d9ffd24124..6f0f5bedd02 100644
> --- a/gcc/gimple-low.cc
> +++ b/gcc/gimple-low.cc
> @@ -302,18 +302,7 @@ create_assumption_fn (location_t loc)
>    DECL_EXTERNAL (decl) = 0;
>    DECL_CONTEXT (decl) = NULL_TREE;
>    DECL_INITIAL (decl) = make_node (BLOCK);
> -  tree attributes = DECL_ATTRIBUTES (current_function_decl);
> -  if (lookup_attribute ("noipa", attributes) == NULL)
> -    {
> -      attributes = tree_cons (get_identifier ("noipa"), NULL, attributes);
> -      if (lookup_attribute ("noinline", attributes) == NULL)
> -     attributes = tree_cons (get_identifier ("noinline"), NULL, attributes);
> -      if (lookup_attribute ("noclone", attributes) == NULL)
> -     attributes = tree_cons (get_identifier ("noclone"), NULL, attributes);
> -      if (lookup_attribute ("no_icf", attributes) == NULL)
> -     attributes = tree_cons (get_identifier ("no_icf"), NULL, attributes);
> -    }
> -  DECL_ATTRIBUTES (decl) = attributes;
> +  DECL_ATTRIBUTES (decl) = DECL_ATTRIBUTES (current_function_decl);
>    BLOCK_SUPERCONTEXT (DECL_INITIAL (decl)) = decl;
>    DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl)
>      = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (current_function_decl);
> -- 
> 2.55.0

Reply via email to