Get Num of Uses in only dominated blocks?

Hi all,

I am doing a project that requires counting the number of uses of a value
only in all dominated blocks in a function. I checked the manual for llvm::User
class, but only get this

unsigned getNumUses () const

This gives me all the uses of a value.

Is there any simple way, like an API to do this?
Or I have to manually write a method to traverse dominated basic blocks and count
the number of uses?

Tianyu Cheng

LLVM is in SSA, which means that by definition, any uses are dominated by the definition.

So getNumUses does, in fact, give you the answer of “what is the number of uses that are dominated by this definition”.

Unless i’m missing what you are really after?

Thanks Daniel, I did not take SSA form into consideration.