[Mlir-commits] [mlir] [mlir][tosa] Fix check for isolated regions in `tosa.cond_if` (PR #143772)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jul 16 07:19:47 PDT 2025


================
@@ -1193,32 +1193,55 @@ bool checkErrorIfPad(Operation *op) {
   return true;
 }
 
-// Returns true if the operation takes no input operands, excluding attributes.
-static bool isNullaryOperation(Operation *op) {
-  if (isa<tosa::ConstOp>(op) || isa<tosa::ConstShapeOp>(op) ||
-      isa<tosa::YieldOp>(op) || isa<tosa::VariableOp>(op))
-    return true;
-  return false;
+static bool isOpIsolatedFromAbove(Operation *op, Region *region) {
+  return llvm::all_of(op->getOperands(), [&](auto operand) {
+    Region *operandRegion = operand.getParentRegion();
+    return region->isAncestor(operandRegion);
----------------
udaya-ranga wrote:

Does "ancestor" relationship always equate to "IsolatedFromAbove" ?
If I compare an Op with a non-ancestor and non-overlapping region (Maybe a peer to ancestor), then also it is true that the Op is "IsolatedFromAbove" ?

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


More information about the Mlir-commits mailing list