[llvm-dev] LoopStrengthReduce.cpp

Jonas Paulsson via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 28 06:02:40 PDT 2016


Hi,

I am looking for a way to rewrite induction variables to use an addition 
of -1 whenever possible (and not otherwise unprofitable). This is needed 
to utilize hardware loop instructions, which are present on SystemZ 
(branch on count). Later in the backend, an 'add -1; compare w/ 0; jne 
0'-sequence can be replaced with a brct instruction.

I could not find any way in the LSR pass to generate a formula for this 
(neither to express the lower target cost). I would like to generate a 
formula with a step of -1 and make the cost for it to be less than that 
of a similar formula with another constant.

Could someone please give me any clue as to if there is a way to 
currently do this, or if not, what would be the normal way?

thanks,

Jonas paulsson



More information about the llvm-dev mailing list