[llvm] [LV] Use requested calling convention for vector math routines (PR #136122)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 04:13:33 PDT 2025


================
@@ -1231,6 +1231,8 @@ void VPWidenCallRecipe::execute(VPTransformState &State) {
 
   CallInst *V = State.Builder.CreateCall(Variant, Args, OpBundles);
   setFlags(V);
+  if (CallingConv::ID ID = Variant->getCallingConv())
+    V->setCallingConv(ID);
----------------
paulwalker-arm wrote:

I'm not sure why IRBuilder doesn't do this itself but I see this idiom used all over the place so I'll not worry about it.

That said, looking at existing uses can `Function::getCallingConv()` fail?  Other instanced just do:
```
CallInst *V = State.Builder.CreateCall(Variant, Args, OpBundles);
V->setCallingConv(Variant->getCallingConv());
```

FYI: GitHub will not let me attach this to the relevant line but for information I note just above there is the assert
```
assert(Variant != nullptr && "Can't create vector function.");
```
and yet on entry to the function we've already done
```
FunctionType *VFTy = Variant->getFunctionType();
```

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


More information about the llvm-commits mailing list