@@ -83,11 +83,10 @@ def PromotableAllocationOpInterface
8383def PromotableMemOpInterface : OpInterface<"PromotableMemOpInterface"> {
8484 let description = [{
8585 Describes an operation that can load from memory slots and/or store
86- to memory slots. Loads and stores must be of whole values of the same
87- type as the slot itself.
86+ to memory slots.
8887
89- For a memory operation on a slot to be valid, it must operate on the slot
90- pointer *only as a pointer to an element of the type of the slot* .
88+ For a memory operation on a slot to be valid, it must strictly operate
89+ within the bounds of the slot.
9190
9291 If the same operation does both loads and stores on the same slot, the
9392 load must semantically happen first.
@@ -142,7 +141,8 @@ def PromotableMemOpInterface : OpInterface<"PromotableMemOpInterface"> {
142141 }], "bool", "canUsesBeRemoved",
143142 (ins "const ::mlir::MemorySlot &":$slot,
144143 "const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &":$blockingUses,
145- "::llvm::SmallVectorImpl<::mlir::OpOperand *> &":$newBlockingUses)
144+ "::llvm::SmallVectorImpl<::mlir::OpOperand *> &":$newBlockingUses,
145+ "const ::mlir::DataLayout &":$datalayout)
146146 >,
147147 InterfaceMethod<[{
148148 Transforms IR to ensure that the current operation does not use the
@@ -197,7 +197,8 @@ def PromotableOpInterface : OpInterface<"PromotableOpInterface"> {
197197 No IR mutation is allowed in this method.
198198 }], "bool", "canUsesBeRemoved",
199199 (ins "const ::llvm::SmallPtrSetImpl<::mlir::OpOperand *> &":$blockingUses,
200- "::llvm::SmallVectorImpl<::mlir::OpOperand *> &":$newBlockingUses)
200+ "::llvm::SmallVectorImpl<::mlir::OpOperand *> &":$newBlockingUses,
201+ "const ::mlir::DataLayout &":$datalayout)
201202 >,
202203 InterfaceMethod<[{
203204 Transforms IR to ensure that the current operation does not use the
@@ -285,29 +286,28 @@ def DestructurableAllocationOpInterface
285286def SafeMemorySlotAccessOpInterface
286287 : OpInterface<"SafeMemorySlotAccessOpInterface"> {
287288 let description = [{
288- Describes operations using memory slots in a type- safe manner.
289+ Describes operations using memory slots in a safe manner.
289290 }];
290291 let cppNamespace = "::mlir";
291292
292293 let methods = [
293294 InterfaceMethod<[{
294295 Returns whether all accesses in this operation to the provided slot are
295- done in a type-safe manner. To be type-safe, the access must only load
296- the value in this type as the type of the slot, and without assuming any
297- context around the slot. For example, a type-safe load must not load
298- outside the bounds of the slot.
296+ done in a safe manner. To be safe, the access most only access the slot
297+ inside the bounds that its type implies.
299298
300- If the type- safety of the accesses depends on the type- safety of the
301- accesses to further memory slots, the result of this method will be
302- conditioned to the type- safety of the accesses to the slots added by
303- this method to `mustBeSafelyUsed`.
299+ If the safety of the accesses depends on the safety of the accesses to
300+ further memory slots, the result of this method will be conditioned to
301+ the safety of the accesses to the slots added by this method to
302+ `mustBeSafelyUsed`.
304303
305304 No IR mutation is allowed in this method.
306305 }],
307306 "::mlir::LogicalResult",
308307 "ensureOnlySafeAccesses",
309308 (ins "const ::mlir::MemorySlot &":$slot,
310- "::mlir::SmallVectorImpl<::mlir::MemorySlot> &":$mustBeSafelyUsed)
309+ "::mlir::SmallVectorImpl<::mlir::MemorySlot> &":$mustBeSafelyUsed,
310+ "const ::mlir::DataLayout &":$dataLayout)
311311 >
312312 ];
313313}
@@ -323,21 +323,21 @@ def DestructurableAccessorOpInterface
323323 InterfaceMethod<[{
324324 For a given destructurable memory slot, returns whether this operation can
325325 rewire its uses of the slot to use the slots generated after
326- destructuring. This may involve creating new operations, and usually
327- amounts to checking if the pointer types match.
326+ destructuring. This may involve creating new operations.
328327
329328 This method must also register the indices it will access within the
330329 `usedIndices` set. If the accessor generates new slots mapping to
331330 subelements, they must be registered in `mustBeSafelyUsed` to ensure
332- they are used in a locally type- safe manner.
331+ they are used in a safe manner.
333332
334333 No IR mutation is allowed in this method.
335334 }],
336335 "bool",
337336 "canRewire",
338337 (ins "const ::mlir::DestructurableMemorySlot &":$slot,
339338 "::llvm::SmallPtrSetImpl<::mlir::Attribute> &":$usedIndices,
340- "::mlir::SmallVectorImpl<::mlir::MemorySlot> &":$mustBeSafelyUsed)
339+ "::mlir::SmallVectorImpl<::mlir::MemorySlot> &":$mustBeSafelyUsed,
340+ "const ::mlir::DataLayout &":$dataLayout)
341341 >,
342342 InterfaceMethod<[{
343343 Rewires the use of a slot to the generated subslots, without deleting
@@ -351,7 +351,8 @@ def DestructurableAccessorOpInterface
351351 "rewire",
352352 (ins "const ::mlir::DestructurableMemorySlot &":$slot,
353353 "::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &":$subslots,
354- "::mlir::RewriterBase &":$rewriter)
354+ "::mlir::RewriterBase &":$rewriter,
355+ "const ::mlir::DataLayout &":$dataLayout)
355356 >
356357 ];
357358}
0 commit comments