[llvm] [RISCV] Handle RVV return type in calling convention correctly (PR #87736)

Brandon Wu via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 8 01:29:58 PDT 2024


================
@@ -409,7 +409,7 @@ bool RISCVCallLowering::lowerReturnVal(MachineIRBuilder &MIRBuilder,
   splitToValueTypes(OrigRetInfo, SplitRetInfos, DL, CC);
 
   RVVArgDispatcher Dispatcher{&MF, getTLI<RISCVTargetLowering>(),
-                              F.getReturnType()};
+                              ArrayRef(F.getReturnType())};
----------------
4vtomat wrote:

Yeah we do, since `ArrayRef` is also a template class, it can't deduct the type, you can try a simple example:
```
    1 template <typename T>
    2 class abc {
    3 public:
    4   abc(T);
    5 };
    6
    7 template <typename T>
    8 void test(abc<T> a);
    9
   10 int main()
   11 {
   12   test(1);
   13 }
```
the code can't compile since `void test(abc<T> a)` doesn't know that 1 can be implicitly constructed, it only know that 1's type is not equal to `abc` lol~

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


More information about the llvm-commits mailing list