[PATCH] D122963: [X86] Extend the integer parameter if the function isn't local linked

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 23:23:07 PDT 2022


rjmccall added a comment.

In D122963#3460976 <https://reviews.llvm.org/D122963#3460976>, @LiuChen3 wrote:

> In D122963#3460934 <https://reviews.llvm.org/D122963#3460934>, @rjmccall wrote:
>
>> If people think that we'll reliably get the right behavior by the frontend adding `sext` and `zext` to call sites but not to function arguments, I can walk you through how to make that change in the frontend.
>>
>> What we can't do in the frontend is just switch to unconditionally not using `sext` and `zext` at all on x86_64, because we need to maintain compatibility with old versions of clang.  But we can introduce a flag that makes clang generate incompatible code if someone wants to opt in to it for performance.
>
> Thanks. @rjmccall . I'd like to hear your approach. If the change in FE is not large, I am willing to do it. But if it is too complicated, I may not be able to  do that. Firstly I found we might be able to ignore the attribute in `void CodeGenModule::ConstructAttributeList` in clang/lib/CodeGen/CGCall.cpp , but it is the target independent part, so I gave up.

I think you need to add a new `ConservativeExtend` kind to `ABIArgInfo` and make `X86_64ABIInfo::classifyArgumentType` (and `classifyReturnType`?) use that instead of `Extend`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122963/new/

https://reviews.llvm.org/D122963



More information about the llvm-commits mailing list