Skip to content

Commit 7de24e0

Browse files
author
Shay Kleiman
committed
Added ASM Result Naming to AssumeAlignment
Set AsmResultName for the operation to be assume_align
1 parent 42c4e78 commit 7de24e0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,23 +143,23 @@ class AllocLikeOp<string mnemonic,
143143
//===----------------------------------------------------------------------===//
144144

145145
def AssumeAlignmentOp : MemRef_Op<"assume_alignment", [
146+
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>,
146147
Pure,
147148
ViewLikeOpInterface,
148149
SameOperandsAndResultType
149150
]> {
150151
let summary =
151152
"assertion that gives alignment information to the input memref";
152153
let description = [{
153-
The `assume_alignment` operation takes a memref and an integer alignment
154+
The `assume_alignment` operation takes a memref and an integer of alignment
154155
value. It returns a new SSA value of the same memref type, but associated
155156
with the assertion that the underlying buffer is aligned to the given
156157
alignment.
157158

158-
If the buffer isn't actually aligned to the given alignment, this operation
159+
If the buffer isn't aligned to the given alignment, this operation
159160
itself does not cause undefined behavior. However, subsequent operations
160161
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.
162+
correctness will produce a poison value if the assertion is false.
163163

164164
This operation doesn't affect the semantics of a program where the
165165
alignment assertion holds true. It is intended for optimization purposes,

mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,10 @@ LogicalResult AssumeAlignmentOp::verify() {
527527
return success();
528528
}
529529

530+
void AssumeAlignmentOp::getAsmResultNames(function_ref<void(Value, StringRef)> setNameFn) {
531+
setNameFn(getResult(), "assume_align");
532+
}
533+
530534
//===----------------------------------------------------------------------===//
531535
// CastOp
532536
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)