[Mlir-commits] [mlir] 2ef44aa - [MLIR][Bytecode] Add missing field initializer in constructor initializer list

Mehdi Amini llvmlistbot at llvm.org
Wed Aug 2 23:31:11 PDT 2023


Author: Mehdi Amini
Date: 2023-08-02T23:31:01-07:00
New Revision: 2ef44aa443ba38cbad9fb94027324ed277931c32

URL: https://github.com/llvm/llvm-project/commit/2ef44aa443ba38cbad9fb94027324ed277931c32
DIFF: https://github.com/llvm/llvm-project/commit/2ef44aa443ba38cbad9fb94027324ed277931c32.diff

LOG: [MLIR][Bytecode] Add missing field initializer in constructor initializer list

Leaving this field unitialized could led to crashes when it'll diverge from the
IRNumbering phase.

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

Added: 
    mlir/test/Bytecode/operand_segment_sizes.mlir

Modified: 
    mlir/lib/Bytecode/Writer/BytecodeWriter.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
index 75315b5ec75e3d..5628ff6c54af67 100644
--- a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
+++ b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
@@ -344,8 +344,8 @@ class DialectWriter : public DialectBytecodeWriter {
   DialectWriter(int64_t bytecodeVersion, EncodingEmitter &emitter,
                 IRNumberingState &numberingState,
                 StringSectionBuilder &stringSection)
-      : emitter(emitter), numberingState(numberingState),
-        stringSection(stringSection) {}
+      : bytecodeVersion(bytecodeVersion), emitter(emitter),
+        numberingState(numberingState), stringSection(stringSection) {}
 
   //===--------------------------------------------------------------------===//
   // IR

diff  --git a/mlir/test/Bytecode/operand_segment_sizes.mlir b/mlir/test/Bytecode/operand_segment_sizes.mlir
new file mode 100644
index 00000000000000..9791bd4e0f264c
--- /dev/null
+++ b/mlir/test/Bytecode/operand_segment_sizes.mlir
@@ -0,0 +1,8 @@
+// RUN: mlir-opt -emit-bytecode %s | mlir-opt | FileCheck %s
+
+
+func.func @roundtripOperandSizeAttr(%arg0: i32) {
+  // CHECK: odsOperandSegmentSizes = array<i32: 0, 2, 1, 1>}>
+  "test.attr_sized_operands"(%arg0, %arg0, %arg0, %arg0) <{odsOperandSegmentSizes = array<i32: 0, 2, 1, 1>}> : (i32, i32, i32, i32) -> ()
+  return
+}


        


More information about the Mlir-commits mailing list