diff mbox

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

Message ID 20140603073814.GD20877@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich June 3, 2014, 7:38 a.m. UTC
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.

Comments

Richard Biener June 3, 2014, 9:54 a.m. UTC | #1
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));
>  }
diff mbox

Patch

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;
     else
       gcc_assert (is_gimple_debug (stmt));
 }