[PATCH] D78781: [mlir][DictionaryAttr] Add a new getWithSorted and use it when possible

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 24 09:09:46 PDT 2020


mehdi_amini added inline comments.


================
Comment at: mlir/include/mlir/IR/Attributes.h:279
 
+  /// Construct a dictionary attribute with the provided set of named
+  /// attributes.
----------------
jpienaar wrote:
> Set confuses me here, is it meant to convey unordered? (an alternative is just to say array or vector as by default there is no assumption that it would be sorted specially IMHO)
I would document here that is the client can guarantee that the array is sorted they should use the other method for performance 


================
Comment at: mlir/lib/IR/Attributes.cpp:101
+  // a difference.
+  return strncmp(attr.first.data(), name.data(), name.size()) < 0;
+}
----------------
If Attr is a non zero terminated string that is a prefix of name, won’t this read out of bound?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78781/new/

https://reviews.llvm.org/D78781





More information about the llvm-commits mailing list