[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
Wed Sep 11 14:15:43 PDT 2024


================
@@ -1657,6 +1657,17 @@ LowerUnalignedLoadRetParam(SelectionDAG &DAG, SDValue &Chain, uint64_t Offset,
   return RetVal;
 }
 
+static bool shouldConvertToIndirectCall(const CallBase *CB,
+                                        const GlobalAddressSDNode *Func) {
+  if (!Func)
+    return false;
+  auto *CalleeFunc = dyn_cast<Function>(Func->getGlobal());
+  if (!CalleeFunc)
+    return false;
+
+  return CB->getFunctionType() != CalleeFunc->getFunctionType();
----------------
Artem-B wrote:

```
if(auto *CalleeFunc = dyn_cast<Function>(Func->getGlobal()))
  return CB->getFunctionType() != CalleeFunc->getFunctionType();
return false;
```

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


More information about the llvm-commits mailing list