[llvm-bugs] [Bug 45275] New: CodeGen doesn't respect stack alignment skew for calls (hhvm call conv.)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 22 07:51:51 PDT 2020


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: unassignedbugs at nondot.org
          Reporter: engelke at in.tum.de
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200322/25d1cbf3/attachment-0001.html>


More information about the llvm-bugs mailing list