================
@@ -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
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to