Re: [PATCH, Pointer Bounds Checker 24/x] PRE

2014-09-15 Thread Ilya Enkovich
On 03 Sep 13:25, Jeff Law wrote:
> On 08/18/14 07:02, Ilya Enkovich wrote:
> >On 03 Jun 11:33, Richard Biener wrote:
> >>On Tue, Jun 3, 2014 at 9:13 AM, Ilya Enkovich  
> >>wrote:
> >>>Hi,
> >>>
> >>>This patch preserves CALL_WITH_BOUNDS flag for calls during PRE.
> >>
> >>Ok.
> >>
> >>Richard.
> >>
> >
> >Merging with the trunk I found that op2 field of vn_reference_op_struct is 
> >now used to pass EH context for calls and there is no more free field to 
> >store with_bounds flag.  So I added one.  Does it look OK?
> >
> >
> >Thanks,
> >Ilya
> >--
> >2014-08-14  Ilya Enkovich  
> >
> > * tree-ssa-sccvn.h (vn_reference_op_struct): Transform opcode
> > into bit field and add with_bounds field.
> > * tree-ssa-sccvn.c (copy_reference_ops_from_call): Set
> > with_bounds field for instrumented calls.
> > * tree-ssa-pre.c (create_component_ref_by_pieces_1): Restore
> > CALL_WITH_BOUNDS_P flag for calls.
> For consistency, make the bitfield 16 bits (see ipa-inline.h,
> tree-core.h and tree-ssa-sccvn.h.
> 
> OK with that change.
> 
> jeff
> 

Thanks for your comments!  Below is a fixed version.

Ilya
--

2014-09-15  Ilya Enkovich  

* tree-ssa-sccvn.h (vn_reference_op_struct): Transform opcode
into bit field and add with_bounds field.
* tree-ssa-sccvn.c (copy_reference_ops_from_call): Set
with_bounds field for instrumented calls.
* tree-ssa-pre.c (create_component_ref_by_pieces_1): Restore
CALL_WITH_BOUNDS_P flag for calls.


diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 8b4d2ba..8d286c9 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2581,6 +2581,8 @@ create_component_ref_by_pieces_1 (basic_block block, 
vn_reference_t ref,
   (TREE_CODE (fn) == FUNCTION_DECL
? build_fold_addr_expr (fn) : fn),
   nargs, args);
+   if (currop->with_bounds)
+ CALL_WITH_BOUNDS_P (folded) = true;
free (args);
if (sc)
  CALL_EXPR_STATIC_CHAIN (folded) = sc;
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index ec0bf6b..c6f749d 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1149,6 +1149,8 @@ copy_reference_ops_from_call (gimple call,
   if (stmt_could_throw_p (call) && (lr = lookup_stmt_eh_lp (call)) > 0)
 temp.op2 = size_int (lr);
   temp.off = -1;
+  if (gimple_call_with_bounds_p (call))
+temp.with_bounds = 1;
   result->safe_push (temp);
 
   /* Copy the call arguments.  As they can be references as well,
diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h
index 84ea278..5608e3a 100644
--- a/gcc/tree-ssa-sccvn.h
+++ b/gcc/tree-ssa-sccvn.h
@@ -80,7 +80,9 @@ typedef const struct vn_phi_s *const_vn_phi_t;
 
 typedef struct vn_reference_op_struct
 {
-  enum tree_code opcode;
+  ENUM_BITFIELD(tree_code) opcode : 16;
+  /* 1 for instrumented calls.  */
+  unsigned with_bounds : 1;
   /* Constant offset this op adds or -1 if it is variable.  */
   HOST_WIDE_INT off;
   tree type;


Re: [PATCH, Pointer Bounds Checker 24/x] PRE

2014-09-03 Thread Jeff Law

On 08/18/14 07:02, Ilya Enkovich wrote:

On 03 Jun 11:33, Richard Biener wrote:

On Tue, Jun 3, 2014 at 9:13 AM, Ilya Enkovich  wrote:

Hi,

This patch preserves CALL_WITH_BOUNDS flag for calls during PRE.


Ok.

Richard.



Merging with the trunk I found that op2 field of vn_reference_op_struct is now 
used to pass EH context for calls and there is no more free field to store 
with_bounds flag.  So I added one.  Does it look OK?


Thanks,
Ilya
--
2014-08-14  Ilya Enkovich  

* tree-ssa-sccvn.h (vn_reference_op_struct): Transform opcode
into bit field and add with_bounds field.
* tree-ssa-sccvn.c (copy_reference_ops_from_call): Set
with_bounds field for instrumented calls.
* tree-ssa-pre.c (create_component_ref_by_pieces_1): Restore
CALL_WITH_BOUNDS_P flag for calls.
For consistency, make the bitfield 16 bits (see ipa-inline.h, 
tree-core.h and tree-ssa-sccvn.h.


OK with that change.

jeff



Re: [PATCH, Pointer Bounds Checker 24/x] PRE

2014-08-18 Thread Ilya Enkovich
On 03 Jun 11:33, Richard Biener wrote:
> On Tue, Jun 3, 2014 at 9:13 AM, Ilya Enkovich  wrote:
> > Hi,
> >
> > This patch preserves CALL_WITH_BOUNDS flag for calls during PRE.
> 
> Ok.
> 
> Richard.
> 

Merging with the trunk I found that op2 field of vn_reference_op_struct is now 
used to pass EH context for calls and there is no more free field to store 
with_bounds flag.  So I added one.  Does it look OK?


Thanks,
Ilya
--
2014-08-14  Ilya Enkovich  

* tree-ssa-sccvn.h (vn_reference_op_struct): Transform opcode
into bit field and add with_bounds field.
* tree-ssa-sccvn.c (copy_reference_ops_from_call): Set
with_bounds field for instrumented calls.
* tree-ssa-pre.c (create_component_ref_by_pieces_1): Restore
CALL_WITH_BOUNDS_P flag for calls.


diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 8b4d2ba..8d286c9 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -2581,6 +2581,8 @@ create_component_ref_by_pieces_1 (basic_block block, 
vn_reference_t ref,
   (TREE_CODE (fn) == FUNCTION_DECL
? build_fold_addr_expr (fn) : fn),
   nargs, args);
+   if (currop->with_bounds)
+ CALL_WITH_BOUNDS_P (folded) = true;
free (args);
if (sc)
  CALL_EXPR_STATIC_CHAIN (folded) = sc;
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index ec0bf6b..c6f749d 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1149,6 +1149,8 @@ copy_reference_ops_from_call (gimple call,
   if (stmt_could_throw_p (call) && (lr = lookup_stmt_eh_lp (call)) > 0)
 temp.op2 = size_int (lr);
   temp.off = -1;
+  if (gimple_call_with_bounds_p (call))
+temp.with_bounds = 1;
   result->safe_push (temp);
 
   /* Copy the call arguments.  As they can be references as well,
diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h
index 84ea278..743bc0e 100644
--- a/gcc/tree-ssa-sccvn.h
+++ b/gcc/tree-ssa-sccvn.h
@@ -80,7 +80,9 @@ typedef const struct vn_phi_s *const_vn_phi_t;
 
 typedef struct vn_reference_op_struct
 {
-  enum tree_code opcode;
+  ENUM_BITFIELD(tree_code) opcode : 10;
+  /* 1 for instrumented calls.  */
+  unsigned with_bounds : 1;
   /* Constant offset this op adds or -1 if it is variable.  */
   HOST_WIDE_INT off;
   tree type;


Re: [PATCH, Pointer Bounds Checker 24/x] PRE

2014-06-03 Thread Richard Biener
On Tue, Jun 3, 2014 at 9:13 AM, Ilya Enkovich  wrote:
> Hi,
>
> This patch preserves CALL_WITH_BOUNDS flag for calls during PRE.

Ok.

Richard.

> Bootstrapped and tested on linux-x86_64.
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2014-06-03  Ilya Enkovich  
>
> * tree-ssa-pre.c (create_component_ref_by_pieces_1): Store
> CALL_WITH_BOUNDS_P for calls.
> (copy_reference_ops_from_call): Restore CALL_WITH_BOUNDS_P
> flag.
>
>
> diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
> index 1e55356..d5b9f3b 100644
> --- a/gcc/tree-ssa-pre.c
> +++ b/gcc/tree-ssa-pre.c
> @@ -2579,6 +2579,8 @@ create_component_ref_by_pieces_1 (basic_block block, 
> vn_reference_t ref,
>(TREE_CODE (fn) == FUNCTION_DECL
> ? build_fold_addr_expr (fn) : fn),
>nargs, args);
> +   if (currop->op2 == integer_one_node)
> + CALL_WITH_BOUNDS_P (folded) = true;
> free (args);
> if (sc)
>   CALL_EXPR_STATIC_CHAIN (folded) = sc;
> diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
> index f7ec8b6..e83d9dc 100644
> --- a/gcc/tree-ssa-sccvn.c
> +++ b/gcc/tree-ssa-sccvn.c
> @@ -1124,6 +1124,8 @@ copy_reference_ops_from_call (gimple call,
>temp.opcode = CALL_EXPR;
>temp.op0 = gimple_call_fn (call);
>temp.op1 = gimple_call_chain (call);
> +  if (gimple_call_with_bounds_p (call))
> +temp.op2 = integer_one_node;
>temp.off = -1;
>result->safe_push (temp);
>