|
9 | 9 | #include "IRNumbering.h" |
10 | 10 | #include "mlir/Bytecode/BytecodeImplementation.h" |
11 | 11 | #include "mlir/Bytecode/BytecodeOpInterface.h" |
| 12 | +#include "mlir/Bytecode/Encoding.h" |
12 | 13 | #include "mlir/IR/AsmState.h" |
13 | 14 | #include "mlir/IR/BuiltinTypes.h" |
14 | 15 | #include "mlir/IR/OpDefinition.h" |
@@ -425,17 +426,20 @@ void IRNumberingState::number(Operation &op) { |
425 | 426 |
|
426 | 427 | // Only number the operation's dictionary if it isn't empty. |
427 | 428 | DictionaryAttr dictAttr = op.getDiscardableAttrDictionary(); |
428 | | - // Prior to version 5, or when properties are not used, we need to number also |
429 | | - // the merged dictionary containing both the inherent and discardable |
430 | | - // attribute. |
431 | | - if (config.getDesiredBytecodeVersion() < 5 || !op.getPropertiesStorage()) |
| 429 | + // Prior to a version with native property encoding, or when properties are |
| 430 | + // not used, we need to number also the merged dictionary containing both the |
| 431 | + // inherent and discardable attribute. |
| 432 | + if (config.getDesiredBytecodeVersion() < |
| 433 | + bytecode::kNativePropertiesEncoding || |
| 434 | + !op.getPropertiesStorage()) { |
432 | 435 | dictAttr = op.getAttrDictionary(); |
| 436 | + } |
433 | 437 | if (!dictAttr.empty()) |
434 | 438 | number(dictAttr); |
435 | 439 |
|
436 | 440 | // Visit the operation properties (if any) to make sure referenced attributes |
437 | 441 | // are numbered. |
438 | | - if (config.getDesiredBytecodeVersion() >= 5 && |
| 442 | + if (config.getDesiredBytecodeVersion() >= bytecode::kNativePropertiesEncoding && |
439 | 443 | op.getPropertiesStorageSize()) { |
440 | 444 | if (op.isRegistered()) { |
441 | 445 | // Operation that have properties *must* implement this interface. |
|
0 commit comments