[PATCH] D140401: [clang][RISCV] Fix ABI mismatch between GCC and Clang (extension of integers on stack)

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 07:26:20 PST 2022


asb created this revision.
asb added reviewers: kito-cheng, jrtc27, reames, craig.topper.
Herald added subscribers: wingo, sunshaoce, pmatos, VincentWu, StephenFan, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, arichardson.
Herald added a project: All.
asb requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.

See https://github.com/llvm/llvm-project/issues/57261 for full details. Essentially, a previous version of the psABI indicated (by my reading) that integer scalars passed on the stack were anyext. A later
commit <https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/cec39a064ee0e5b0129973fffab7e3ad1710498f> changed this to indicate that they are in fact signext/zeroext just as if they were passed in registers.

This patch adjusts Clang's ABI lowering to match this. A flag wasn't added to retain the old behaviour, as the hope is that it's sufficiently hard to trigger an issue due to this that it isn't worthwhile doing so.


https://reviews.llvm.org/D140401

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/CodeGen/TargetInfo.cpp
  clang/test/CodeGen/RISCV/riscv32-abi.c
  clang/test/CodeGen/RISCV/riscv64-abi.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140401.484266.patch
Type: text/x-patch
Size: 22241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221220/ed8600ff/attachment.bin>


More information about the llvm-commits mailing list