[LLVMdev] get LPPassManager to use it in llvm::CloneLoop

Jimborean Alexandra xinfinity_a at yahoo.com
Mon May 9 01:06:04 PDT 2011


Hi, 

I try to write a FunctionPass that, among other tasks, has to clone some loops 
from the current function. 

How can I obtain the LPPassManager in order to use the CloneLoop function. 
In a LoopPass this is a parameter for the runOnLoop, but how can I obtain it in 
a FunctionPass?
I tried simply by creating a new instance : 

        ValueMap<const Value *, Value* > VMap; 
        LoopInfo *LI = &getAnalysis<LoopInfo>(); 
        LPPassManager *LPM = new llvm::LPPassManager(1); 

        Loop* nL = llvm::CloneLoop(L, LPM, LI, VMap, this); 

but it segfaults in CloneLoop when trying LPM->insertLoop(..). 

Does the CloneLoop function include both loops in the CFG and  re-create the use 
map between the clones?
Also does it update the phi nodes to use either the original or the cloned 
values? 


Thank you for your help, 

Alexandra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110509/4e15bdc4/attachment.html>


More information about the llvm-dev mailing list