This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Tree SSA If-combine optimization pass in GCC
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Ajit Kumar Agarwal <ajit dot kumar dot agarwal at xilinx dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Vinod Kathail <vinodk at xilinx dot com>, Shail Aditya Gupta <shailadi at xilinx dot com>, Vidhumouli Hunsigida <vidhum at xilinx dot com>, Nagaraju Mekala <nmekala at xilinx dot com>
- Date: Tue, 17 Feb 2015 13:19:13 +0100
- Subject: Re: Tree SSA If-combine optimization pass in GCC
- Authentication-results: sourceware.org; auth=none
- References: <020b7d9d890e42ddafb2a22de8291f45 at BN1BFFO11FD045 dot protection dot gbl> <CAFiYyc0qD=8cbaVLOnQ=YoVo6fK1ZwBV8tApuG0xK19f3fpxTw at mail dot gmail dot com> <44456938198d427abd8906455a514e07 at BN1BFFO11FD047 dot protection dot gbl>
On Tue, Feb 17, 2015 at 11:26 AM, Ajit Kumar Agarwal
<ajit.kumar.agarwal@xilinx.com> wrote:
>
>
> -----Original Message-----
> From: Richard Biener [mailto:richard.guenther@gmail.com]
> Sent: Tuesday, February 17, 2015 3:42 PM
> To: Ajit Kumar Agarwal
> Cc: gcc@gcc.gnu.org; Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju Mekala
> Subject: Re: Tree SSA If-combine optimization pass in GCC
>
> On Tue, Feb 17, 2015 at 9:22 AM, Ajit Kumar Agarwal <ajit.kumar.agarwal@xilinx.com> wrote:
>> Hello All:
>>
>> I can see the IF-combining (If-merging) pass of optimization on tree-ssa form of intermediate representation.
>> The IF-combine or merging takes of merging the IF-THEN-ELSE if the
>> condition Expr found be congruent or Similar.
>>
>> The IF-combine happens if the two IF-THEN-ELSE are contiguous to each other.
>> If the IF-THEN-ELSE happens to be not contiguous but are wide apart with there is code in between.
>> Does the If-combine takes care of this. This requires to do the
>> head-duplication and Tail-duplication for the Code in between If-THEN-ELSE to bring the IF-THEN-ELSE contiguous to each other.
>>
>> After the head and tail duplication of the code in between the
>> IF-THEN-ElSE sequence becomes contiguous to each other. Apart from
>> this, Does the tree-ssa-if-combine pass considers the control flow of the body of the IF-THEN-ELSE. Is there any limitation on control flow of the body of the IF-THEN-ELSE.
>>
>> Can I know the scope of tree-ssa-ifcombine optimizations pass with respect to the above points.
>>
>> Thoughts Please?
>
>>>if-combine is a simple CFG + condition pattern matcher. It does not perform head/tail duplication. Also there is no "control flow" in the bodies, control flow is part of the CFG that is >>matched so I'm not quite getting your last question.
>
> Thanks ! My last question was If there is a control flow likes loops inside the IF-THEN-ELSE, which could be possible if the Loop unswitching is performed
> and the Loop body is placed inside the IF-THEN-ELSE, then in that case the two IF-THEN-ELSE can be merged if the cond expr matches and the control flow
> of the body of If-then-else matches?
>
> There are many cases in SPEC 2006 benchmarks where the IF-combine could be enabled if the if-then-else sequence is made contiguous by performing
> the head/tail duplication.
I'd be curious what those cases look like. Care to file some bugreports
with testcases?
>>>if-combine was designed to accompany IL-only patterns that get partly translated into control flow. Like
>
> >>tem1 = name & bit1;
> >>tem2 = name & bit2;
> >>tem3 = tem1 | tem2;
> >>if (tem3)
> ...
>
>>>vs.
>
> >>tem1 = name & bit1;
> >>if (tem1)
> >>goto x;
> >>else
> >>{
> >>tem2 = name & bit2;
> >>if (tem2)
> >> goto x;
> >>}
>
>>>x:
> >>...
> Thanks for the examples. This explains the scope of if-combine optimization pass.
>
> Thanks & Regards
> Ajit
>
> Richard.
>
>> Thanks & Regards
>> Ajit