[PATCH, Pointer Bounds Checker 26/x] CCP

Ilya Enkovich enkovich.gnu@gmail.com
Mon Sep 15 15:58:00 GMT 2014


On 15 Sep 09:20, Jeff Law wrote:
> 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
> 

The reason is that target may provide own version of builtin (and currently does it) for instrumentation.  Therefore we should obtain fndecl from target and then compare.  That is what chkp_gimple_call_builtin_p does.  I just moved gimple code check into chkp_gimple_call_builtin_p to make similar to gimple_call_builtin_p.

Thanks,
Ilya
--
2014-09-15  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 a90f708..7c73c23 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -155,6 +155,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "params.h"
 #include "wide-int-print.h"
 #include "builtins.h"
+#include "tree-chkp.h"
 
 
 /* Possible lattice values.  */
@@ -1938,6 +1939,8 @@ 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 (chkp_gimple_call_builtin_p (stmt, BUILT_IN_CHKP_BNDRET))
+      continue;
     else
       gcc_assert (is_gimple_debug (stmt));
 }



More information about the Gcc-patches mailing list