[LLVMdev] loop clone?

Johannes Doerfert doerfert at cs.uni-saarland.de
Wed Sep 24 15:12:18 PDT 2014


Hi Linhai,

I'm not aware of a function to clone a loop but you can extract the loop
into its own function [1] and clone the function [2]. In the end you
just need a conditional to decide which function to call.

I hope this helps,
  Johannes

[1] http://llvm.org/docs/doxygen/html/classllvm_1_1CodeExtractor.html#a52e4200738c1e0cb57d15647de3125a0
[2] http://llvm.org/docs/doxygen/html/namespacellvm.html#a5596246c2350cb74f31ffa7695d5923c

On 09/24, Linhai wrote:
> Hi,
> 
>     I want to add a branch before a loop, and clone the loop to the else
> part. After that, I can do instrumentation in one loop, and keep the other
> one uninstrumented. Does llvm have existing functionality to clone loops, or
> similar codes I can check?
> 
>     Thanks a lot!
> 
>     Best,
> 
> Linhai
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-- 

Johannes Doerfert
Researcher / PhD Student

Compiler Design Lab (Prof. Hack)
Saarland University, Computer Science
Building E1.3, Room 4.26

Tel. +49 (0)681 302-57521 : doerfert at cs.uni-saarland.de
Fax. +49 (0)681 302-3065  : http://www.cdl.uni-saarland.de/people/doerfert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140925/81006550/attachment.sig>


More information about the llvm-dev mailing list