[Mlir-commits] [mlir] a3ef1b5 - Fix MLIR crash on 32 bits platforms

Mehdi Amini llvmlistbot at llvm.org
Wed May 17 21:59:18 PDT 2023


Author: Mehdi Amini
Date: 2023-05-17T21:58:20-07:00
New Revision: a3ef1b587d7cf88e311d6f17132fa7fc5a6490db

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

LOG: 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

Added: 
    

Modified: 
    mlir/lib/IR/Operation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp
index 42b2c79ef6f9c..64cbeb6303320 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.


        


More information about the Mlir-commits mailing list