[LLVMbugs] [Bug 4404] New: Incorrect X86 code for trivial LL assembly

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Jun 16 22:39:32 PDT 2009


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

           Summary: Incorrect X86 code for trivial LL assembly
           Product: libraries
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: major
          Priority: P2
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: evan at fallingsnow.net
                CC: llvmbugs at cs.uiuc.edu


Given this C:

int load() {
  int* ptr = (int*)0xabcfed;
  return *ptr;
}


Generates LL (using llvm-gcc -emit-llvm -O2 -S -o scratch/load.ll
scratch/load.c):

; ModuleID = 'scratch/load.c'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9"

define i32 @load() nounwind  {
entry:
        load i32* inttoptr (i64 11259885 to i32*), align 4              ;
<i32>:0 [#uses=1]
        ret i32 %0
}

Generates this x86 (using llvm-as < scratch/load.ll | llc -march=x86):

        .text
        .align  4,0x90
        .globl  _load
_load:
LBB1_0: ## entry
        movl    11259885, %eax
        ret

        .subsections_via_symbols


This seems quite wrong. The x86 code contains no load from the address, just
the address itself left in %eax.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list