@@ -143,21 +143,28 @@ class AllocLikeOp<string mnemonic,
143
143
//===----------------------------------------------------------------------===//
144
144
145
145
def AssumeAlignmentOp : MemRef_Op<"assume_alignment", [
146
- NoMemoryEffect ,
146
+ Pure ,
147
147
ViewLikeOpInterface,
148
148
SameOperandsAndResultType
149
149
]> {
150
150
let summary =
151
151
"assertion that gives alignment information to the input memref";
152
152
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
154
154
value. It returns a new SSA value of the same memref type, but associated
155
155
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.
161
168
}];
162
169
let arguments = (ins AnyMemRef:$memref,
163
170
ConfinedAttr<I32Attr, [IntPositive]>:$alignment);
0 commit comments