[Mlir-commits] [mlir] [MLIR][Affine] Fix private memref creation bug in affine fusion (PR #126028)
Uday Bondhugula
llvmlistbot at llvm.org
Thu Feb 6 22:01:52 PST 2025
================
@@ -2297,3 +2298,40 @@ FailureOr<AffineValueMap> mlir::affine::simplifyConstrainedMinMaxOp(
affine::canonicalizeMapAndOperands(&newMap, &newOperands);
return AffineValueMap(newMap, newOperands);
}
+
+Block *mlir::affine::findInnermostCommonBlockInScope(Operation *a,
+ Operation *b) {
+ Region *aScope = mlir::affine::getAffineScope(a);
+ Region *bScope = mlir::affine::getAffineScope(b);
+ if (aScope != bScope)
+ return nullptr;
+
+ // Get the block ancestry of `a` while stopping at the affine scope.
+ auto getBlockAncestry = [&](Operation *op,
+ SmallVectorImpl<Block *> &ancestry) {
+ Operation *curOp = op;
+ do {
----------------
bondhugula wrote:
This is meant to be executed at least once - so a do-while loop. `curOp` is initialized with a function argument. The caller is expected to pass a non-null operation. We don't assert for such bugs.
https://github.com/llvm/llvm-project/pull/126028
More information about the Mlir-commits
mailing list