On March 15, 2015 9:15:36 AM GMT+01:00, Ajit Kumar Agarwal <ajit.kumar.agar...@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. 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