ConvertStandardToLLVM: replace assertion with graceful failure

The assertion was introduced in the early days of dialect conversion
infrastructure when we had the matching function separate from the rewriting
function. The infrastructure evolved to have a common matchAndRewrite function
and the separate matching function was dropped without chaning the rewriting
that became matchAndRewrite. This has led to assertion being triggered. Return
a matchFailure instead of failing an assertion on unsupported types.

Closes tensorflow/mlir#230

PiperOrigin-RevId: 281113741
This commit is contained in:
Alex Zinenko 2019-11-18 11:25:52 -08:00 committed by A. Unique TensorFlower
parent 68a8da4a93
commit 062dd406b1
1 changed files with 2 additions and 2 deletions

View File

@ -565,8 +565,8 @@ struct OneToOneLLVMOpLowering : public LLVMLegalizationPattern<SourceOp> {
if (numResults != 0) {
packedType = this->lowering.packFunctionResults(
llvm::to_vector<4>(op->getResultTypes()));
assert(packedType && "type conversion failed, such operation should not "
"have been matched");
if (!packedType)
return this->matchFailure();
}
auto newOp = rewriter.create<TargetOp>(op->getLoc(), packedType, operands,