[mlir] Add an assertion on creating an Operation with null result types
authorAlex Zinenko <zinenko@google.com>
Thu, 19 Nov 2020 18:35:35 +0000 (19:35 +0100)
committerAlex Zinenko <zinenko@google.com>
Thu, 19 Nov 2020 21:28:38 +0000 (22:28 +0100)
commit9bb5bff570140d4fc5b1750ca7352b840dd58ed7
treeca85113cc87b92161520d4983c70d9d5ee694b18
parent6c1c308c0e170e86da4a06bb4e95cb9038494b90
[mlir] Add an assertion on creating an Operation with null result types

Null types are commonly used as an error marker. Catch them in the constructor
of Operation if they are present in the result type list, as otherwise this
could lead to further surprising behavior when querying op result types.

Fix AsyncToLLVM and StandardToLLVM that were using null types when constructing
operations.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D91770
mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
mlir/lib/IR/Operation.cpp
mlir/lib/IR/TypeRange.cpp
mlir/test/Conversion/StandardToLLVM/standard-to-llvm.mlir