Patchwork [2/3] if-convert even when the data dependences cannot be computed.

login
register
mail settings
Submitter Sebastian Pop
Date Nov. 3, 2010, 3:52 p.m.
Message ID <1288799546-29668-2-git-send-email-sebpop@gmail.com>
Download mbox | patch
Permalink /patch/70030/
State New
Headers show

Comments

Sebastian Pop - Nov. 3, 2010, 3:52 p.m.
2010-10-20  Sebastian Pop  <sebastian.pop@amd.com>

	* tree-if-conv.c (if_convertible_loop_p_1): Do not call
	compute_data_dependences_for_loop.
	(if_convertible_loop_p): Do not free refs and ddrs.
---
 gcc/ChangeLog      |    6 ++++++
 gcc/tree-if-conv.c |   24 +++---------------------
 2 files changed, 9 insertions(+), 21 deletions(-)
Richard Guenther - Nov. 3, 2010, 8:37 p.m.
On Wed, 3 Nov 2010, Sebastian Pop wrote:

> 2010-10-20  Sebastian Pop  <sebastian.pop@amd.com>
> 
> 	* tree-if-conv.c (if_convertible_loop_p_1): Do not call
> 	compute_data_dependences_for_loop.
> 	(if_convertible_loop_p): Do not free refs and ddrs.

This is ok.  Btw, there are some pending bugs in if-conversion,
one which ICEs on SPEC 2k6 tonto with LTO.  It would be nice
if you can address them.

Thanks,
Richard.

> ---
>  gcc/ChangeLog      |    6 ++++++
>  gcc/tree-if-conv.c |   24 +++---------------------
>  2 files changed, 9 insertions(+), 21 deletions(-)
> 
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index 0f58882..3ceb7b6 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,5 +1,11 @@
>  2010-10-20  Sebastian Pop  <sebastian.pop@amd.com>
>  
> +	* tree-if-conv.c (if_convertible_loop_p_1): Do not call
> +	compute_data_dependences_for_loop.
> +	(if_convertible_loop_p): Do not free refs and ddrs.
> +
> +2010-10-20  Sebastian Pop  <sebastian.pop@amd.com>
> +
>  	PR tree-optimization/46029
>  	* doc/invoke.texi (-ftree-loop-if-convert-stores): Update description.
>  	* tree-if-conv.c (has_unaligned_memory_refs): New.
> diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
> index 9fc6190..5b941af 100644
> --- a/gcc/tree-if-conv.c
> +++ b/gcc/tree-if-conv.c
> @@ -855,24 +855,15 @@ predicate_bbs (loop_p loop)
>  }
>  
>  /* Return true when LOOP is if-convertible.  This is a helper function
> -   for if_convertible_loop_p.  REFS and DDRS are initialized and freed
> -   in if_convertible_loop_p.  */
> +   for if_convertible_loop_p.  */
>  
>  static bool
> -if_convertible_loop_p_1 (struct loop *loop,
> -			 VEC (data_reference_p, heap) **refs,
> -			 VEC (ddr_p, heap) **ddrs)
> +if_convertible_loop_p_1 (struct loop *loop)
>  {
>    bool res;
>    unsigned int i;
>    basic_block exit_bb = NULL;
>  
> -  /* Don't if-convert the loop when the data dependences cannot be
> -     computed: the loop won't be vectorized in that case.  */
> -  res = compute_data_dependences_for_loop (loop, true, refs, ddrs);
> -  if (!res)
> -    return false;
> -
>    calculate_dominance_info (CDI_DOMINATORS);
>  
>    /* Allow statements that can be handled during if-conversion.  */
> @@ -934,9 +925,6 @@ if_convertible_loop_p (struct loop *loop)
>  {
>    edge e;
>    edge_iterator ei;
> -  bool res = false;
> -  VEC (data_reference_p, heap) *refs;
> -  VEC (ddr_p, heap) *ddrs;
>  
>    /* Handle only innermost loop.  */
>    if (!loop || loop->inner)
> @@ -968,13 +956,7 @@ if_convertible_loop_p (struct loop *loop)
>      if (loop_exit_edge_p (loop, e))
>        return false;
>  
> -  refs = VEC_alloc (data_reference_p, heap, 5);
> -  ddrs = VEC_alloc (ddr_p, heap, 25);
> -  res = if_convertible_loop_p_1 (loop, &refs, &ddrs);
> -
> -  free_data_refs (refs);
> -  free_dependence_relations (ddrs);
> -  return res;
> +  return if_convertible_loop_p_1 (loop);
>  }
>  
>  /* Basic block BB has two predecessors.  Using predecessor's bb
>
Sebastian Pop - Nov. 3, 2010, 8:46 p.m.
On Wed, Nov 3, 2010 at 15:37, Richard Guenther <rguenther@suse.de> wrote:
> On Wed, 3 Nov 2010, Sebastian Pop wrote:
>
>> 2010-10-20  Sebastian Pop  <sebastian.pop@amd.com>
>>
>>       * tree-if-conv.c (if_convertible_loop_p_1): Do not call
>>       compute_data_dependences_for_loop.
>>       (if_convertible_loop_p): Do not free refs and ddrs.
>
> This is ok.

Thanks.

> Btw, there are some pending bugs in if-conversion,
> one which ICEs on SPEC 2k6 tonto with LTO.  It would be nice
> if you can address them.

I will.
I am looking through the bugs on which my name is on CC.
If you think I can help on a bug please add me on the CC list.

Thanks,
Sebastian

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0f58882..3ceb7b6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@ 
 2010-10-20  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* tree-if-conv.c (if_convertible_loop_p_1): Do not call
+	compute_data_dependences_for_loop.
+	(if_convertible_loop_p): Do not free refs and ddrs.
+
+2010-10-20  Sebastian Pop  <sebastian.pop@amd.com>
+
 	PR tree-optimization/46029
 	* doc/invoke.texi (-ftree-loop-if-convert-stores): Update description.
 	* tree-if-conv.c (has_unaligned_memory_refs): New.
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 9fc6190..5b941af 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -855,24 +855,15 @@  predicate_bbs (loop_p loop)
 }
 
 /* Return true when LOOP is if-convertible.  This is a helper function
-   for if_convertible_loop_p.  REFS and DDRS are initialized and freed
-   in if_convertible_loop_p.  */
+   for if_convertible_loop_p.  */
 
 static bool
-if_convertible_loop_p_1 (struct loop *loop,
-			 VEC (data_reference_p, heap) **refs,
-			 VEC (ddr_p, heap) **ddrs)
+if_convertible_loop_p_1 (struct loop *loop)
 {
   bool res;
   unsigned int i;
   basic_block exit_bb = NULL;
 
-  /* Don't if-convert the loop when the data dependences cannot be
-     computed: the loop won't be vectorized in that case.  */
-  res = compute_data_dependences_for_loop (loop, true, refs, ddrs);
-  if (!res)
-    return false;
-
   calculate_dominance_info (CDI_DOMINATORS);
 
   /* Allow statements that can be handled during if-conversion.  */
@@ -934,9 +925,6 @@  if_convertible_loop_p (struct loop *loop)
 {
   edge e;
   edge_iterator ei;
-  bool res = false;
-  VEC (data_reference_p, heap) *refs;
-  VEC (ddr_p, heap) *ddrs;
 
   /* Handle only innermost loop.  */
   if (!loop || loop->inner)
@@ -968,13 +956,7 @@  if_convertible_loop_p (struct loop *loop)
     if (loop_exit_edge_p (loop, e))
       return false;
 
-  refs = VEC_alloc (data_reference_p, heap, 5);
-  ddrs = VEC_alloc (ddr_p, heap, 25);
-  res = if_convertible_loop_p_1 (loop, &refs, &ddrs);
-
-  free_data_refs (refs);
-  free_dependence_relations (ddrs);
-  return res;
+  return if_convertible_loop_p_1 (loop);
 }
 
 /* Basic block BB has two predecessors.  Using predecessor's bb