On Wed, 6 Apr 2022, Jakub Jelinek wrote:

> On Wed, Apr 06, 2022 at 09:41:44AM +0100, Richard Sandiford wrote:
> > But it seems like the magic incantation to detect “real” built-in
> > function calls is getting longer and longer.  Can we not abstract this
> > in a single place rather than have to repeat the same long sequence in
> > multiple places?
> 
> I've already committed it, so it can be only dealt with an incremental
> patch.
> One possibility is to do it inside of
> gimple_builtin_call_types_compatible_p, after the assert do that:
>   if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
>     if (tree decl = builtin_decl_explicit (DECL_FUNCTION_CODE (fndecl)))
>       fndecl = decl;
> but we then lose the theoretical possibility of comparing against the
> actual user declaration.  Though I guess in the
> gimple-fold.cc
> gimple-low.cc
> gimple-match-head.cc
> calls to that function we also want this rather than what they do currently.

Yes, I think it would be clearer to pass a BUILT_IN_* code to
gimple_builtin_call_types_compatible_p and no decl and simply return
false if we cannot get out hands at the "proper" decl from
builtin_decl_explicit ...

Richard.

Reply via email to