[all-commits] [llvm/llvm-project] c44946: ms inline asm: Fix {call, jmp} fptr (#73207)

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Nov 27 07:28:06 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c449460d8a657e46500ad12be457928207207e3e
      https://github.com/llvm/llvm-project/commit/c449460d8a657e46500ad12be457928207207e3e
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-11-27 (Mon, 27 Nov 2023)

  Changed paths:
    M clang/test/CodeGen/ms-inline-asm-64.c
    M llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp

  Log Message:
  -----------
  ms inline asm: Fix {call,jmp} fptr (#73207)

https://reviews.llvm.org/D151863 (2023-05) removed
`BaseReg = BaseReg ? BaseReg : 1` (introduced in commit
175d0aeef3725ce17032e9ef76e018139f2f52f0 (2013)) and caused a
regression: ensuring a non-zero `BaseReg` was to treat
`static void (*fptr)(); __asm { call fptr }` as non-`AbsMem`
`AsmOperandClass` and generate `call $0`/`callq *fptr(%rip)` instead of
`call ${0:P}`/`callq *fptr`
(The asm template argument modifier `P` is for call targets, while
no modifier is used by other instructions like `mov rax, fptr`)

This patch reinstates the BaseReg-setting statement but places it inside
`if (IsGlobalLV)` for clarify.

The special case is unfortunate, but we also have special case in
similar places (https://reviews.llvm.org/D149920).

Fix: #73033




More information about the All-commits mailing list