[llvm-dev] LoopStrengthReduce.cpp

Jonas Paulsson via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 8 08:20:31 PDT 2016


>Hi Jonas,
>
>Are you talking specifically about the induction variable? You might look at what I did for PowerPC's counter-based loops >(lib/Target/PowerPC/PPCCTRLoops.cpp, etc.).
>
> -Hal

Hi Hal,

thanks for the pointer! I have made a pass based on PPCCTRLoops.cpp for 
review on http://reviews.llvm.org/D18900. I took most of the code 
straight, but simplified it a bit to use the L->getLatch() method, which 
made more sense to me. I would appreciate any suggestions / comments.

 >On that note, I think that in general it would be useful to have some 
target-independent (CodeGen) pass that would do the majority of the work 
for >hardware loop generation.  I have thought about it, but I won't be 
able to do anything in the short term.
 >
 >-Krzysztof

I guess either of PPCCTRLLoops or SystemZBRCTLoops pass could 
potentially easily form the beginning of such a loop pass.

LSR seemed to me to be too complex already to dare try and add a lot of 
more new functionality to it. It seems to only care about compare with 
zero right
now, and I couldn't see an obvious way to make it generate a formula for 
any compare with step -1 to 0. Or did I miss something here?

/Jonas


On 2016-03-31 11:25, Jonas Paulsson wrote:
>
>> On that note, I think that in general it would be useful to have some 
>> target-independent (CodeGen) pass that would do the majority of the 
>> work for hardware loop generation.  I have thought about it, but I 
>> won't be able to do anything in the short term.
>>
>> -Krzysztof
>>
> I think a first and useful step would be to let targets optionally 
> have the loop induction variable which controls the back-branching be 
> reformulated as a decrement towards zero with a -1 step. Should this 
> be an extension of LSR, or should it be a simple beginning of a 
> HW-loop pass running after it?
>
> /Jonas



More information about the llvm-dev mailing list