================
@@ -583,3 +624,283 @@ Region *mlir::getEnclosingRepetitiveRegion(Value value) {
LDBG() << "No enclosing repetitive region found for value";
return nullptr;
}
+
+/// Is a defined before b?
+static bool isDefinedBefore(Value a, Value b) {
+ Region *aRegion = a.getParentRegion();
+ Region *bRegion = b.getParentRegion();
+
+ if (aRegion->getParentOp()->isProperAncestor(bRegion->getParentOp())) {
+ return true;
+ }
+ if (aRegion == bRegion) {
+ Block *aBlock = a.getParentBlock();
+ Block *bBlock = b.getParentBlock();
+ if (aBlock != bBlock)
+ return false;
+ if (isa<BlockArgument>(a))
+ return true;
+ if (isa<BlockArgument>(b))
+ return false;
+ return a.getDefiningOp()->isBeforeInBlock(b.getDefiningOp());
+ }
+
+ return false;
+}
+
+namespace {
+// Try to make successor inputs dead by replacing their uses with values that
+// are not successor inputs. This pattern enables additional canonicalization
+// opportunities for RemoveDeadValues.
----------------
matthias-springer wrote:
Added examples for each function / pattern.
https://github.com/llvm/llvm-project/pull/174094
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits