This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Short Circuit compiler transformations!!
- From: Ajit Kumar Agarwal <ajit dot kumar dot agarwal at xilinx dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>, Jeff Law <law at redhat dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Cc: 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: Sun, 15 Mar 2015 17:10:34 +0000
- Subject: RE: Short Circuit compiler transformations!!
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=pass (sender IP is 149.199.60.100) smtp dot mailfrom=ajit dot kumar dot agarwal at xilinx dot com; gcc.gnu.org; dkim=none (message not signed) header.d=none;
- References: <BN1BFFO11FD0502D79FBFACCFA5C516644AE050 at BN1BFFO11FD050 dot protection dot gbl> <5856E314-2454-4BD1-9155-DF637AF43075 at gmail dot com> <BN1AFFO11FD006599C3460EC91544F81F2AE050 at BN1AFFO11FD006 dot protection dot gbl> <BL2FFO11FD051958F3404E7E1D18ECB4FAE050 at BL2FFO11FD051 dot protection dot gbl> <117F681F-A66B-42C4-A6A1-F9C57D452F78 at gmail dot com>
-----Original Message-----
From: Richard Biener [mailto:richard.guenther@gmail.com]
Sent: Sunday, March 15, 2015 9:30 PM
To: Ajit Kumar Agarwal; Jeff Law; gcc@gcc.gnu.org
Cc: Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju Mekala
Subject: RE: Short Circuit compiler transformations!!
On March 15, 2015 11:14:59 AM GMT+01:00, Ajit Kumar Agarwal <ajit.kumar.agarwal@xilinx.com> wrote:
>
>
>-----Original Message-----
>From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org] On Behalf Of
>Ajit Kumar Agarwal
>Sent: Sunday, March 15, 2015 3:35 PM
>To: Richard Biener; Jeff Law; gcc@gcc.gnu.org
>Cc: Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju
>Mekala
>Subject: RE: Short Circuit compiler transformations!!
>
>
>
>-----Original Message-----
>From: Richard Biener [mailto:richard.guenther@gmail.com]
>Sent: Sunday, March 15, 2015 3:05 PM
>To: Ajit Kumar Agarwal; Jeff Law; gcc@gcc.gnu.org
>Cc: Vinod Kathail; Shail Aditya Gupta; Vidhumouli Hunsigida; Nagaraju
>Mekala
>Subject: Re: Short Circuit compiler transformations!!
>
>On March 15, 2015 9:15:36 AM GMT+01:00, Ajit Kumar Agarwal
><ajit.kumar.agarwal@xilinx.com> wrote:
>>Hello All:
>>
>>Short circuit compiler transformation for conditional branches. The
>>conditional branches based on the conditional Expressions one of the
>>path is always executed thus short circuiting the path. Certains
>values
>>of the conditional Expressions makes the conditional expressions
>always
>>true or false.
>>This part of the conditions in extracted out In the IF-THEN
>>cond_express with the check of the value and in the else case the
>>original expressions is checked.
>>
>>This makes for a given values of the variables of the conditional
>>expressions makes the conditional expression as True or false always
>>and the one path is always executed.
>>
>>For the example given below.
>>
>>For( x1 = lb1; x1 < = ub1 ; x1++)
>>{
>> If ( C1 && C2)
>> S_then
>> }
>>
>>
>>Fig (1).
>>
>>For the input code given in Fig (1) the condition C1 && C2 is always
>>false if C1 or C2 is zero(false) thus short circuiting The path and
>>only s_else will be executed if C1 or C2 is false.
>>
>>Thus the input code is transformed as follows.
>>
>>For( x1 = lb1; x1 < = ub1 ; x1++)
>>{
>> If(!C1)
>> Continue
>> else
>> S_then
>> }
>
>>>This looks wrong as you miss to check C2.
>
>>>Riichard: Sorry for the typo error. I could see the short circuit
>transformation is implemented in gcc. I could see only Short circuiting
>with respect to &&/OR. I am thinking in terms of >>complex expressions
>where any of the variable condition In the expressions Set to to true
>or false the whole expressions and such conditions can be extracted out
>into different versions >>of IF with different parameter check( Another
>way of short circuiting).
>
>>>I would like to know the scope of this optimization in gcc. If not
>implemented with respect to complex expressions with respect To
>different iteration spaces. I would like to propose the >>same.
>>Just as a general note/question on all you suggestions. Are you willing to implement all your proposals or do you have resources to spend to that effort?
>>It's not that we are not aware of loop optimizations GCC does not implement.
>>It's a question of priorities and resources to implement something.
Yes you are right. We are proposing different optimizations based on our Analysis and past experience and we would be interested in and like
to implement based on the suggestions and inputs from the community.
We may not implement all, but based on the suggestions and inputs from the community we would like to take on the priority basis.
Thanks & Regards
Ajit
Richard.
>Richard: Other aspect of the transformation for short circuiting the
>IF-THEN-ELSE with the loops where the loop is irreducible.
>In this case implementing the short circuit transformations and the CFG
>transformations to convert from irreducibility to reducible Loops
>along with the transformations of short circuiting compiler
>transformations.
>
>Thanks & Regards
>Ajit
>
>>>Thoughts Please?
>
>Thanks & Regards
>Ajit
>
>Richard.
>
>>This is much simpler code and there could be complex expressions
>inside
>>the FOR Loop that can be extracted out with Different versions of the
>>conditional IF-THEN-ELSE inside the loops based on short circuiting
>>executing one of the path always Executed can be extracted in IF-THEN
>>and other cases of condition will be inside the else conditions.
>>
>>Again this has to be optimized based on the profile Data of hot
>>conditional branches and the above optimizations is performed Based on
>
>>the hotness of the conditional branches.
>>
>>The short Circuiting optimization also makes the irreducible loops
>with
>>conditional branches as reducible and there is no need for Conversion
>>of irreducible loops to reducible loop with any of the existing
>>approach like node splitting for the short circuiting candidate.
>>
>>This optimizations is implemented in LLVM and I would like to know if
>>this is implemented in GCC. If not implemented I would like To propose
>
>>this short circuit compiler transformation.
>>
>>Thoughts Please ?
>>
>>Thanks & Regards
>>Ajit