[LLVMbugs] [Bug 13857] New: Different offsets between extractvalue and insertvalue with x86-64

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Sep 16 00:19:37 PDT 2012


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

             Bug #: 13857
           Summary: Different offsets between extractvalue and insertvalue
                    with x86-64
           Product: libraries
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: marckrb at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The alignment of attributes seems to differ between insertvalue and
extractvalue on x86-64. The structure { i32, i8*, i32 } has offsets 0, 8, 16
with insertvalue but offsets 0, 4, 12 with extractvalue.

Here is an example of code:

define { i32, i8*, i32 } @test(i8*) {
  %a = insertvalue { i32, i8*, i32 } undef, i32 1, 0
  %b = insertvalue { i32, i8*, i32 } %a, i8* %0, 1
  %c = insertvalue { i32, i8*, i32 } %b, i32 2, 2
  ret { i32, i8*, i32 } %c
}

define i8* @main(i8*) {
  %v = call { i32, i8*, i32 } @test(i8* %0)
  %a = extractvalue { i32, i8*, i32 } %v, 1
  ret i8* %a
}

The generated code looks like :

test:    movq    %rsi, 8(%rdi)
    movl    $2, 16(%rdi)
    movl    $1, (%rdi)
    ret

main:    subq    $24, %rsp
    movq    %rdi, %rax
    leaq    (%rsp), %rdi
    movq    %rax, %rsi
    callq    test
    movq    4(%rsp), %rax   ; ## Wrong offset 4 instead of 8
    addq    $24, %rsp
    ret

-- 
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