[Mlir-commits] [mlir] 14de3d5 - [mlir][llvm] Don't return a dangling reference in getCallableResults().

Tobias Gysi llvmlistbot at llvm.org
Tue Oct 25 06:06:35 PDT 2022


Author: Johannes de Fine Licht
Date: 2022-10-25T16:05:33+03:00
New Revision: 14de3d5c634bfacb24e16ebe14dc3b608fb0be9a

URL: https://github.com/llvm/llvm-project/commit/14de3d5c634bfacb24e16ebe14dc3b608fb0be9a
DIFF: https://github.com/llvm/llvm-project/commit/14de3d5c634bfacb24e16ebe14dc3b608fb0be9a.diff

LOG: [mlir][llvm] Don't return a dangling reference in getCallableResults().

Use the `getReturnTypes()` API (which returns an `ArrayRef<Type>`)
rather than the `getReturnType()` API (which returns a `Type`) to avoid
returning a dangling reference in `LLVMFuncOp::getCallableResults()`.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D136669

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 18b7083c3591b..bcf55e18af0a7 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -1341,7 +1341,7 @@ def LLVM_LLVMFuncOp : LLVM_Op<"func", [
     Region *getCallableRegion() { return &getBody(); }
 
     /// Returns the callable result type, which is the function return type.
-    ArrayRef<Type> getCallableResults() { return getFunctionType().getReturnType(); }
+    ArrayRef<Type> getCallableResults() { return getFunctionType().getReturnTypes(); }
 
   }];
 


        


More information about the Mlir-commits mailing list