[LLVMdev] Loop rotation and loop inversion in LLVM?

Paul Sokolovsky pmiscml at gmail.com
Thu May 16 17:07:34 PDT 2013


Hello,

I'd be interested in knowing which pass performs loop inversion, i.e.
transforms while loop into do/while wrapped with if. So, it's pretty
easy to understand concept, http://en.wikipedia.org/wiki/Loop_inversion
provides description of how its done and motivation, googling gives
several relevant references, i.e. it's pretty settled term.

I also see this transform to be actually performed on trivial strlen
function by clang -O2. However opt --help or grepping LLVM doesn't give
any hints.

However, -loop-rotate calls attention, described as "A simple loop
rotation transformation." However, Wikipedia doesn't gives hits for
that related to compilation/optimization theory, nor google hits are
relevant either - mostly LLVM-related hits just mentioning the term.

Trying -loop-rotate, I see loop being converted to post-condition, but
don't see if wrapper around it.

So, can anyone suggest if LLVM loop rotation is related to loop
inversion in Wikipedia terms, and if not, what it is.

And I hope that this feedback will allow maintainers to make
documentation clearer and more user-friendly.


Thanks,
 Paul                          mailto:pmiscml at gmail.com



More information about the llvm-dev mailing list