[mlir][DictionaryAttr] Add a new getWithSorted and use it when possible
authorRiver Riddle <riddleriver@gmail.com>
Fri, 24 Apr 2020 19:18:18 +0000 (12:18 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Fri, 24 Apr 2020 19:23:32 +0000 (12:23 -0700)
commit0e2bd49370197dd8bf2c36ee0ce1275f7cfb515b
treedb110bba75c74c122586ba61f9e86b59cf64a892
parent063128f97930c551a43a657084f1632e33245bf6
[mlir][DictionaryAttr] Add a new getWithSorted and use it when possible

The elements of a DictionaryAttr are sorted by name. In many situations, e.g NamedAttributeList, we can guarantee that the elements are sorted on construction and remove the need to perform extra checks. In places with lots of calls to attribute methods, this leads to a good performance improvement.

Differential Revision: https://reviews.llvm.org/D78781
mlir/include/mlir/IR/Attributes.h
mlir/lib/IR/Attributes.cpp