Fix bytecode reader/writer on big-endian platforms
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Fri, 23 Jun 2023 07:17:53 +0000 (09:17 +0200)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Fri, 23 Jun 2023 07:22:55 +0000 (09:22 +0200)
commitbb0bbed610d86ba155f9c066c23038f7f34e2dbb
tree76ace19cf3abeab8a0da72e9b4d6f81d599d59a5
parent7298bcf7f06145e2d4dfdb177b94dc42fc95dc55
Fix bytecode reader/writer on big-endian platforms

This makes the bytecode reader/writer work on big-endian platforms.
The only problem was related to encoding of multi-byte integers,
where both reader and writer code make implicit assumptions about
endianness of the host platform.

This fixes the current test failures on s390x, and in addition allows
to remove the UNSUPPORTED markers from all other bytecode-related
test cases - they now also all pass on s390x.

Also adding a GFAIL_SKIP to the MultiModuleWithResource unit test,
as this still fails due to an unrelated endian bug regarding
decoding of external resources.

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

Reviewed By: mehdi_amini, jpienaar, rriddle
17 files changed:
mlir/lib/Bytecode/Reader/BytecodeReader.cpp
mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
mlir/test/Bytecode/general.mlir
mlir/test/Bytecode/invalid/invalid-dialect_section.mlir
mlir/test/Bytecode/invalid/invalid-ir_section.mlir
mlir/test/Bytecode/invalid/invalid-string_section.mlir
mlir/test/Bytecode/invalid/invalid-structure.mlir
mlir/test/Bytecode/invalid/invalid_attr_type_offset_section.mlir
mlir/test/Bytecode/invalid/invalid_attr_type_section.mlir
mlir/test/Bytecode/resources.mlir
mlir/test/Bytecode/versioning/versioned_attr.mlir
mlir/test/Bytecode/versioning/versioned_bytecode.mlir
mlir/test/Bytecode/versioning/versioned_op.mlir
mlir/test/Dialect/Builtin/Bytecode/attrs.mlir
mlir/test/Dialect/Builtin/Bytecode/types.mlir
mlir/test/Dialect/Quant/Bytecode/types.mlir
mlir/unittests/Bytecode/BytecodeTest.cpp