Hi, I am trying to add a new loop pass in which I making a call to get the trip count of the loop using Value *TripCountValue = L->getTripCount() However I am always getting NULL for TripCountValue (confirmed through gdb). I am running this pass after the canonicalization of induction variables: opt --debug-pass=Structure -stats -indvars -loop-rotate -my-loop-pass < main.bc > main.unroll.s Pass Arguments: -domtree -loops -scalar-evolution -loopsimplify -domfrontier -scalar-evolution -lcssa -indvars -loop-rotate -domfrontier -scalar-evolution -lcssa -my-loop-pass -preverify -domtree -verify Target Data Layout ModulePass Manager FunctionPass Manager Dominator Tree Construction Natural Loop Construction Scalar Evolution Analysis -- Scalar Evolution Analysis Canonicalize natural loops Dominance Frontier Construction Scalar Evolution Analysis Loop Pass Manager Loop-Closed SSA Form Pass Canonicalize Induction Variables -- Canonicalize Induction Variables Rotate Loops -- Loop-Closed SSA Form Pass -- Rotate Loops -- Dominance Frontier Construction -- Scalar Evolution Analysis Dominance Frontier Construction Scalar Evolution Analysis Loop Pass Manager Loop-Closed SSA Form Pass * <My Loop Pass>* -- * <My Loop Pass>* -- Loop-Closed SSA Form Pass -- Natural Loop Construction -- Canonicalize natural loops -- Dominance Frontier Construction -- Dominator Tree Construction -- Scalar Evolution Analysis Preliminary module verification Dominator Tree Construction Module Verifier -- Preliminary module verification -- Dominator Tree Construction -- Module Verifier Bitcode Writer -- Bitcode Writer I have two loops in my source program which have statically-determinable bounds: for (i=1; i < 99999; i++) { .... } Is there anything else I should be doing before invoking the getTripCount() method ? thanks, Prakash -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080426/ed1e1b6f/attachment.html>
Prakash Prabhu wrote:> I am trying to add a new loop pass in which I making a call to get the > trip count of the loop using > > Value *TripCountValue = L->getTripCount()That should work. Could you file a bug and attach the bytecode after 'opt -indvars -loop-rotate'? I would need that to determine why LoopInfo::getTripCount isn't returning any value. Nick
Thanks for the quick reply. Created Bug 2253: http://llvm.org/bugs/show_bug.cgi?id=2253 - Prakash On Sat, Apr 26, 2008 at 2:15 PM, Nick Lewycky <nicholas at mxc.ca> wrote:> Prakash Prabhu wrote: > > I am trying to add a new loop pass in which I making a call to get the > > trip count of the loop using > > > > Value *TripCountValue = L->getTripCount() > > That should work. > > Could you file a bug and attach the bytecode after 'opt -indvars > -loop-rotate'? I would need that to determine why LoopInfo::getTripCount > isn't returning any value. > > Nick > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080426/d9b3cb3c/attachment.html>