[LLVMdev] #uses

Chris Lattner sabre at nondot.org
Tue Sep 17 18:15:01 PDT 2002

> Hi, Chris, can you tell me why it should be
> dyn_cast<Instruction>(*i) instead of
> dyn_cast<Instruction>(&*i)? I remember when do the iteration
> on the basic block. We use code like this:
> for(BasicBlock::iterator i = b->begin(); ie = b->end(); i !=
> ie; ++i) {
>                     if (CallInst* callInst =
> dyn_cast<CallInst>(&*i)) {
> Can you tell me why they are different?

BasicBlock::iterator and Value::use_iterator are different types.
Dereferencing a BasicBlock::iterator returns a reference to an
instruction, dereferencing a Value::use_iterator returns a pointer to the



More information about the llvm-dev mailing list