dyn_cast<BitCastInst> fails?

I am trying to dyn_cast a Value* to a BitCastInst. The dump of what I
want casted is "i8* bitcast (i32 (i32)* @f1 to i8*)", so it is a
BitCastInst. For someone my dyn_cast always fails, does anyone see
why?

        arg->dump();
        BitCastInst *bitcast = dyn_cast<BitCastInst>(arg);
        assert(bitcast != NULL);

Thank you

Hi ret val,

I am trying to dyn_cast a Value* to a BitCastInst. The dump of what I
want casted is "i8* bitcast (i32 (i32)* @f1 to i8*)", so it is a
BitCastInst. For someone my dyn_cast always fails, does anyone see
why?

it's probably a bitcast constant expression rather than an instruction.

Ciao, Duncan.

I am trying to dyn_cast a Value* to a BitCastInst. The dump of what I
want casted is "i8* bitcast (i32 (i32)* @f1 to i8*)", so it is a
BitCastInst.

It is not a BitCastInst, it's a bitcast constant expression.