[Mlir-commits] [mlir] [mlir] [mem2reg] Fix Mem2Reg attempting to promote in graph regions (PR #104910)

Christian Ulmann llvmlistbot at llvm.org
Tue Aug 20 09:25:56 PDT 2024


================
@@ -255,6 +256,18 @@ LogicalResult MemorySlotPromotionAnalyzer::computeBlockingUses(
   // delete itself). We thus need to start from the use of the slot pointer and
   // propagate further requests through the forward slice.
 
+  // Because this pass currently only supports analysing the parent region of
+  // the slot pointer, if a promotable memory op that needs promotion is within
+  // a graph region, the slot may only be used in a graph region and should
+  // therefore be ignored.
+  Region *slotPtrRegion = slot.ptr.getParentRegion();
+  auto slotPtrRegionOp =
+      llvm::dyn_cast<RegionKindInterface>(slotPtrRegion->getParentOp());
----------------
Dinistro wrote:

```suggestion
     dyn_cast<RegionKindInterface>(slotPtrRegion->getParentOp());
```

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


More information about the Mlir-commits mailing list