aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaruki Imai <imaihal@jp.ibm.com>2021-06-16 18:37:32 -0700
committerRiver Riddle <riddleriver@gmail.com>2021-06-16 18:38:08 -0700
commit5a55205bb31f2cbc7573656da61cb9eb923bc8cc (patch)
tree162b7322cfffcb63917a40ad6bf25efc16771060
parent07481b37961f5b9a670c924367d2ead2e3c32b86 (diff)
downloadllvm-5a55205bb31f2cbc7573656da61cb9eb923bc8cc.zip
llvm-5a55205bb31f2cbc7573656da61cb9eb923bc8cc.tar.gz
llvm-5a55205bb31f2cbc7573656da61cb9eb923bc8cc.tar.bz2
[mlir] Fixed dynamic operand storage on big-endian machines.
Many tests fails by D101969 (https://reviews.llvm.org/D101969) on big-endian machines. This patch changes bit order of TrailingOperandStorage in big-endian machines. This patch works on System Z (Triple = "s390x-ibm-linux", CPU = "z14"). Signed-off-by: Haruki Imai <imaihal@jp.ibm.com> Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D104225
-rw-r--r--mlir/include/mlir/IR/OperationSupport.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index 20d73cc..c1f7a1a 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -484,7 +484,11 @@ namespace detail {
/// This class contains the information for a trailing operand storage.
struct TrailingOperandStorage final
: public llvm::TrailingObjects<TrailingOperandStorage, OpOperand> {
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)
+ TrailingOperandStorage() : numOperands(0), capacity(0), reserved(0) {}
+#else
TrailingOperandStorage() : reserved(0), capacity(0), numOperands(0) {}
+#endif
~TrailingOperandStorage() {
for (auto &operand : getOperands())
operand.~OpOperand();
@@ -495,12 +499,21 @@ struct TrailingOperandStorage final
return {getTrailingObjects<OpOperand>(), numOperands};
}
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)
+ /// The number of operands within the storage.
+ unsigned numOperands;
+ /// The total capacity number of operands that the storage can hold.
+ unsigned capacity : 31;
+ /// We reserve a range of bits for use by the operand storage.
+ unsigned reserved : 1;
+#else
/// We reserve a range of bits for use by the operand storage.
unsigned reserved : 1;
/// The total capacity number of operands that the storage can hold.
unsigned capacity : 31;
/// The number of operands within the storage.
unsigned numOperands;
+#endif
};
/// This class handles the management of operation operands. Operands are