[mlir:Parser] Always splice parsed operations to the end of the parsed block
The current splicing behavior dates back to when all blocks had terminators, so we would "helpfully" splice before the terminator. This doesn't make sense anymore, and leads to somewhat unexpected results when parsing multiple pieces of IR into the same block. Differential Revision: https://reviews.llvm.org/D135096
This commit is contained in:
@@ -1414,8 +1414,7 @@ LogicalResult BytecodeReader::parseIRSection(ArrayRef<uint8_t> sectionData,
|
||||
// Splice the parsed operations over to the provided top-level block.
|
||||
auto &parsedOps = moduleOp->getBody()->getOperations();
|
||||
auto &destOps = block->getOperations();
|
||||
destOps.splice(destOps.empty() ? destOps.end() : std::prev(destOps.end()),
|
||||
parsedOps, parsedOps.begin(), parsedOps.end());
|
||||
destOps.splice(destOps.end(), parsedOps, parsedOps.begin(), parsedOps.end());
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user