OSDN Git Service

[mlir] Check for type conversion success in std->llvm function conversion
authorAlex Zinenko <zinenko@google.com>
Thu, 3 Sep 2020 08:05:25 +0000 (10:05 +0200)
committerAlex Zinenko <zinenko@google.com>
Mon, 14 Sep 2020 11:16:42 +0000 (13:16 +0200)
commit5cac85c931d95f3c94f79837a3bf406eb68edaeb
tree78a876fc9d8b77e97678c6ca2bdfb2da2b5815c1
parent06fb4e90649f264a129d3ad2a08fd3492ee78651
[mlir] Check for type conversion success in std->llvm function conversion

Type converter may fail and return nullptr on unconvertible types. The function
conversion did not include a check and was attempting to use a nullptr type to
construct an LLVM function, leading to a crash. Add a check and return early.
The rest of the call stack propagates errors properly.

Fixes PR47403.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D87075
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
mlir/test/Conversion/StandardToLLVM/invalid.mlir