@@ -143,21 +143,28 @@ class AllocLikeOp<string mnemonic,
143143//===----------------------------------------------------------------------===//
144144
145145def AssumeAlignmentOp : MemRef_Op<"assume_alignment", [
146- NoMemoryEffect ,
146+ Pure ,
147147 ViewLikeOpInterface,
148148 SameOperandsAndResultType
149149 ]> {
150150 let summary =
151151 "assertion that gives alignment information to the input memref";
152152 let description = [{
153- The `assume_alignment` operation takes a memref and an integer of alignment
153+ The `assume_alignment` operation takes a memref and an integer alignment
154154 value. It returns a new SSA value of the same memref type, but associated
155155 with the assertion that the underlying buffer is aligned to the given
156- alignment. If the buffer isn't aligned to the given alignment, the
157- behavior is undefined.
158-
159- This operation doesn't affect the semantics of a correct program. It's for
160- optimization only, and the optimization is best-effort.
156+ alignment.
157+
158+ If the buffer isn't actually aligned to the given alignment, this operation
159+ itself does not cause undefined behavior. However, subsequent operations
160+ that consume the resulting memref and rely on this asserted alignment for
161+ correctness (e.g., to avoid hardware traps or to meet ISA requirements for
162+ specific instructions) will produce a poison value if the assertion is false.
163+
164+ This operation doesn't affect the semantics of a program where the
165+ alignment assertion holds true. It is intended for optimization purposes,
166+ allowing the compiler to generate more efficient code based on the
167+ alignment assumption. The optimization is best-effort.
161168 }];
162169 let arguments = (ins AnyMemRef:$memref,
163170 ConfinedAttr<I32Attr, [IntPositive]>:$alignment);
0 commit comments