[Mlir-commits] [mlir] 3cce374 - Various improvements suggested by river NFC.

Chris Lattner llvmlistbot at llvm.org
Thu May 12 08:25:11 PDT 2022


Author: Chris Lattner
Date: 2022-05-12T16:18:23+01:00
New Revision: 3cce374ee66373488e7b4c3e113cf4e65b20319b

URL: https://github.com/llvm/llvm-project/commit/3cce374ee66373488e7b4c3e113cf4e65b20319b
DIFF: https://github.com/llvm/llvm-project/commit/3cce374ee66373488e7b4c3e113cf4e65b20319b.diff

LOG: Various improvements suggested by river NFC.

Differential Revision: https://reviews.llvm.org/D125471

Added: 
    

Modified: 
    mlir/include/mlir/IR/BuiltinAttributes.td
    mlir/lib/IR/BuiltinAttributes.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/BuiltinAttributes.td b/mlir/include/mlir/IR/BuiltinAttributes.td
index 19c8a07b94cd..2fab39208838 100644
--- a/mlir/include/mlir/IR/BuiltinAttributes.td
+++ b/mlir/include/mlir/IR/BuiltinAttributes.td
@@ -237,7 +237,7 @@ def Builtin_DenseIntOrFPElementsAttr : Builtin_Attr<
     /// element type of 'type'. 'type' must be a vector or tensor with static
     /// shape.
     ///
-    /// If the `values` array only has a single element, then this  constructs
+    /// If the `values` array only has a single element, then this constructs
     /// splat of that value.
     static DenseElementsAttr getRaw(ShapedType type, size_t storageWidth,
                                     ArrayRef<APFloat> values);
@@ -246,7 +246,7 @@ def Builtin_DenseIntOrFPElementsAttr : Builtin_Attr<
     /// Each APInt value is expected to have the same bitwidth as the element
     /// type of 'type'. 'type' must be a vector or tensor with static shape.
     ///
-    /// If the `values` array only has a single element, then this  constructs
+    /// If the `values` array only has a single element, then this constructs
     /// splat of that value.
     static DenseElementsAttr getRaw(ShapedType type, size_t storageWidth,
                                     ArrayRef<APInt> values);
@@ -254,7 +254,7 @@ def Builtin_DenseIntOrFPElementsAttr : Builtin_Attr<
     /// Get or create a new dense elements attribute instance with the given raw
     /// data buffer. 'type' must be a vector or tensor with static shape.
     ///
-    /// If the `values` array only has a single element, then this  constructs
+    /// If the `values` array only has a single element, then this constructs
     /// splat of that value.
     static DenseElementsAttr getRaw(ShapedType type, ArrayRef<char> data);
 
@@ -315,7 +315,7 @@ def Builtin_DenseStringElementsAttr : Builtin_Attr<
   let builders = [
     AttrBuilderWithInferredContext<(ins "ShapedType":$type,
                                         "ArrayRef<StringRef>":$values), [{
-      return $_get(type.getContext(), type, values, 
+      return $_get(type.getContext(), type, values,
                    /* isSplat */(values.size() == 1));
     }]>,
   ];

diff  --git a/mlir/lib/IR/BuiltinAttributes.cpp b/mlir/lib/IR/BuiltinAttributes.cpp
index 1ecdf183d9ec..76bb3a7bf180 100644
--- a/mlir/lib/IR/BuiltinAttributes.cpp
+++ b/mlir/lib/IR/BuiltinAttributes.cpp
@@ -736,7 +736,8 @@ DenseElementsAttr DenseElementsAttr::get(ShapedType type,
       setBit(buff.data(), i, values[i]);
     }
 
-    if (isSplat) { // special encoding for splat.
+    // Splat of bool is encoded as a byte with all-ones in it.
+    if (isSplat) {
       buff.resize(1);
       buff[0] = values[0] ? -1 : 0;
     }


        


More information about the Mlir-commits mailing list