Questions about trip count

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:

void testLoopInfo(const Function& F) const {
const LoopInfo LI = &getAnalysis();
Function::const_iterator BB = F.begin(), E = F.end();
for (; BB != E; ++BB) {
const Loop
l = LI->getLoopFor(&BB);
if (l != NULL) {
l->dump();
errs() << “BB:\t” << BB->getNameStr() << “\n” ;
errs() << “Is simplifyed loop?\t” << l->isLoopSimplifyForm() << “\n” ;
errs() << "Tripcount " << l->getSmallConstantTripCount() << “\n” ;
const PHINode
phi = l->getCanonicalInductionVariable();
errs() << "Induction variable: " << *phi << “\n”;
}
}
}

When I feed it with this program:
int main(int argc, char** argv) {
int i = 0;
for (; i < 4; i++) {
int j = 0;
for (; j < 8; j++) {
printf(“%c\n”, argv[i][j]);
}
}
}

It prints the following info, where all the trip counts are zero. What am I doing wrong?

Hello: main
Loop at depth 1 containing: %bb4,%bb3,%bb2,%bb,%bb1
Loop at depth 2 containing: %bb2,%bb1
BB: bb
Is simplifyed loop? 1
Tripcount 0
Induction variable: printing a value

Loop at depth 2 containing: %bb2,%bb1
BB: bb1
Is simplifyed loop? 1
Tripcount 0
Induction variable: printing a value

Loop at depth 2 containing: %bb2,%bb1
BB: bb2
Is simplifyed loop? 1
Tripcount 0
Induction variable: printing a value

Loop at depth 1 containing: %bb4,%bb3,%bb2,%bb,%bb1
Loop at depth 2 containing: %bb2,%bb1
BB: bb3
Is simplifyed loop? 1
Tripcount 0
Induction variable: printing a value

Loop at depth 1 containing: %bb4,%bb3,%bb2,%bb,%bb1
Loop at depth 2 containing: %bb2,%bb1
BB: bb4
Is simplifyed loop? 1
Tripcount 0
Induction variable: printing a value

Regards,

Douglas