Patchwork [3/3] Add -ftree-loop-distribute-patterns.

login
register
mail settings
Submitter Sebastian Pop
Date July 31, 2010, 3:30 p.m.
Message ID <AANLkTikw=YLtynuuzJ6muL9EKk_O1-Tad+N1YiO_LsdH@mail.gmail.com>
Download mbox | patch
Permalink /patch/60435/
State New
Headers show

Comments

Sebastian Pop - July 31, 2010, 3:30 p.m.
I forgot this part in the patch below:



On Sat, Jul 31, 2010 at 10:27, Sebastian Pop <sebpop@gmail.com> wrote:
> ---
>  gcc/common.opt               |    4 ++++
>  gcc/doc/invoke.texi          |    5 +++++
>  gcc/tree-loop-distribution.c |    3 ++-
>  3 files changed, 11 insertions(+), 1 deletions(-)
>
> diff --git a/gcc/common.opt b/gcc/common.opt
> index 77cf58e..a9fcdd2 100644
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -1341,6 +1341,10 @@ ftree-loop-distribute-memset-zero
>  Common Report Var(flag_tree_loop_distribute_memset_zero) Optimization
>  Enable loop distribution of initialization loops using memset zero
>
> +ftree-loop-distribute-patterns
> +Common Report Var(flag_tree_loop_distribute_patterns) Optimization
> +Enable loop distribution of patterns code generated with calls to a library
> +
>  ftree-loop-im
>  Common Report Var(flag_tree_loop_im) Init(1) Optimization
>  Enable loop invariant motion on trees
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index ca3238c..b9b8b22 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -385,6 +385,7 @@ Objective-C and Objective-C++ Dialects}.
>  -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
>  -ftree-forwprop -ftree-fre -ftree-loop-if-convert -ftree-loop-im @gol
>  -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-memset-zero @gol
> +-ftree-loop-distribute-patterns @gol
>  -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
>  -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
>  -ftree-sink -ftree-sra -ftree-switch-conversion @gol
> @@ -6946,6 +6947,10 @@ ENDDO
>  and the initialization loop is transformed into a call to memset zero.
>  This flag is enabled by default at @option{-O3}.
>
> +@item -ftree-loop-distribute-patterns
> +Perform loop distribution of patterns that can be code generated with
> +calls to a library.  This enables @option{-ftree-loop-distribute-memset-zero}.
> +
>  @item -ftree-loop-im
>  @opindex ftree-loop-im
>  Perform loop invariant motion on trees.  This pass moves only invariants that
> diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
> index 920f744..c677ecb 100644
> --- a/gcc/tree-loop-distribution.c
> +++ b/gcc/tree-loop-distribution.c
> @@ -1187,7 +1187,8 @@ tree_loop_distribution (void)
>       /* If both flag_tree_loop_distribute_memset_zero and
>         flag_tree_loop_distribution are set, then only memset_zero is
>         executed.  */
> -      if (flag_tree_loop_distribute_memset_zero)
> +      if (flag_tree_loop_distribute_memset_zero
> +         || flag_tree_loop_distribute_patterns)
>        {
>          /* With the following working list, we're asking
>             distribute_loop to separate from the rest of the loop the
> --
> 1.7.0.4
>
>
Richard Guenther - Aug. 1, 2010, 12:05 p.m.
On Sat, Jul 31, 2010 at 5:30 PM, Sebastian Pop <sebpop@gmail.com> wrote:
> I forgot this part in the patch below:

I thought of renaming -ftree-loop-distribute-memset-zero to
-ftree-loop-distribute-patterns, not adding an unused option.

Richard.

> diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
> index c677ecb..34d6e21 100644
> --- a/gcc/tree-loop-distribution.c
> +++ b/gcc/tree-loop-distribution.c
> @@ -1237,7 +1237,8 @@ static bool
>  gate_tree_loop_distribution (void)
>  {
>   return flag_tree_loop_distribution
> -    || flag_tree_loop_distribute_memset_zero;
> +    || flag_tree_loop_distribute_memset_zero
> +    || flag_tree_loop_distribute_patterns;
>  }
>
>  struct gimple_opt_pass pass_loop_distribution =
>
>
> On Sat, Jul 31, 2010 at 10:27, Sebastian Pop <sebpop@gmail.com> wrote:
>> ---
>>  gcc/common.opt               |    4 ++++
>>  gcc/doc/invoke.texi          |    5 +++++
>>  gcc/tree-loop-distribution.c |    3 ++-
>>  3 files changed, 11 insertions(+), 1 deletions(-)
>>
>> diff --git a/gcc/common.opt b/gcc/common.opt
>> index 77cf58e..a9fcdd2 100644
>> --- a/gcc/common.opt
>> +++ b/gcc/common.opt
>> @@ -1341,6 +1341,10 @@ ftree-loop-distribute-memset-zero
>>  Common Report Var(flag_tree_loop_distribute_memset_zero) Optimization
>>  Enable loop distribution of initialization loops using memset zero
>>
>> +ftree-loop-distribute-patterns
>> +Common Report Var(flag_tree_loop_distribute_patterns) Optimization
>> +Enable loop distribution of patterns code generated with calls to a library
>> +
>>  ftree-loop-im
>>  Common Report Var(flag_tree_loop_im) Init(1) Optimization
>>  Enable loop invariant motion on trees
>> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
>> index ca3238c..b9b8b22 100644
>> --- a/gcc/doc/invoke.texi
>> +++ b/gcc/doc/invoke.texi
>> @@ -385,6 +385,7 @@ Objective-C and Objective-C++ Dialects}.
>>  -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
>>  -ftree-forwprop -ftree-fre -ftree-loop-if-convert -ftree-loop-im @gol
>>  -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-memset-zero @gol
>> +-ftree-loop-distribute-patterns @gol
>>  -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
>>  -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
>>  -ftree-sink -ftree-sra -ftree-switch-conversion @gol
>> @@ -6946,6 +6947,10 @@ ENDDO
>>  and the initialization loop is transformed into a call to memset zero.
>>  This flag is enabled by default at @option{-O3}.
>>
>> +@item -ftree-loop-distribute-patterns
>> +Perform loop distribution of patterns that can be code generated with
>> +calls to a library.  This enables @option{-ftree-loop-distribute-memset-zero}.
>> +
>>  @item -ftree-loop-im
>>  @opindex ftree-loop-im
>>  Perform loop invariant motion on trees.  This pass moves only invariants that
>> diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
>> index 920f744..c677ecb 100644
>> --- a/gcc/tree-loop-distribution.c
>> +++ b/gcc/tree-loop-distribution.c
>> @@ -1187,7 +1187,8 @@ tree_loop_distribution (void)
>>       /* If both flag_tree_loop_distribute_memset_zero and
>>         flag_tree_loop_distribution are set, then only memset_zero is
>>         executed.  */
>> -      if (flag_tree_loop_distribute_memset_zero)
>> +      if (flag_tree_loop_distribute_memset_zero
>> +         || flag_tree_loop_distribute_patterns)
>>        {
>>          /* With the following working list, we're asking
>>             distribute_loop to separate from the rest of the loop the
>> --
>> 1.7.0.4
>>
>>
>
Richard Guenther - Aug. 2, 2010, 9:21 a.m.
On Sun, Aug 1, 2010 at 2:05 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Jul 31, 2010 at 5:30 PM, Sebastian Pop <sebpop@gmail.com> wrote:
>> I forgot this part in the patch below:
>
> I thought of renaming -ftree-loop-distribute-memset-zero to
> -ftree-loop-distribute-patterns, not adding an unused option.

Btw, the patchset is ok with that change, -ftree-loop-distribute-memset
removed and -ftree-loop-distribute-patterns enabled at -O3.

Thanks,
Richard.

> Richard.
>
>> diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
>> index c677ecb..34d6e21 100644
>> --- a/gcc/tree-loop-distribution.c
>> +++ b/gcc/tree-loop-distribution.c
>> @@ -1237,7 +1237,8 @@ static bool
>>  gate_tree_loop_distribution (void)
>>  {
>>   return flag_tree_loop_distribution
>> -    || flag_tree_loop_distribute_memset_zero;
>> +    || flag_tree_loop_distribute_memset_zero
>> +    || flag_tree_loop_distribute_patterns;
>>  }
>>
>>  struct gimple_opt_pass pass_loop_distribution =
>>
>>
>> On Sat, Jul 31, 2010 at 10:27, Sebastian Pop <sebpop@gmail.com> wrote:
>>> ---
>>>  gcc/common.opt               |    4 ++++
>>>  gcc/doc/invoke.texi          |    5 +++++
>>>  gcc/tree-loop-distribution.c |    3 ++-
>>>  3 files changed, 11 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/gcc/common.opt b/gcc/common.opt
>>> index 77cf58e..a9fcdd2 100644
>>> --- a/gcc/common.opt
>>> +++ b/gcc/common.opt
>>> @@ -1341,6 +1341,10 @@ ftree-loop-distribute-memset-zero
>>>  Common Report Var(flag_tree_loop_distribute_memset_zero) Optimization
>>>  Enable loop distribution of initialization loops using memset zero
>>>
>>> +ftree-loop-distribute-patterns
>>> +Common Report Var(flag_tree_loop_distribute_patterns) Optimization
>>> +Enable loop distribution of patterns code generated with calls to a library
>>> +
>>>  ftree-loop-im
>>>  Common Report Var(flag_tree_loop_im) Init(1) Optimization
>>>  Enable loop invariant motion on trees
>>> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
>>> index ca3238c..b9b8b22 100644
>>> --- a/gcc/doc/invoke.texi
>>> +++ b/gcc/doc/invoke.texi
>>> @@ -385,6 +385,7 @@ Objective-C and Objective-C++ Dialects}.
>>>  -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
>>>  -ftree-forwprop -ftree-fre -ftree-loop-if-convert -ftree-loop-im @gol
>>>  -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-memset-zero @gol
>>> +-ftree-loop-distribute-patterns @gol
>>>  -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
>>>  -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
>>>  -ftree-sink -ftree-sra -ftree-switch-conversion @gol
>>> @@ -6946,6 +6947,10 @@ ENDDO
>>>  and the initialization loop is transformed into a call to memset zero.
>>>  This flag is enabled by default at @option{-O3}.
>>>
>>> +@item -ftree-loop-distribute-patterns
>>> +Perform loop distribution of patterns that can be code generated with
>>> +calls to a library.  This enables @option{-ftree-loop-distribute-memset-zero}.
>>> +
>>>  @item -ftree-loop-im
>>>  @opindex ftree-loop-im
>>>  Perform loop invariant motion on trees.  This pass moves only invariants that
>>> diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
>>> index 920f744..c677ecb 100644
>>> --- a/gcc/tree-loop-distribution.c
>>> +++ b/gcc/tree-loop-distribution.c
>>> @@ -1187,7 +1187,8 @@ tree_loop_distribution (void)
>>>       /* If both flag_tree_loop_distribute_memset_zero and
>>>         flag_tree_loop_distribution are set, then only memset_zero is
>>>         executed.  */
>>> -      if (flag_tree_loop_distribute_memset_zero)
>>> +      if (flag_tree_loop_distribute_memset_zero
>>> +         || flag_tree_loop_distribute_patterns)
>>>        {
>>>          /* With the following working list, we're asking
>>>             distribute_loop to separate from the rest of the loop the
>>> --
>>> 1.7.0.4
>>>
>>>
>>
>
Sebastian Pop - Aug. 2, 2010, 4:21 p.m.
On Mon, Aug 2, 2010 at 04:21, Richard Guenther
<richard.guenther@gmail.com> wrote:
> Btw, the patchset is ok with that change, -ftree-loop-distribute-memset
> removed and -ftree-loop-distribute-patterns enabled at -O3.
>

Committed r162822.

Patch

diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index c677ecb..34d6e21 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -1237,7 +1237,8 @@  static bool
 gate_tree_loop_distribution (void)
 {
   return flag_tree_loop_distribution
-    || flag_tree_loop_distribute_memset_zero;
+    || flag_tree_loop_distribute_memset_zero
+    || flag_tree_loop_distribute_patterns;
 }

 struct gimple_opt_pass pass_loop_distribution =