Trevor Harmon
2010-May-07 00:59 UTC
[LLVMdev] getTripCount requires which optimization passes?
Hi, For me, getTripCount always returns null, even for trivial loops such as: void simple(int j) { for (int i = 0; i < 10; i++) { j++; } } Looking through the mailing list archive, it appears that getTripCount requires certain optimization passes to run first, but it's not clear which ones. There doesn't seem to be any documentation on this. Does anybody know exactly which passes must run in order for getTripCount to work? Thanks, Trevor
ether zhhb
2010-May-07 01:32 UTC
[LLVMdev] getTripCount requires which optimization passes?
hi, On Fri, May 7, 2010 at 8:59 AM, Trevor Harmon <Trevor.W.Harmon at nasa.gov>wrote:> Hi, > > For me, getTripCount always returns null, even for trivial loops such > as: > > void simple(int j) { > for (int i = 0; i < 10; i++) { > j++; > } > } > > Looking through the mailing list archive, it appears that getTripCount > requires certain optimization passes to run first, but it's not clear > which ones. There doesn't seem to be any documentation on this. Does > anybody know exactly which passes must run in order for getTripCount > to work? >As the comment said: /// The IndVarSimplify pass transforms loops to have a form that this /// function easily understands. you could try -indvars.> > Thanks, > > Trevor > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >best regards ether -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100507/1b26a0b9/attachment.html>
Trevor Harmon
2010-May-07 18:17 UTC
[LLVMdev] getTripCount requires which optimization passes?
On May 6, 2010, at 6:32 PM, ether zhhb wrote:> As the comment said: > /// The IndVarSimplify pass transforms loops to have a form that > this > /// function easily understands. > > you could try -indvars.After adding -indvars to the opt command, getTripCount still returns null. I suppose it's possible, depending on the scheduling of the pass manager, that indvars is running after my pass runs. I could force it to run first by adding it to my pass's getAnalysisUsage: void MyPass::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<IndVarSimplify>(); } But this isn't possible because for some reason there's no IndVarSimplify.h header file. The IndVarSimplify pass is defined only in its IndVarSimplify.cpp, so my pass can't use it. Not sure where to go from here. Should I post a test case illustrating the problem? Trevor