[all-commits] [llvm/llvm-project] 6adef0: [X86][regcall] Rework struct classification for no...
Henry Baba-Weiss via All-commits
all-commits at lists.llvm.org
Mon Apr 13 13:04:01 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6adef02db58873b1ef5cd2fac967bf1072567751
https://github.com/llvm/llvm-project/commit/6adef02db58873b1ef5cd2fac967bf1072567751
Author: Henry Baba-Weiss <henry.babaweiss at gmail.com>
Date: 2026-04-13 (Mon, 13 Apr 2026)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/CodeGen/Targets/X86.cpp
M clang/test/CodeGen/regcall.c
M clang/test/CodeGen/regcall4.c
M clang/test/CodeGenCXX/regcall.cpp
M clang/test/CodeGenCXX/regcall4.cpp
Log Message:
-----------
[X86][regcall] Rework struct classification for non-Windows x86-64 targets (#187134)
Currently, when `X86_64ABIInfo::classifyRegCallStructTypeImpl`
classifies a struct argument or return value as direct, it leaves the
LLVM IR coerce type unspecified, implicitly relying on
`CodeGenTypes::ConvertType` to eventually construct a default IR type
based on the struct's layout. This conversion is neither stable nor
guaranteed to adhere to the ABI's classification rules.
Instead, rewrite `classifyRegCallStructTypeImpl` to construct an
explicit sequence of coerce types, using the existing field
classification to obtain a coerce type for each member of the struct.
Also, rename the function to `passRegCallStructTypeDirectly` and return
a boolean instead, so that now `classifyRegCallStructType` is the only
place that computes `ABIArgInfo`.
This rewrite also fixes several other issues with the `X86_64ABIInfo`
implementation of `__regcall`:
* Empty structs are now ignored instead of being misclassified as
direct.
* Arrays are now classified specially based on the element type, since
`X86_64ABIInfo::classifyArgumentType` ignores standalone array types.
* SSE registers used for return values are now correctly reused for
arguments, matching the 64-bit Windows behavior.
Since this is an ABI change, it has the potential to cause
incompatibilities with `__regcall` code compiled by earlier versions of
Clang. Specifically:
* Because SSE return registers can now be reused as argument registers,
functions will now pass more floating point arguments in SSE registers.
* `_Complex float` struct fields are now passed in one SSE register
instead of two.
Fixes #62999
Fixes #98635
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list