diff options
| author | Nicolas Vasilache <ntv@google.com> | 2019-01-03 15:52:34 -0800 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 14:55:05 -0700 |
| commit | 0ebc0ba72ec73d034f03e630974aa75688f546d1 (patch) | |
| tree | e9488d7629229482baa1917d735d41d853d1a12c /mlir/lib/Transforms | |
| parent | 5b87a5ef4b7b38af49932f958c35cd95460ceca3 (diff) | |
| download | bcm5719-llvm-0ebc0ba72ec73d034f03e630974aa75688f546d1.tar.gz bcm5719-llvm-0ebc0ba72ec73d034f03e630974aa75688f546d1.zip | |
[MLIR] More graceful failure in MaterializeVectors
Even though it is unexpected except in pathological cases, a nullptr clone may
be returned. This CL handles the nullptr return gracefuly.
PiperOrigin-RevId: 227764615
Diffstat (limited to 'mlir/lib/Transforms')
| -rw-r--r-- | mlir/lib/Transforms/MaterializeVectors.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mlir/lib/Transforms/MaterializeVectors.cpp b/mlir/lib/Transforms/MaterializeVectors.cpp index bbe2f85319b..e687889cf93 100644 --- a/mlir/lib/Transforms/MaterializeVectors.cpp +++ b/mlir/lib/Transforms/MaterializeVectors.cpp @@ -554,12 +554,15 @@ static bool instantiateMaterialization(Instruction *inst, FuncBuilder b(inst); auto *opInst = cast<OperationInst>(inst); if (auto write = opInst->dyn_cast<VectorTransferWriteOp>()) { - instantiate(&b, write, state->hwVectorType, state->hwVectorInstance, - state->substitutionsMap); - return false; + auto *clone = instantiate(&b, write, state->hwVectorType, + state->hwVectorInstance, state->substitutionsMap); + return clone == nullptr; } else if (auto read = opInst->dyn_cast<VectorTransferReadOp>()) { auto *clone = instantiate(&b, read, state->hwVectorType, state->hwVectorInstance, state->substitutionsMap); + if (!clone) { + return true; + } state->substitutionsMap->insert( std::make_pair(read->getResult(), clone->getResult(0))); return false; |

