[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 03:34:13 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:image002.jpg at 01D464B5.AC4BE460]

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/20181015/d2a63484/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 19260 bytes
Desc: image002.jpg
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181015/d2a63484/attachment-0001.jpg>


More information about the llvm-dev mailing list