Instruction does not dominate all uses!

LLVM 3.8.0, Ubuntu 16.04.2, 64 bit is being used to instrument IR.

It looks like your IRBuilder may be inserting the instruction in the
wrong place. I'd use the debugger to call Module::dump after that
fault to see where the bitcast really lives. If it's before the alloca
(or even not guaranteed to be afterwards) then that's your problem.

Tim.

> Instruction does not dominate all uses!
> %var = alloca [3 x i32], align 4
> %0 = bitcast [3 x i32]* %var to i8*

It looks like your IRBuilder may be inserting the instruction in the
wrong place.

Indeed. Thank you so much. I was scratching my head all day today. I wish
I'd have mailed in the morning, could have saved my day.

I'd use the debugger to call Module::dump after that
fault to see where the bitcast really lives. If it's before the alloca
(or even not guaranteed to be afterwards) then that's your problem.

Out of curiosity, do my mean to fire up gdb? Can it call Module:dump()
after a breakpoint is hit?

I'd use the debugger to call Module::dump after that

fault to see where the bitcast really lives. If it's before the alloca
(or even not guaranteed to be afterwards) then that's your problem.

Out of curiosity, do my mean to fire up gdb? Can it call Module:dump()
after a breakpoint is hit?

Usually you can call dump function in a GDB session, just give it a try.

Regards,
chenwj