[LLVMdev] Questions about trip count

Tobias Grosser grosser at fim.uni-passau.de
Thu Aug 12 13:22:39 PDT 2010


On 08/12/2010 09:41 PM, Douglas do Couto Teixeira wrote:
> Dear guys,
>
>      I am having problems to obtain good information from the LoopInfo.
> I am always getting a trip count of 0, even though I am clearly passing
> a loop with a constant bound. I am using this pass below:
Hi,

I would propose to first check if the trip count is calculated 
correctly. I would do this with opt by calling:

opt -mem2reg -loopsimplify -indvars -scalar-evolution -analyze prog.ll

At the end of the output the tripcount of every loop should be written.

To get the trip count in your pass you should ask ScalarEvolution.

ScalarEvolution *SE;
Loop *L;
SE->getBackedgeTakenCount(L);

If you need help trying this please ask back.

Cheers
Tobi



More information about the llvm-dev mailing list