[Mlir-commits] [mlir] ea979b2 - [mlir][SparseTensor][NFC] Remove `isNestedIn` helper function (#75729)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Dec 16 20:19:32 PST 2023
Author: Matthias Springer
Date: 2023-12-17T13:19:27+09:00
New Revision: ea979b24b0a755c9839e32dd716078ea816a0508
URL: https://github.com/llvm/llvm-project/commit/ea979b24b0a755c9839e32dd716078ea816a0508
DIFF: https://github.com/llvm/llvm-project/commit/ea979b24b0a755c9839e32dd716078ea816a0508.diff
LOG: [mlir][SparseTensor][NFC] Remove `isNestedIn` helper function (#75729)
Use `Region::findAncestorBlockInRegion` instead of a custom IR
traversal.
Added:
Modified:
mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
index 30ab2a1f18e3f7..69fd1eb746ffe7 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseGPUCodegen.cpp
@@ -1155,7 +1155,7 @@ struct ForallRewriter : public OpRewritePattern<scf::ParallelOp> {
block = arg.getOwner();
else
block = val.getDefiningOp()->getBlock();
- if (!isNestedIn(block, forallOp))
+ if (!forallOp.getRegion().findAncestorBlockInRegion(*block))
invariants.insert(val);
}
});
@@ -1208,15 +1208,6 @@ struct ForallRewriter : public OpRewritePattern<scf::ParallelOp> {
}
private:
- // Helper method to see if block appears in given loop.
- static bool isNestedIn(Block *block, scf::ParallelOp forallOp) {
- for (Operation *o = block->getParentOp(); o; o = o->getParentOp()) {
- if (o == forallOp)
- return true;
- }
- return false;
- }
-
unsigned numThreads;
};
More information about the Mlir-commits
mailing list