This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Extract DictionaryAttr sort method
ClosedPublic

Authored by jpienaar on Apr 28 2020, 8:05 AM.

Details

Summary

Enable sorting array of NamedAttributes, as would be expected by getWithSorted, into static member function so that external callers can get same sorting behavior while keeping sorting logic local.

Diff Detail

Event Timeline

jpienaar created this revision.Apr 28 2020, 8:05 AM
Herald added a project: Restricted Project. · View Herald Transcript
rriddle added inline comments.Apr 28 2020, 10:51 AM
mlir/lib/IR/Attributes.cpp
109

Please use camelCase naming.

126

Can we change this to storage.append({value[1], value[0]}); to make this a one liner?

131–132

Just use llvm::is_sorted here?

160

Why not pass in array twice here?

jpienaar updated this revision to Diff 260769.Apr 28 2020, 2:18 PM
jpienaar marked 4 inline comments as done.

Update to address review comments.

jpienaar updated this revision to Diff 260771.Apr 28 2020, 2:31 PM

Reuse compareNamedAttributes instead of using strcmp in is_sorted

rriddle accepted this revision.Apr 29 2020, 12:12 PM
rriddle added inline comments.
mlir/include/mlir/IR/OperationSupport.h
314

Can we defer this until it is needed?

mlir/lib/IR/Attributes.cpp
111

Can we remove this now?

This revision is now accepted and ready to land.Apr 29 2020, 12:12 PM
jpienaar updated this revision to Diff 261000.Apr 29 2020, 1:09 PM
jpienaar marked 2 inline comments as done.

Remove uncalled site

This revision was automatically updated to reflect the committed changes.