This is the mail archive of the
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 10:04:41 +0000
- Subject: RE: Short Circuit compiler transformations!!
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=pass (sender IP is 188.8.131.52) smtp dot mailfrom=ajit dot kumar dot agarwal at xilinx dot com; redhat.com; 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>
From: Richard Biener [mailto:email@example.com]
Sent: Sunday, March 15, 2015 3:05 PM
To: Ajit Kumar Agarwal; Jeff Law; firstname.lastname@example.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 <email@example.com> wrote:
>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)
>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++)
>>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.
Thanks & Regards
>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