[Mlir-commits] [mlir] Added Memory Effect to assume_alignment (PR #139521)

Mehdi Amini llvmlistbot at llvm.org
Wed May 14 06:54:36 PDT 2025


================
@@ -142,22 +142,34 @@ class AllocLikeOp<string mnemonic,
 // AssumeAlignmentOp
 //===----------------------------------------------------------------------===//
 
-def AssumeAlignmentOp : MemRef_Op<"assume_alignment"> {
+def AssumeAlignmentOp : MemRef_Op<"assume_alignment", [
+      NoMemoryEffect, 
+      ViewLikeOpInterface,
+      SameOperandsAndResultType
+    ]> {
   let summary =
       "assertion that gives alignment information to the input memref";
   let description = [{
-    The `assume_alignment` operation takes a memref and an integer of alignment
-    value, and internally annotates the buffer with the given alignment. If
-    the buffer isn't aligned to the given alignment, the behavior is undefined.
+      The `assume_alignment` operation takes a memref and an integer of alignment
+      value. It returns a new SSA value of the same memref type, but associated
+      with the assertion that the underlying buffer is aligned to the given
+      alignment. If the buffer isn't aligned to the given alignment, the 
+      behavior is undefined.
----------------
joker-eph wrote:

Do we need undefined behavior or could we have deferred here with poison?

https://github.com/llvm/llvm-project/pull/139521


More information about the Mlir-commits mailing list