public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, Pointer Bounds Checker 24/x] PRE
@ 2014-06-03  7:13 Ilya Enkovich
  2014-06-03  9:33 ` Richard Biener
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Enkovich @ 2014-06-03  7:13 UTC (permalink / raw)
  To: gcc-patches

Hi,

This patch preserves CALL_WITH_BOUNDS flag for calls during PRE.

Bootstrapped and tested on linux-x86_64.

Thanks,
Ilya
--
gcc/

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

	* 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);
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, Pointer Bounds Checker 24/x] PRE
  2014-06-03  7:13 [PATCH, Pointer Bounds Checker 24/x] PRE Ilya Enkovich
@ 2014-06-03  9:33 ` Richard Biener
  2014-08-18 13:02   ` Ilya Enkovich
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Biener @ 2014-06-03  9:33 UTC (permalink / raw)
  To: Ilya Enkovich; +Cc: GCC Patches

On Tue, Jun 3, 2014 at 9:13 AM, Ilya Enkovich <enkovich.gnu@gmail.com> 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  <ilya.enkovich@intel.com>
>
>         * 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);
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, Pointer Bounds Checker 24/x] PRE
  2014-06-03  9:33 ` Richard Biener
@ 2014-08-18 13:02   ` Ilya Enkovich
  2014-09-03 19:25     ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Enkovich @ 2014-08-18 13:02 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches

On 03 Jun 11:33, Richard Biener wrote:
> On Tue, Jun 3, 2014 at 9:13 AM, Ilya Enkovich <enkovich.gnu@gmail.com> 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  <ilya.enkovich@intel.com>

	* 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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, Pointer Bounds Checker 24/x] PRE
  2014-08-18 13:02   ` Ilya Enkovich
@ 2014-09-03 19:25     ` Jeff Law
  2014-09-15  8:01       ` Ilya Enkovich
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Law @ 2014-09-03 19:25 UTC (permalink / raw)
  To: Ilya Enkovich, Richard Biener; +Cc: GCC Patches

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 <enkovich.gnu@gmail.com> 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  <ilya.enkovich@intel.com>
>
> 	* 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH, Pointer Bounds Checker 24/x] PRE
  2014-09-03 19:25     ` Jeff Law
@ 2014-09-15  8:01       ` Ilya Enkovich
  0 siblings, 0 replies; 5+ messages in thread
From: Ilya Enkovich @ 2014-09-15  8:01 UTC (permalink / raw)
  To: Jeff Law; +Cc: Richard Biener, GCC Patches

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 <enkovich.gnu@gmail.com> 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  <ilya.enkovich@intel.com>
> >
> >	* 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  <ilya.enkovich@intel.com>

	* 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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-15  8:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-03  7:13 [PATCH, Pointer Bounds Checker 24/x] PRE Ilya Enkovich
2014-06-03  9:33 ` Richard Biener
2014-08-18 13:02   ` Ilya Enkovich
2014-09-03 19:25     ` Jeff Law
2014-09-15  8:01       ` Ilya Enkovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).