[LLVMdev] YSU_Student

artyom.baloyan artyom.baloyan at ysu.am
Tue Apr 2 23:14:52 PDT 2013


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.

how can I do it ?



More information about the llvm-dev mailing list