In my pass, I add LoopInfo as a required pass. Then I'd like to print the constant loop trip count of each loop if it has one. However, every time I call loop-> getSmallConstantTripCount(), it returns 0, even for a very simple loop: for(i=0; i<3; ++i) {;} What's the possible cause of this problem? regards, Bo -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110427/e5b8b3ba/attachment.html>
Hi Bo,> In my pass, I add LoopInfo as a required pass. Then I'd like to print the > constant loop trip count of each loop if it has one. However, every time I call > loop-> > getSmallConstantTripCount(), it returns 0, even for a very simple loop: for(i=0; > i<3; ++i) {;} What's the possible cause of this problem?this comes up regularly, so search the mailing list archives. IIRC, you need to run some other passes first: mem2reg and probably some others I forget. Ciao, Duncan.
Did you run the IndVarSimplify pass? For things like canonical inductive variables and trip counts, LoopInfo seems to rely on the loop already being in a canonical form presented by passes such as IndVarSimplify. You'll also want to make sure not to do something like StrengthReduction which will invalidate the canonicalization done by IndVarSimplify until you're done with the LoopInfo analysis. On Wed, Apr 27, 2011 at 1:35 PM, Bo Wu <bwu at cs.wm.edu> wrote:> In my pass, I add LoopInfo as a required pass. Then I'd like to print the > constant loop trip count of each loop if it has one. However, every time I > call loop-> > getSmallConstantTripCount(), it returns 0, even for a very simple loop: > for(i=0; i<3; ++i) {;} What's the possible cause of this problem? > > regards, > Bo > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
Possibly Parallel Threads
- [LLVMdev] LoopInfo are not able to identify some natural loops?
- [LLVMdev] No getSmallConstantTripCount function in current LLVM version
- [LLVMdev] LoopInfo are not able to identify some natural loops?
- [LLVMdev] getSmallConstantTripCount function doesn't work for obvious cases
- [LLVMdev] LoopInfo are not able to identify some natural loops?