Basic Blocks of a Function called inside Loop

Hello,
I have written pass to know basic blocks inside loops…
But for eg a function is called inside loop then all its basic block are also considered part of the loop…
I am unable to detect that…

How to do so?

BB0…if BB0 is part of Func0 and Func0 is called inside loop (L1) with 10 iterations then BB0 will be executed 10 times…
How to detect in LLVM pass that BB0 is inside loop L1?

Please help…

Regards

The way I do it is to iterate over each of the instructions in the
relevant blocks, find all the call sites, then repeat the same thing
for all of the blocks in the called functions until there are no call
sites left. There may be a better way to do it, but this is the method
that works for me. It's also fully recursive, which may or may not be
what you want.

Thank You…
Can you please share the code.