[all-commits] [llvm/llvm-project] f61543: fix stack probe lowering for x86_intrcc

Tom Dohrmann via All-commits all-commits at lists.llvm.org
Tue May 9 01:31:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f6154364f65709df234f07ad1fe8799e68d84134
      https://github.com/llvm/llvm-project/commit/f6154364f65709df234f07ad1fe8799e68d84134
  Author: Tom Dohrmann <erbse.13 at gmx.de>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    M llvm/lib/Target/X86/X86FrameLowering.cpp
    M llvm/test/CodeGen/X86/x86-64-intrcc.ll

  Log Message:
  -----------
  fix stack probe lowering for x86_intrcc

The x86_intrcc calling convention will build two STACKALLOC_W_PROBING machine instructions if the function takes an error code. This is caused by an additional call to emitSPUpdate in llvm/lib/Target/X86/X86FrameLowering.cpp:1650. Previously only the first STACKALLOC_W_PROBING machine instruction was properly handled, the second one was simply ignored. This lead to miscompilations where the stack pointer wasn't properly updated (see https://github.com/rust-lang/rust/issues/109918). This patch fixes this by handling all STACKALLOC_W_PROBING machine instructions.

To be honest I don't quite understand why this didn't lead to more noticeable miscompilations previously.

This is my first time contributing to LLVM.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D150033




More information about the All-commits mailing list