[LLVMdev] Loop Unfolding in LLVM

Zhoulai zell08v at gmail.com
Sun Jun 7 10:24:15 PDT 2015


Hello,

I am looking for a loop unfolding procedure implemented in LLVM that helps
to transform a while-loop to n-layer If-statements. The transformation
should be on IR,  although the example below is illustrated on the source
level.

original loop:

* WHILE (condition) DO
         action
 ENDWHILE*

Expected unfolded loop (2-layer):


* IF (condition) THEN*


*          action*


*          IF (condition) THEN*


*               action*

*               WHILE (condition) DO
                    action
               ENDWHILE
*


*                      ENDIF*
*  ENDIF*


(I thought such transformation is somewhat standard but do not find it the
related API of LLVM:loop:
http://llvm.org/docs/doxygen/html/classllvm_1_1Loop.html)

Thanks for your help.

Sincerely,
Zhoulai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150607/4c3b0313/attachment.html>


More information about the llvm-dev mailing list