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
Dan Gohman
2010-May-10 18:45 UTC
[LLVMdev] getTripCount requires which optimization passes?
On May 7, 2010, at 11:17 AM, Trevor Harmon wrote:> 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.Code coming from C front-ends typically also needs -loop-rotate, in addition to all the usual stuff (mem2reg, instcombine, simplifycfg, etc). It depends a fair amount on the front-end; take a look at what opt -O2 does and experiment with it.> > 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.The design idea here is that you should write your pass to be conservatively correct in the case that indvars and whatever else hasn't run, and then just make your front-ends add -indvars before adding your pass. Dan
Trevor Harmon
2010-May-10 21:20 UTC
[LLVMdev] getTripCount requires which optimization passes?
On May 10, 2010, at 11:45 AM, Dan Gohman wrote:> just make your front-ends add -indvars before > adding your pass.Sorry, I don't have a clue how to do this, and I can't find any docs about it. I'm using llvm-gcc; how can I tell it to add a pass? Trevor
Seemingly Similar Threads
- [LLVMdev] getTripCount requires which optimization passes?
- [LLVMdev] getTripCount requires which optimization passes?
- [LLVMdev] getTripCount requires which optimization passes?
- [LLVMdev] getTripCount requires which optimization passes?
- [LLVMdev] getTripCount()