[mlir] Convert raw data in dense element attributes for big-endian machines.
authorHaruki Imai <imaihal@jp.ibm.com>
Thu, 29 Oct 2020 00:05:32 +0000 (17:05 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Thu, 29 Oct 2020 00:06:16 +0000 (17:06 -0700)
commita66e334cebec0c54ec357436563ddf78e3caab72
treec50a7021c2f6f52119b85a737e776e931289e802
parentbf0440be91a6ea18fc8c1601f7ce6bcc8e6d2300
[mlir] Convert raw data in dense element attributes for big-endian machines.

This patch fixes a bug [[ https://bugs.llvm.org/show_bug.cgi?id=46091 | 46091 ]]

Raw data for the `dense-element attribute` is written in little endian (LE) format.
This commit converts the format to big endian (BE) in ʻAttribute Parser` on the
 BE machine. Also, when outputting on a BE machine, the BE format is converted
 to LE in "AsmPrinter".

Differential Revision: https://reviews.llvm.org/D80695
mlir/include/mlir/IR/Attributes.h
mlir/lib/IR/AsmPrinter.cpp
mlir/lib/IR/Attributes.cpp
mlir/lib/Parser/AttributeParser.cpp
mlir/test/IR/dense-elements-hex.mlir