[Mlir-commits] [mlir] [mlir] Made DefaultResource the root of memory resource hierarchy. (PR #187423)

Mehdi Amini llvmlistbot at llvm.org
Fri Mar 20 02:19:41 PDT 2026


================
@@ -224,10 +224,18 @@ bool CSEDriver::hasOtherSideEffectingOpInBetween(Operation *fromOp,
       if (isa<MemoryEffects::Write>(effect.getEffect())) {
         // A write on a resource disjoint from all read resources cannot
         // conflict with the reads being CSE'd.
-        auto *writeResource = effect.getResource();
-        bool canConflict = llvm::any_of(readResources, [&](auto *readResource) {
-          return !writeResource->isDisjointFrom(readResource);
-        });
+        SideEffects::Resource *writeResource = effect.getResource();
+        bool canConflict =
+            llvm::any_of(readEffects, [&](const auto &readEffect) {
+              SideEffects::Resource *readResource = readEffect.getResource();
+              if (writeResource->isDisjointFrom(readResource))
+                return false;
+              // A pointer-based access to an addressable resource cannot
+              // conflict with a non-addressable resource.
+              if (readEffect.getValue() && !writeResource->isAddressable())
----------------
joker-eph wrote:

> can non-addressable effects not be associated with an SSA value? 

This is the actual definition of non-addressable effects :)

It is checked on EffectInstance construction (calling `    checkResourceAllowsValue();`)

```
    if (value && resource && !resource->isAddressable())
      llvm::report_fatal_error(
          llvm::Twine("EffectInstance: resource '") + resource->getName() +
          "' is non-addressable and cannot have an associated Value");
```

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


More information about the Mlir-commits mailing list