This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Strength reduction part 3 of 4: candidates with unknown strides
On 08/08/2012 03:27 PM, Andrew Pinski wrote:
> On Wed, Aug 8, 2012 at 3:25 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Aug 1, 2012 at 10:36 AM, William J. Schmidt
>> <wschmidt@linux.vnet.ibm.com> wrote:
>>> Greetings,
>>>
>>> Thanks for the review of part 2! Here's another chunk of the SLSR code
>>> (I feel I owe you a few beers at this point). This performs analysis
>>> and replacement on groups of related candidates having an SSA name
>>> (rather than a constant) for a stride.
>>>
>>> This leaves only the conditional increment (CAND_PHI) case, which will
>>> be handled in the last patch of the series.
>>>
>>> Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new
>>> regressions. Ok for trunk?
>>>
>>> Thanks,
>>> Bill
>>>
>>>
>>> gcc:
>>>
>>> 2012-08-01 Bill Schmidt <wschmidt@linux.ibm.com>
>>>
>>> * gimple-ssa-strength-reduction.c (struct incr_info_d): New struct.
>>> (incr_vec): New static var.
>>> (incr_vec_len): Likewise.
>>> (address_arithmetic_p): Likewise.
>>> (stmt_cost): Remove dead assignment.
>>> (dump_incr_vec): New function.
>>> (cand_abs_increment): Likewise.
>>> (lazy_create_slsr_reg): Likewise.
>>> (incr_vec_index): Likewise.
>>> (count_candidates): Likewise.
>>> (record_increment): Likewise.
>>> (record_increments): Likewise.
>>> (unreplaced_cand_in_tree): Likewise.
>>> (optimize_cands_for_speed_p): Likewise.
>>> (lowest_cost_path): Likewise.
>>> (total_savings): Likewise.
>>> (analyze_increments): Likewise.
>>> (ncd_for_two_cands): Likewise.
>>> (nearest_common_dominator_for_cands): Likewise.
>>> (profitable_increment_p): Likewise.
>>> (insert_initializers): Likewise.
>>> (introduce_cast_before_cand): Likewise.
>>> (replace_rhs_if_not_dup): Likewise.
>>> (replace_one_candidate): Likewise.
>>> (replace_profitable_candidates): Likewise.
>>> (analyze_candidates_and_replace): Handle candidates with SSA-name
>>> strides.
>>>
>>> gcc/testsuite:
>>>
>>> 2012-08-01 Bill Schmidt <wschmidt@linux.ibm.com>
>>>
>>> * gcc.dg/tree-ssa/slsr-5.c: New.
>>> * gcc.dg/tree-ssa/slsr-6.c: New.
>>> * gcc.dg/tree-ssa/slsr-7.c: New.
>>> * gcc.dg/tree-ssa/slsr-8.c: New.
>>> * gcc.dg/tree-ssa/slsr-9.c: New.
>>> * gcc.dg/tree-ssa/slsr-10.c: New.
>>> * gcc.dg/tree-ssa/slsr-11.c: New.
>>> * gcc.dg/tree-ssa/slsr-12.c: New.
>>> * gcc.dg/tree-ssa/slsr-13.c: New.
>>> * gcc.dg/tree-ssa/slsr-14.c: New.
>>> * gcc.dg/tree-ssa/slsr-15.c: New.
>>> * gcc.dg/tree-ssa/slsr-16.c: New.
>>> * gcc.dg/tree-ssa/slsr-17.c: New.
>>> * gcc.dg/tree-ssa/slsr-18.c: New.
>>> * gcc.dg/tree-ssa/slsr-19.c: New.
>>> * gcc.dg/tree-ssa/slsr-20.c: New.
>>> * gcc.dg/tree-ssa/slsr-21.c: New.
>>> * gcc.dg/tree-ssa/slsr-22.c: New.
>>> * gcc.dg/tree-ssa/slsr-23.c: New.
>>> * gcc.dg/tree-ssa/slsr-24.c: New.
>>> * gcc.dg/tree-ssa/slsr-25.c: New.
>>> * gcc.dg/tree-ssa/slsr-26.c: New.
>>> * gcc.dg/tree-ssa/slsr-30.c: New.
>>> * gcc.dg/tree-ssa/slsr-31.c: New.
>>>
>>>
>> ======================================
>>> --- gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c (revision 0)
>>> +++ gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c (revision 0)
>>> @@ -0,0 +1,25 @@
>>> +/* Verify straight-line strength reduction fails for simple integer addition
>>> + with casts thrown in when -fwrapv is used. */
>>> +
>>> +/* { dg-do compile } */
>>> +/* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
>>> +/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
>>> +
>>
>> This doesn't work on x32 nor Linux/ia32 since -m32
>> may not be needed for ILP32. This patch works for
>> me. OK to install?
>
> This also does not work for mips64 where the options are either
> -mabi=32 or -mabi=n32 for ILP32.
>
> HJL's patch looks correct.
>
> Thanks,
> Andrew
There are GCC targets with 16-bit integers. What's the actual
set of targets on which this test is meant to run? There's a list
of effective-target names based on data type sizes in
<http://gcc.gnu.org/onlinedocs/gccint/Effective_002dTarget-Keywords.html#Effective_002dTarget-Keywords>.
Janis
>>
>> Thanks.
>>
>>
>> --
>> H.J.
>> ---
>> * gcc.dg/tree-ssa/slsr-30.c: Require non-ilp32. Remove
>> dg-skip-if.
>>
>> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c b/gcc/testsuite/gcc.dg/tree
>> -ssa/slsr-30.c
>> index fbd6897..7921f43 100644
>> --- a/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c
>> +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-30.c
>> @@ -1,9 +1,8 @@
>> /* Verify straight-line strength reduction fails for simple integer addition
>> with casts thrown in when -fwrapv is used. */
>>
>> -/* { dg-do compile } */
>> +/* { dg-do compile { target { ! { ilp32 } } } } */
>> /* { dg-options "-O3 -fdump-tree-dom2 -fwrapv" } */
>> -/* { dg-skip-if "" { ilp32 } { "-m32" } { "" } } */
>>
>> long
>> f (int s, long c)
>