diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h b/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h --- a/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h +++ b/mlir/include/mlir/Dialect/Bufferization/IR/AllocationOpInterface.h @@ -19,9 +19,10 @@ // Enum class representing different hoisting kinds for the allocation // operation enum class HoistingKind : uint8_t { - None = 0, // No hoisting kind selected - Loop = 1 << 0, // Indicates loop hoisting kind - Block = 1 << 1 // Indicates dominated block hoisting kind + None = 0, // No hoisting kind selected + Loop = 1 << 0, // Indicates loop hoisting kind + Block = 1 << 1, // Indicates dominated block hoisting kind + LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ Block) }; } // namespace mlir diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp --- a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp +++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocation.cpp @@ -638,8 +638,7 @@ .getResult(); } static ::mlir::HoistingKind getHoistingKind() { - return static_cast(static_cast(HoistingKind::Loop) | - static_cast(HoistingKind::Block)); + return HoistingKind::Loop | HoistingKind::Block; } static ::std::optional<::mlir::Operation *> buildPromotedAlloc(OpBuilder &builder, Value alloc) { diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp --- a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp +++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp @@ -44,16 +44,16 @@ /// and it supports the dominate block hoisting. static bool allowAllocDominateBlockHoisting(Operation *op) { auto allocOp = dyn_cast(op); - return allocOp && (static_cast(allocOp.getHoistingKind()) & - static_cast(HoistingKind::Block)); + return allocOp && + static_cast(allocOp.getHoistingKind() & HoistingKind::Block); } /// Returns true if the given operation implements the AllocationOpInterface /// and it supports the loop hoisting. static bool allowAllocLoopHoisting(Operation *op) { auto allocOp = dyn_cast(op); - return allocOp && (static_cast(allocOp.getHoistingKind()) & - static_cast(HoistingKind::Loop)); + return allocOp && + static_cast(allocOp.getHoistingKind() & HoistingKind::Loop); } /// Check if the size of the allocation is less than the given size. The