Is this value an integer type?

Hello,

I have a problem of dumping a value. Here is the llvm assembly code:

Hello,

I have a problem of dumping a value. Here is the llvm assembly code:

---
%322 = getelementptr inbounds [76 x [4 x i8]]* @i_tc0_table, i32 0,
i32 %305, i32 %321 ; <i8*> [#uses=1]
%323 = load i8* %322, align 1 ; <i8> [#uses=1]
store i8 %323, i8* %89, align 1
--

I want to dump %323 to a library function whose prototype is:

recordStore(const char*, unsigned int, unsigned, int)

To pass an i8 as i32 you need either sign-, or zero-extension, i.e.
%324 = zext i8 %323 to i32
call %recordStore(null, %324, i32 0)

For example.

***** Why %323 is different from the Integer type I has declared?

i8 and i32 are different types

Best regards,
--Edwin

Hi Zheng,

  %323 = load i8* %322, align 1 ;<i8> [#uses=1]

the type of %323 is i8, as noted in the comment at the end of the line.

This is strange because the fourth argument of recordStore has been
declared as: "IntegerType::get(getGlobalContext(), 32)"

This type is i32. Since i8 != i32, the types don't match.

Ciao,

Duncan.

Thanks all!!
Problem Solved. :slight_smile: