[LLVMdev] Help with Values sign

Santos Merino santitox at hotmail.es
Sun May 27 04:03:43 PDT 2012


Hi everyone, I'm having some problems when loading values. Here's a simple
example of the IR that my compiler generates to show the problem:

define i32 @main() {
entry:
  %a = alloca i32                                 ; <i32*> [#uses=2]
  store i32 1, i32* %a
  %r = load i32* %a                               ; <i32> [#uses=1]
  br label %Return

Return:                                           ; preds = %entry
  ret i32 %r
}

but instead of return 1 it returns 16777216. I have tested the program with
different values and it seems that it's a matter of internal binary
representation of integer values.

Thanks in advance.

Santos Merino del Pozo.





More information about the llvm-dev mailing list