[LLVMbugs] [Bug 17345] New: Incorrect code generated for dynamic alloca with alignment

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 24 08:56:25 PDT 2013


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

            Bug ID: 17345
           Summary: Incorrect code generated for dynamic alloca with
                    alignment
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: zvi.rackover at intel.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

For the following test,

define i32 @A(i32 %Size) {
entry:
  %A = alloca i8, i32 %Size, align 128
  %A_addr = ptrtoint i8* %A to i32
  ret i32 %A_addr
}

llc -mtriple=x86_64-linux generates:
1:        pushq   %rbp
2:        movq    %rsp, %rbp
3:        pushq   %rbx
4:        andq    $-128, %rsp
5:        subq    $128, %rsp
6:        movq    %rsp, %rbx
7:        movq    %rsp, %rax
8:        andq    $-128, %rax
9:        movl    %edi, %ecx
10:       addq    $15, %rcx
11:       andq    $-16, %rcx
12:       subq    %rcx, %rax
13:       movq    %rax, %rsp
14:       leaq    -8(%rbp), %rsp
15:       popq    %rbx
16:       popq    %rbp
17:       ret

There is no guarantee that the returned value in %rax will be a multiple of
128, which is the required alignment (but it will be a multiple of 16).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130924/6c0e6b51/attachment.html>


More information about the llvm-bugs mailing list