[LLVMdev] YSU_Student

John Criswell criswell at illinois.edu
Fri Apr 5 11:57:58 PDT 2013


On 4/3/13 1:14 AM, artyom.baloyan wrote:
> Hello,
>
> I wrote my own pass which needs to do some loop unrolling.
>
> I can perform loop unrolling via opt:
>
> opt -mem2reg -loops -loop-simplify -loop-rotate -lcssa -loop-unroll
> -unroll-count=50 mytest.bc -o mytest.bc
>
> This command works perfectly.
>
> However, what I really want is to produce the **same behavior** but
> from my own pass (i.e., I don't want to use opt). I wrote a Module
> pass which already calls other analysis and transformation passes in
> its getAnalysisUsage method:
>
>
> void MyPass::getAnalysisUsage(AnalysisUsage& AU) const {
>   AU.addRequired<LoopInfo>();
>   AU.addPreserved<LoopInfo>();
>   AU.addRequiredID(LoopSimplifyID);
>   AU.addPreservedID(LoopSimplifyID);
>   AU.addRequiredID(LCSSAID);
>   AU.addPreservedID(LCSSAID);
>  }
>
> However, I couldn't figure out how to call the LoopRotate and
> LoopUnroll passes since I cannot use addRequiredID or addRequired for
> these two transformations.

You will need to run these two transform passes before your pass is 
run.  If you're running your pass via opt, then simply tell opt to 
explicitly run them before running your pass.   If you're building your 
own tool that creates a PassManager object and adds passes to it, then 
add these passes to the PassManager object before you add your own pass.

-- John T.

>
> how can I do it ?
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list