https://bugs.llvm.org/show_bug.cgi?id=45275

            Bug ID: 45275
           Summary: CodeGen doesn't respect stack alignment skew for calls
                    (hhvm call conv.)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedb...@nondot.org
          Reporter: enge...@in.tum.de
                CC: llvm-bugs@lists.llvm.org

When calling a function with the HHVM calling convention, the stack pointer
skewing of 8 bytes is not respected. hhvmcc (on x86-64) has a stack pointer
alignment of 16 bytes, which is skewed by 8 bytes, so that on entry the stack
pointer has a value of 0x...0 (instead of the usual 0x...8 with cdecl). This
skewing is ignored when generating code for a call to a hhvmcc function, making
it impossible to correctly call hhvmcc functions from LLVM.

Example:

    declare hhvmcc i64 @callee(i64)
    define hhvmcc i64 @caller(i64 %arg) {
      %res = notail call hhvmcc i64 @callee(i64 %arg)
      ret i64 %res
    }

Yields: 

    caller:
      call callee // <-- stack will be mis-aligned
      ret

Note that in this example "correct" code is generated when using a tail call.

PS: I'd also be willing to take a look at this myself, but I need some pointers
where to start...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to