[Mlir-commits] [mlir] [MLIR][LLVM] Add vararg support in LLVM::LLVMFuncOp (PR #67274)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Sep 25 02:20:53 PDT 2023


================
@@ -950,6 +950,16 @@ static void printStoreType(OpAsmPrinter &printer, Operation *op,
 // CallOp
 //===----------------------------------------------------------------------===//
 
+namespace {
+static TypeRange getCallOpResults(LLVMFunctionType calleeType) {
+  SmallVector<Type> results;
+  Type resultType = calleeType.getReturnType();
+  if (!llvm::isa<LLVM::LLVMVoidType>(resultType))
+    results.push_back(resultType);
+  return results;
----------------
ftynse wrote:

TypeRange is a non-owning container, essentially a pointer and a size. This will return a pointer to the vector allocated on the stack of the current function, so invalid after the function returns leading to UB. Return the vector instead.

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


More information about the Mlir-commits mailing list