[Mlir-commits] [mlir] [mlir][Bufferization] Accelerate bufferization pass (PR #160655)

Matthias Springer llvmlistbot at llvm.org
Thu Sep 25 03:07:44 PDT 2025


================
@@ -413,12 +414,26 @@ static void setInsertionPointAfter(OpBuilder &b, Value value) {
 /// Determine which OpOperand* will alias with `value` if the op is bufferized
 /// in place. Return all tensor OpOperand* if the op is not bufferizable.
 AliasingOpOperandList AnalysisState::getAliasingOpOperands(Value value) const {
+  // Check cache first
+  auto it = aliasingOpOperandsCache.find(value);
+  if (it != aliasingOpOperandsCache.end()) {
+    return it->second;
----------------
matthias-springer wrote:

Can you put something like:
```
#ifndef NDEBUG
  assert(it->second == computeAliasingOpOperands() && "inconsistent cache result");
#endif // NDEBUG
```

It may help to put the code below into a lambda.

This is to guard against incorrect `getAliasingOpOperands` implementations.


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


More information about the Mlir-commits mailing list