From a3ef1b587d7cf88e311d6f17132fa7fc5a6490db Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 17 May 2023 21:53:05 -0700 Subject: [PATCH] Fix MLIR crash on 32 bits platforms The properties size is compressed as a member of the Operation class to assume a multiple of 8B is used for the storage. This matched the natural alignment / padding on 64 bits platforms, however we need some explicit padding on 32 bits platforms, llvm::TrailingObjects will compress and misalign. Fixes #62763 --- mlir/lib/IR/Operation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp index 42b2c79..64cbeb6 100644 --- a/mlir/lib/IR/Operation.cpp +++ b/mlir/lib/IR/Operation.cpp @@ -91,7 +91,7 @@ Operation *Operation::create(Location location, OperationName name, unsigned numSuccessors = successors.size(); unsigned numOperands = operands.size(); unsigned numResults = resultTypes.size(); - int opPropertiesAllocSize = name.getOpPropertyByteSize(); + int opPropertiesAllocSize = llvm::alignTo<8>(name.getOpPropertyByteSize()); // If the operation is known to have no operands, don't allocate an operand // storage. -- 2.7.4