[LLVMdev] Load from abs address generated bad code on LLVM 2.4

Óscar Fuentes ofv at wanadoo.es
Mon Jan 19 08:25:21 PST 2009


Andrew Haley <aph at redhat.com> writes:

> This is x86_64.  I have a problem where an absolute memory load
>
> define i32 @foo() {
> entry:
>         %0 = load i32* inttoptr (i64 12704196 to i32*)          ; <i32> [#uses=1]
>         ret i32 %0
> }
>
> generates incorrect code on LLVM 2.4:
>
> 0x7ffff6d54010:	mov    0xc1d9c4(%rip),%eax        # 0x7ffff79719da
> 0x7ffff6d54016:	retq
>
> should be
>
> 0x7ffff6d54010:	mov    0xc1d9c4, %eax
> 0x7ffff6d54016:	retq
>
> i.e. the IP-relative addressing mode is incorrect.

This seems the same as

http://www.llvm.org/bugs/show_bug.cgi?id=2920

which was fixed by an unknown change after the 2.4 release.

> The current LLVM trunk does not have this bug.  This seems quite a nasty
> bug; is there any chance of a bug-fix release for LLVM 2.4, or should I
> just use LLVM trunk until LLVM 2.5 ?

As there ar not 2.x.y releases, your only option is to use LLVM trunk.

-- 
Oscar




More information about the llvm-dev mailing list