Skip to content

Commit

Permalink
Fix API usage for getting an MLIR interface for an operation
Browse files Browse the repository at this point in the history
This method is an implementation details of the interface mechanism and is
documented as "this should not be used directly". Instead operation should be
"dyn_casted" into the interface directly.

PiperOrigin-RevId: 364723086
  • Loading branch information
joker-eph authored and iree-copybara-bot committed Mar 24, 2021
1 parent 0045449 commit bd27307
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions iree/compiler/Dialect/VM/Target/Bytecode/BytecodeEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,14 @@ Optional<EncodedBytecodeFunction> BytecodeEncoder::encodeFunction(
}

for (auto &op : block.getOperations()) {
auto *serializableOp =
op.getAbstractOperation()->getInterface<IREE::VM::VMSerializableOp>();
auto serializableOp =
dyn_cast<IREE::VM::VMSerializableOp>(op);
if (!serializableOp) {
op.emitOpError() << "is not serializable";
return llvm::None;
}
if (failed(encoder.beginOp(&op)) ||
failed(serializableOp->encode(&op, symbolTable, encoder)) ||
failed(serializableOp.encode(symbolTable, encoder)) ||
failed(encoder.endOp(&op))) {
op.emitOpError() << "failed to encode";
return llvm::None;
Expand Down

0 comments on commit bd27307

Please sign in to comment.