Optimize from 'for' to 'do-while' when setting #pragma clang loop min(1)

To whom it may concern,

I’m implementing one pragma to optimize “for” loop.

We assume the loop will run at least 1 times when we set following pragma:

#pragma clang loop min(1)

for(i = 0; i < n; I ++)

Then we can remove the first branch which go to exit block when “n < =0”.

This is one picture which show llvm how to do loop rotation.

image002.jpg

Is it the proper place(LoopRotation.cpp) to implement my feature?

Or is there more suitable place to do it?

Best regards,

Klarke