[llvm] [NVPTX] Convert calls to indirect when call signature mismatches function signature (PR #107644)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 12:00:35 PDT 2024


Artem-B wrote:

> ```
> %struct.1 = type <{i64}>
> %struct.2 = type <{i64}>
> declare %struct.1 @callee()
> ...
> %call1 = call %struct.2 @callee()
> %call2 = call i64 @callee()
```

Hmm. I wasn't aware that one is allowed to do this in LLVM. 

In your example all variants expect to see 64 bits of data returned, but what's supposed to happen if I decide to do `%call2 = call i128 @callee()` or have ` i8 callee()` ?

LLVM IR appears to enforce prototype match on `musttail` calls http://releases.llvm.org/11.0.1/docs/LangRef.html#id325, and outlines some expectations in the calling conventions section https://releases.llvm.org/11.0.1/docs/LangRef.html#id1218 but I do not see anything more specific.

Before we proceed with the patch, I want to understand what's the right thing to do here. 



https://github.com/llvm/llvm-project/pull/107644


More information about the llvm-commits mailing list