diff options
| author | Matteo Franciolini <mfranciolini@tesla.com> | 2024-02-20 21:40:36 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-20 21:40:36 -0800 |
| commit | 5375cbfb6255ed19a6bed7065a697905ca65d575 (patch) | |
| tree | 92f7efbe144bd079bbd86d1576e108b2726d6df4 /mlir/lib/Bytecode/Reader/BytecodeReader.cpp | |
| parent | a2afcd5721869d1d03c8146bae3885b3385ba15e (diff) | |
| download | llvm-5375cbfb6255ed19a6bed7065a697905ca65d575.zip llvm-5375cbfb6255ed19a6bed7065a697905ca65d575.tar.gz llvm-5375cbfb6255ed19a6bed7065a697905ca65d575.tar.bz2 | |
Fix pipeline-invalid.mlir bytecode roundtrip test (#82366)
If an op was not contained in a region when was written to bytecode,
we don't have an initialized valueScope with forward references to
define.
Diffstat (limited to 'mlir/lib/Bytecode/Reader/BytecodeReader.cpp')
| -rw-r--r-- | mlir/lib/Bytecode/Reader/BytecodeReader.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp index 7cf3bd83..d6163406 100644 --- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp +++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp @@ -2334,8 +2334,11 @@ BytecodeReader::Impl::parseOpWithoutRegions(EncodingReader &reader, Operation *op = Operation::create(opState); readState.curBlock->push_back(op); - // If the operation had results, update the value references. - if (op->getNumResults() && failed(defineValues(reader, op->getResults()))) + // If the operation had results, update the value references. We don't need to + // do this if the current value scope is empty. That is, the op was not + // encoded within a parent region. + if (readState.numValues && op->getNumResults() && + failed(defineValues(reader, op->getResults()))) return failure(); /// Store a map for every value that received a custom use-list order from the |
