Skip to content

Commit ba505a7

Browse files
author
Mogball
committed
[mlir] Slightly optimize bytecode op numbering
If the bytecode encoding supports properties, then the dictionary attribute is always the raw dictionary attribute of the operation, regardless of what it contains. Otherwise, get the dictionary attribute from the op: if the op does not have properties, then it returns the raw dictionary, otherwise it returns the combined inherent and discardable attributes.
1 parent f81879c commit ba505a7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

mlir/lib/Bytecode/Writer/IRNumbering.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,17 +429,18 @@ void IRNumberingState::number(Operation &op) {
429429
// Prior to a version with native property encoding, or when properties are
430430
// not used, we need to number also the merged dictionary containing both the
431431
// inherent and discardable attribute.
432-
if (config.getDesiredBytecodeVersion() <
433-
bytecode::kNativePropertiesEncoding ||
434-
!op.getPropertiesStorage()) {
432+
DictionaryAttr dictAttr;
433+
if (config.getDesiredBytecodeVersion() >= bytecode::kNativePropertiesEncoding)
434+
dictAttr = op.getRawDictionaryAttrs();
435+
else
435436
dictAttr = op.getAttrDictionary();
436-
}
437437
if (!dictAttr.empty())
438438
number(dictAttr);
439439

440440
// Visit the operation properties (if any) to make sure referenced attributes
441441
// are numbered.
442-
if (config.getDesiredBytecodeVersion() >= bytecode::kNativePropertiesEncoding &&
442+
if (config.getDesiredBytecodeVersion() >=
443+
bytecode::kNativePropertiesEncoding &&
443444
op.getPropertiesStorageSize()) {
444445
if (op.isRegistered()) {
445446
// Operation that have properties *must* implement this interface.

0 commit comments

Comments
 (0)