[clang] [llvm] [LLVMABI] Add support for SVE types in the LLVM ABI library (PR #221375)

Madhur Amilkanthwar via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 9 00:28:44 PDT 2026


https://github.com/madhur13490 requested changes to this pull request.

The type mapping looks right, and I like that the IR spellings (tuple → struct of N, svcount → aarch64.svcount) match what CodeGenTypes already produces. Single SVE vectors, svbool_t, and __SVCount_t all classify identically to the classic path, so those are correct.

The change that maps SVE types now routes them into AArch64TargetInfo::classifyArgumentType, whose vector path is still just reportNYI(...) + getDirect(). That warning doesn't gate anything, and shouldUseLLVMABILowering is on for every AArch64 function, so the getDirect() gets used. For an SVE tuple that AAPCS64 passes indirectly once the Z/P registers are full (§5.10 + rule C.8; Clang does this in `coerceAndExpandPureScalableAggregate`), we now disagree with the classic path. I applied the patch on a debug build and it aborts:

`void f(svint32x4_t a, svint32x2_t b, svint32x4_t c) {}   // 4+2+4 = 10 > 8 Z regs`
```
warning: Vector argument type handling is not yet implemented ...   (x3)
For argument 2 of type __clang_svint32x4_t: Kind mismatch (expected: Indirect, given: Direct)
<aborts>
```
Release would silently miscompile the call instead. Since the fix lives in llvm/lib/ABI/Targets/AArch64.cpp, I think this PR either needs to grow to cover it — gate SVE out in `shouldUseLLVMABILowering`, or implement the indirect-on-exhaustion path — or the description should be explicit that `-fexperimental-abi-lowering` isn't safe for SVE signatures yet. 

Two more things that belong here because they're in an untouched file (llvm/lib/ABI/Targets/AArch64.cpp):

The getDirect() fallback for vectors in `classifyArgumentType/classifyReturnType` is the actual place the fix goes.
The comment in `passAsAggregateType` — "For now, they don't get through the type mapper" — is no longer true after this change; please update it here or in a follow-up.

CI: the red "Build and Test Linux AArch64" check is a runner out-of-disk error, I think not a real failure.

https://github.com/llvm/llvm-project/pull/221375


More information about the cfe-commits mailing list