aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
diff options
context:
space:
mode:
authorKevin McAfee <kmcafee@nvidia.com>2024-09-16 13:08:18 -0700
committerGitHub <noreply@github.com>2024-09-16 13:08:18 -0700
commit62cdc2a347584f32dd9c351b2384c873da0f32ad (patch)
tree00d11058f9533066b8c091d8a04fd7bdca83fc0b /llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp
parent4eb978026152772bcdd139899e8d0192f7ddbc11 (diff)
downloadllvm-62cdc2a347584f32dd9c351b2384c873da0f32ad.zip
llvm-62cdc2a347584f32dd9c351b2384c873da0f32ad.tar.gz
llvm-62cdc2a347584f32dd9c351b2384c873da0f32ad.tar.bz2
[NVPTX] Convert calls to indirect when call signature mismatches function signature (#107644)
When there is a function signature mismatch between a call instruction and the callee, lower the call to an indirect call. The current behavior is to produce direct calls that may or may not be valid PTX. Consider the following example with mismatching return types: ``` %struct.1 = type <{i64}> %struct.2 = type <{i64}> declare %struct.1 @callee() ... %call1 = call %struct.2 @callee() %call2 = call i64 @callee() ``` The return type of `callee` in PTX is `.b8 _[8]`. The return type of `%call1` will be the same and so the PTX has no problems. The return type of `%call2` will be `.b64`, so the types will not match and PTX will be unacceptable to ptxas. This despite all the types having the same size. The same is true for mismatching parameter types. If we instead convert these calls to indirect calls, we will generate functional PTX when the types have the same size. If they do not have the same size then the PTX will likely be incorrect, though this will not necessarily be caught by ptxas. Also, even if the sizes are the same, if the types differ then it is technically undefined behavior. This change allows for more flexibility in the bitcode that can be lowered to functioning PTX, at the cost of sometimes producing PTX that is less clearly wrong than it would have been previously (i.e. incorrect indirect calls are not as obviously wrong as incorrect direct calls). We consider it okay to generate PTX with undefined behavior as the behavior of calls with mismatching types is not explicitly defined.
Diffstat (limited to 'llvm/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp')
0 files changed, 0 insertions, 0 deletions