[llvm-branch-commits] [mlir] [MLIR][OpenMP] Introduce the LoopWrapperInterface (PR #87232)
Michael Kruse via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Apr 2 02:44:45 PDT 2024
================
@@ -1730,9 +1730,28 @@ LogicalResult LoopNestOp::verify() {
<< "range argument type does not match corresponding IV type";
}
+ auto wrapper =
+ llvm::dyn_cast_if_present<LoopWrapperInterface>((*this)->getParentOp());
+
+ if (!wrapper || !wrapper.isWrapper())
+ return emitOpError() << "expects parent op to be a valid loop wrapper";
+
return success();
}
+SmallVector<LoopWrapperInterface> LoopNestOp::getWrappers() {
----------------
Meinersbur wrote:
```suggestion
void LoopNestOp::findSurroundingWrappers(SmallVectorImpl<LoopWrapperInterface> &list) {
```
Instead of returning a list, LLVM often uses this pattern that fill's a caller's list. This may have been done because `SmallVector` has a SmallSize argument that should not be hardcoded in a public API, but with it being optional I don't know how relevant this still is. Another reason is to avoid the impression that this is a simple getter. Also, it allows hoisting the declaration of the list outside a loop. See https://llvm.org/docs/ProgrammersManual.html#vector and the note in https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h
https://github.com/llvm/llvm-project/pull/87232
More information about the llvm-branch-commits
mailing list