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

Qianyi (Compiler) via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 15 19:37:03 PDT 2018


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.
[cid:image001.jpg at 01D4653C.24B6F440]

Is it the proper place(LoopRotation.cpp) to implement my feature?
Or is there more suitable place to do it?

Best regards,
Klarke

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181016/232957a6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 19260 bytes
Desc: image001.jpg
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181016/232957a6/attachment.jpg>


More information about the llvm-dev mailing list