[Mlir-commits] [mlir] [MLIR][NFC] Speed up is valid symbol check (PR #154924)

Mehdi Amini llvmlistbot at llvm.org
Fri Aug 22 04:18:36 PDT 2025


================
@@ -427,6 +427,25 @@ bool mlir::affine::isValidSymbol(Value value) {
   return false;
 }
 
+/// A utility function to check if a value is defined at the top level of
+/// `region` or is an argument of `region` or dominates the region.
+static bool isTopLevelValueOrDominator(Value value, Region *region) {
+  Region *parentRegion;
+  if (auto arg = dyn_cast<BlockArgument>(value))
+    parentRegion = arg.getParentRegion();
+  else
+    parentRegion = value.getDefiningOp()->getParentRegion();
----------------
joker-eph wrote:

```suggestion
  Region *parentRegion = value.getParentRegion();
```

Hopefully that's equivalent?

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


More information about the Mlir-commits mailing list