[llvm] [LangRef] Add a description of the semantics of call signatures. (PR #136189)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 18 06:49:48 PDT 2025
arsenm wrote:
> I agree with @joker-eph this feels like a bug. However, this PR codifies existing behavior, which seems fair to me. Hope someone puts an RFC at some point though.
It feels like a bug at first glance, but it most definitively not a bug. Statically determinable undefined behavior is not invalid IR, nor should it be. This case is not unique and not deserving of special treatment for the same reason we don't make store to null pointer invalid IR, and it is useful to have statically representable UB situations.
If we were to mandate that callsite types match, it now introduces special case that imposes restrictions on what IR transforms are possible, which brings API complexity and compile time costs to avoid. Any IR transform that touches a pointer cannot simply do a RAUW or other propagation of the value, just in case it happens to be a function which ends up appearing in a mismatched call site. Every piece of code touching a pointer now needs to defend against source programming errors, and inspect all users of the value inflating the impact of this edge case.
Making this a structural IR rule is worse. We could change something about the syntax, or at most make it a warning. We already have the rarely used lint pass, we could consider starting to emit warnings directly from the text asm parser.
https://github.com/llvm/llvm-project/pull/136189
More information about the llvm-commits
mailing list