On Wed, Oct 21, 2015 at 03:00:47PM -0400, Nathan Sidwell wrote:
> To distinguish different uses of the UNIQUE function, I use the first
> argument, which is expected to be an INTEGER_CST.  I figured this better
> than using multiple new internal fns, all with the unique property, as the
> latter would need (at least) a range check in gimple_call_internal_unique_p
> rather than a simple equality.
> 
> Jakub, IYR I originally had IFN_FORK and IFN_JOIN as such distinct internal
> fns.  This replaces that scheme.
> 
> ok?
> 
> nathan

> 2015-10-20  Nathan Sidwell  <nat...@codesourcery.com>
>           Cesar Philippidis  <ce...@codesourcery.com>
>       
>       * internal-fn.c (expand_UNIQUE): New.
>       * internal-fn.def (IFN_UNIQUE): New.
>       (IFN_UNIQUE_UNSPEC): Define.
>       * gimple.h (gimple_call_internal_unique_p): New.
>       * gimple.c (gimple_call_same_target_p): Check internal fn
>       uniqueness.
>       * tracer.c (ignore_bb_p): Check for IFN_UNIQUE call.
>       * tree-ssa-threadedge.c
>       (record_temporary_equivalences_from_stmts): Likewise.

This is generally fine with me, but please work with Richi to find
something acceptable to him too.

> +DEF_INTERNAL_FN (UNIQUE, ECF_NOTHROW | ECF_LEAF, NULL)

Are you sure about the ECF_LEAF?  I mean, while the function can't
call back to your code, I'd expect you want it as kind of strong
optimization barrier too.

> +#define IFN_UNIQUE_UNSPEC 0  /* Undifferentiated UNIQUE.  */
> Index: tracer.c
> ===================================================================
> --- tracer.c  (revision 229096)
> +++ tracer.c  (working copy)
> @@ -93,6 +93,7 @@ bb_seen_p (basic_block bb)
>  static bool
>  ignore_bb_p (const_basic_block bb)
>  {
> +  gimple_stmt_iterator gsi;
>    gimple *g;
>  
>    if (bb->index < NUM_FIXED_BLOCKS)
> @@ -106,6 +107,17 @@ ignore_bb_p (const_basic_block bb)
>    if (g && gimple_code (g) == GIMPLE_TRANSACTION)
>      return true;
>  
> +  /* Ignore blocks containing non-clonable function calls.  */
> +  for (gsi = gsi_start_bb (CONST_CAST_BB (bb));
> +       !gsi_end_p (gsi); gsi_next (&gsi))
> +    {
> +      g = gsi_stmt (gsi);
> +
> +      if (is_gimple_call (g) && gimple_call_internal_p (g)
> +       && gimple_call_internal_unique_p (as_a <gcall *> (g)))
> +     return true;
> +    }

Do you have to scan the whole bb?  E.g. don't or should not those
unique IFNs force end of bb?

        Jakub

Reply via email to