diff mbox

[Pointer,Bounds,Checker,26/x] CCP

Message ID 20140606070235.GC65215@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich June 6, 2014, 7:02 a.m. UTC
On 03 Jun 11:54, Richard Biener wrote:
> On Tue, Jun 3, 2014 at 9:38 AM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> > Hi,
> >
> > This patch allows BUILT_IN_CHKP_BNDRET as a consumer of a result of BUILT_IN_STACK_SAVE call.
> >
> > Bootstrapped and tested on linux-x86_64.
> >
> > Thanks,
> > Ilya
> > --
> > gcc/
> >
> > 2014-06-03  Ilya Enkovich  <ilya.enkovich@intel.com>
> >
> >         * tree-ssa-ccp.c (insert_clobber_before_stack_restore): Handle
> >         BUILT_IN_CHKP_BNDRET calls.
> >
> >
> > diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
> > index eeefeaf..c138337 100644
> > --- a/gcc/tree-ssa-ccp.c
> > +++ b/gcc/tree-ssa-ccp.c
> > @@ -1848,7 +1848,7 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
> >                                      gimple_htab *visited)
> >  {
> >    gimple stmt, clobber_stmt;
> > -  tree clobber;
> > +  tree clobber, fndecl;
> >    imm_use_iterator iter;
> >    gimple_stmt_iterator i;
> >    gimple *slot;
> > @@ -1880,6 +1880,10 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
> >      else if (gimple_assign_ssa_name_copy_p (stmt))
> >        insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var,
> >                                            visited);
> > +    else if (gimple_code (stmt) == GIMPLE_CALL
> > +            && (fndecl = targetm.builtin_chkp_function (BUILT_IN_CHKP_BNDRET))
> > +            && gimple_call_fndecl (stmt) == fndecl)
> > +      continue;
> 
> Please change this to use the proper abstraction once implemented.  It should
> be sth like
> 
>     else if (is_gimple_call (stmt)
>                && gimple_call_builtin_p (stmt, BUILT_IN_CHKP_BNDRET))
>        continue;
> 
> I assume now that the builtins are not target builtins but added to
> builtins.def.
> 
> Richard.
> 
> >      else
> >        gcc_assert (is_gimple_debug (stmt));
> >  }

Here is a fixed version with proper predicate.

Bootstrapped and tested on linux_x86-64.

Thanks,
Ilya
--
gcc/

2014-06-05  Ilya Enkovich  <ilya.enkovich@intel.com>

	* tree-ssa-ccp.c: Include tree-chkp.h.
	(insert_clobber_before_stack_restore): Handle
	BUILT_IN_CHKP_BNDRET calls.

Comments

Ilya Enkovich Sept. 15, 2014, 7:20 a.m. UTC | #1
Ping

2014-06-06 11:02 GMT+04:00 Ilya Enkovich <enkovich.gnu@gmail.com>:
> On 03 Jun 11:54, Richard Biener wrote:
>> On Tue, Jun 3, 2014 at 9:38 AM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
>> > Hi,
>> >
>> > This patch allows BUILT_IN_CHKP_BNDRET as a consumer of a result of BUILT_IN_STACK_SAVE call.
>> >
>> > Bootstrapped and tested on linux-x86_64.
>> >
>> > Thanks,
>> > Ilya
>> > --
>> > gcc/
>> >
>> > 2014-06-03  Ilya Enkovich  <ilya.enkovich@intel.com>
>> >
>> >         * tree-ssa-ccp.c (insert_clobber_before_stack_restore): Handle
>> >         BUILT_IN_CHKP_BNDRET calls.
>> >
>> >
>> > diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
>> > index eeefeaf..c138337 100644
>> > --- a/gcc/tree-ssa-ccp.c
>> > +++ b/gcc/tree-ssa-ccp.c
>> > @@ -1848,7 +1848,7 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
>> >                                      gimple_htab *visited)
>> >  {
>> >    gimple stmt, clobber_stmt;
>> > -  tree clobber;
>> > +  tree clobber, fndecl;
>> >    imm_use_iterator iter;
>> >    gimple_stmt_iterator i;
>> >    gimple *slot;
>> > @@ -1880,6 +1880,10 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
>> >      else if (gimple_assign_ssa_name_copy_p (stmt))
>> >        insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var,
>> >                                            visited);
>> > +    else if (gimple_code (stmt) == GIMPLE_CALL
>> > +            && (fndecl = targetm.builtin_chkp_function (BUILT_IN_CHKP_BNDRET))
>> > +            && gimple_call_fndecl (stmt) == fndecl)
>> > +      continue;
>>
>> Please change this to use the proper abstraction once implemented.  It should
>> be sth like
>>
>>     else if (is_gimple_call (stmt)
>>                && gimple_call_builtin_p (stmt, BUILT_IN_CHKP_BNDRET))
>>        continue;
>>
>> I assume now that the builtins are not target builtins but added to
>> builtins.def.
>>
>> Richard.
>>
>> >      else
>> >        gcc_assert (is_gimple_debug (stmt));
>> >  }
>
> Here is a fixed version with proper predicate.
>
> Bootstrapped and tested on linux_x86-64.
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2014-06-05  Ilya Enkovich  <ilya.enkovich@intel.com>
>
>         * tree-ssa-ccp.c: Include tree-chkp.h.
>         (insert_clobber_before_stack_restore): Handle
>         BUILT_IN_CHKP_BNDRET calls.
>
>
> diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
> index eeefeaf..e99bcf5 100644
> --- a/gcc/tree-ssa-ccp.c
> +++ b/gcc/tree-ssa-ccp.c
> @@ -144,6 +144,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "diagnostic-core.h"
>  #include "dbgcnt.h"
>  #include "params.h"
> +#include "tree-chkp.h"
>
>
>  /* Possible lattice values.  */
> @@ -1880,6 +1881,9 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
>      else if (gimple_assign_ssa_name_copy_p (stmt))
>        insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var,
>                                            visited);
> +    else if (gimple_code (stmt) == GIMPLE_CALL
> +            && chkp_gimple_call_builtin_p (stmt, BUILT_IN_CHKP_BNDRET))
> +      continue;
>      else
>        gcc_assert (is_gimple_debug (stmt));
>  }
Jeff Law Sept. 15, 2014, 3:20 p.m. UTC | #2
On 09/15/14 01:20, Ilya Enkovich wrote:

>>
>> 2014-06-05  Ilya Enkovich  <ilya.enkovich@intel.com>
>>
>>          * tree-ssa-ccp.c: Include tree-chkp.h.
>>          (insert_clobber_before_stack_restore): Handle
>>          BUILT_IN_CHKP_BNDRET calls.
>>
>>
>> diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
>> index eeefeaf..e99bcf5 100644
>> --- a/gcc/tree-ssa-ccp.c
>> +++ b/gcc/tree-ssa-ccp.c
>> @@ -144,6 +144,7 @@ along with GCC; see the file COPYING3.  If not see
>>   #include "diagnostic-core.h"
>>   #include "dbgcnt.h"
>>   #include "params.h"
>> +#include "tree-chkp.h"
>>
>>
>>   /* Possible lattice values.  */
>> @@ -1880,6 +1881,9 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
>>       else if (gimple_assign_ssa_name_copy_p (stmt))
>>         insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var,
>>                                             visited);
>> +    else if (gimple_code (stmt) == GIMPLE_CALL
>> +            && chkp_gimple_call_builtin_p (stmt, BUILT_IN_CHKP_BNDRET))
>> +      continue;
>>       else
>>         gcc_assert (is_gimple_debug (stmt));
I think Richi also wanted the

gimple_code (stmt) == GIMPLE_CALL

Turned into:

is_gimple_call (stmt)


Presumably using chkp_gimple_call_builtin_p rather than 
gimple_call_builtin_p is related to using different codes for the 
instrumented builtin calls?  Otherwise why use 
chkp_gimple_call_builtin_p rather than gimple_call_builtin_p?


jeff
diff mbox

Patch

diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index eeefeaf..e99bcf5 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -144,6 +144,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "diagnostic-core.h"
 #include "dbgcnt.h"
 #include "params.h"
+#include "tree-chkp.h"
 
 
 /* Possible lattice values.  */
@@ -1880,6 +1881,9 @@  insert_clobber_before_stack_restore (tree saved_val, tree var,
     else if (gimple_assign_ssa_name_copy_p (stmt))
       insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var,
 					   visited);
+    else if (gimple_code (stmt) == GIMPLE_CALL
+	     && chkp_gimple_call_builtin_p (stmt, BUILT_IN_CHKP_BNDRET))
+      continue;
     else
       gcc_assert (is_gimple_debug (stmt));
 }