[LLVMdev] Typecasting int32ty to int64ty

Tim Northover
Mon, 07 Oct 2013 10:22:33 -0000

> How can I convert i32 to i64 type before pushing it to the
vector<Value*>,
> so that all Value* on my vector is of same Type?

You have to decide whether your i32s are signed or unsigned (should
0xffffffff give an i64 of -1 or 0xffffffff?). After that you can
insert an appropriate ZExt or SExt instruction into the basic block
and push its result onto your vector.

If inserting a sext/zext into the IR isn't appropriate then your only
option is to adapt your own code to deal with both i32 and i64 Values
being in that vector.

Cheers.

Tim.