[PATCH, Pointer Bounds Checker 22/x] Inline

Ilya Enkovich enkovich.gnu@gmail.com
Wed Sep 24 07:28:00 GMT 2014

2014-09-23 23:55 GMT+04:00 Jeff Law <law@redhat.com>:
> On 08/18/14 09:35, Ilya Enkovich wrote:
>> Here is an updated version.
>> Thanks,
>> Ilya
>> --
>> 2014-08-15  Ilya Enkovich  <ilya.enkovich@intel.com>
>>         * ipa-inline.c (early_inliner): Check edge has summary allocated.
>>         * tree-inline.c: Include tree-chkp.h.
>>         (declare_return_variable): Add arg holding
>>         returned bounds slot.  Create and initialize returned bounds var.
>>         (remap_gimple_stmt): Handle returned bounds.
>>         Return sequence of statements instead of a single statement.
>>         (insert_init_stmt): Add declaration.
>>         (remap_gimple_seq): Adjust to new remap_gimple_stmt signature.
>>         (copy_bb): Adjust to changed return type of remap_gimple_stmt.
>>         (expand_call_inline): Handle returned bounds.  Add bounds copy
>>         for generated mem to mem assignments.
>>         * tree-inline.h (copy_body_data): Add fields retbnd and
>>         assign_stmts.
>>         * cgraph.c: Include tree-chkp.h.
>>         (cgraph_redirect_edge_call_stmt_to_callee): Support
>>         returned bounds.
>>         * value-prof.c: Include tree-chkp.h.
>>         (gimple_ic): Support returned bounds.
> OK for the trunk.
> FWIW, when building up gimple (or RTL if you were ever to do that one day),
> it's sometimes helpful to the reviewer to show what you're doing.  For
> example, it took me a bit of time to realize that you needed the output from
> the direct call as an argument to the duplicated RETBND statement.  It
> looked for quite a while like you'd simply made a mistake.

Got it.  Will try to give more useful descriptions for my patches in the future.

> I'm a bit curious why you removed the original RETBND statement in
> value-prof, only to reinsert it.  Is there some reason you needed to do
> that?

After call transformation we have smth like that:

if (<confition>)
  new_lhs = direct_call (...);
  old_lhs = call (...);
old_bnd = __builtin_retbnd (old_lhs);

Original retbnd statement removal + reinsertion is used to transform it into:

if (<confition>)
  new_lhs = direct_call (...);
  old_lhs = call (...);
  old_bnd = __builtin_retbnd (old_lhs);

The rest of code inserts bounds for new_lhs and creates phi node for
bounds similar to what is done for call return value.


> Richi -- in response to your comment about working around a bug earlier in
> this thread.  As Ilya mentioned, he just cloned existing practice in that
> code for creating the copy of the call.
> Jeff

More information about the Gcc-patches mailing list