[PATCH] D104663: [OpaquePtr] Remove checking pointee type for byval/preallocated type

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 22 15:05:35 PDT 2021


rnk added a comment.

In D104663#2834505 <https://reviews.llvm.org/D104663#2834505>, @aeubanks wrote:

> I never read the LangRef carefully enough, apparently we already expect ABI attributes to match [1]:
>
>   All ABI-impacting function attributes, such as sret, byval, inreg, returned, and inalloca, must match.
>
> [1]: https://llvm.org/docs/LangRef.html#id327

That text is part of the section documenting how `musttail` works, and it's trying to make the statement that the prototype of the musttail call site must exactly match the prototype of the function making the tail call.

So far as I know, there isn't a general statement on what happens when attributes mismatch. I would try to infer it from what happens when function prototypes do not match, i.e. does the langref say what happens when you pass i64 to a function expecting i32? I think this area is underspecified. In practice, prototype mismatch cannot be optimized to UB / unreachable. Instcombine will try to "fix up" prototypes that almost match, mainly to support use cases like LTO.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104663



More information about the llvm-commits mailing list