On Fri, Jan 14, 2022 at 09:41:35AM +0100, Jan Hubicka via Gcc-patches wrote:
> > > > > > --- a/gcc/ipa-split.c
> > > > > > +++ b/gcc/ipa-split.c
> > > > > > @@ -873,7 +873,7 @@ visit_bb (basic_block bb, basic_block return_bb,
> > > > > >         gimple *stmt = gsi_stmt (bsi);
> > > > > >         tree op;
> > > > > >         ssa_op_iter iter;
> > > > > > -      tree decl;
> > > > > > +      tree decl = NULL_TREE;
> > > > > > 
> > > > > >         if (is_gimple_debug (stmt))
> > > > > >          continue;
> > > > > > @@ -927,6 +927,16 @@ visit_bb (basic_block bb, basic_block 
> > > > > > return_bb,
> Decl is initialized in
>       if (gimple_code (stmt) == GIMPLE_CALL
>           && (decl = gimple_call_fndecl (stmt)) != NULL_TREE
>           && fndecl_built_in_p (decl, BUILT_IN_NORMAL))
> 
> I think this is confusing. I would change it to
>       if (gimple_code (stmt) == GIMPLE_CALL
>           && (decl = gimple_call_fndecl (stmt)) != NULL_TREE
>       {
>           if (fndecl_built_in_p (decl, BUILT_IN_NORMAL))
>           ... existing code ...
>         if (decl && (lookup_attribute ("warning", DECL_ATTRIBUTES (decl))
>                      || lookup_attribute ("error", DECL_ATTRIBUTES (decl))))
>           ... your code ...
>       }
> OK with that change.

Perhaps even
      /* Check builtins that prevent splitting.  */
      if (gimple_code (stmt) == GIMPLE_CALL)
        if (tree decl = gimple_call_fndecl (stmt))
          {
            if (fndecl_built_in_p (decl, BUILT_IN_NORMAL))
              ...
            if (lookup_attribute || lookup_attribute)
              ...
          }
?          

        Jakub

Reply via email to