[Mlir-commits] [mlir] [mlir][bufferization] Relax happens-before analysis (PR #223777)

Matthias Springer llvmlistbot at llvm.org
Tue Sep 15 17:46:35 PDT 2026


================
@@ -658,6 +671,13 @@ hasReadAfterWriteInterference(const DenseSet<OpOperand *> &usesRead,
       continue;
     }
 
+    // Re-entering a bbArg's block is a new definition, not read-after-write
+    // of the previous one.
+    SmallPtrSet<Block *, 16> bbArgDefBlocks;
+    for (Value def : definitions)
+      if (isa<BlockArgument>(def))
+        bbArgDefBlocks.insert(def.getParentBlock());
----------------
matthias-springer wrote:

I'm wondering if it's correct to gather all blocks like that. These blocks are then used to rule out paths in `cannotHappenAfter`. There could be many "definitions" for a value. E.g. I could write a large switch-case  (or sequence of `scf.if`) so that almost every block of the entire program will be included here. (But only one of those "definitions" will be "chosen" at runtime.)


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


More information about the Mlir-commits mailing list