[llvm] [VPlan] Add vputils::recipesOnly that returns a downcasted range (NFC) (PR #222770)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 14 06:59:15 PDT 2026
================
@@ -166,6 +166,15 @@ inline VPRecipeBase *findRecipe(VPValue *Start, PredT Pred) {
return nullptr;
}
+/// Returns an iterator range over \p Range which only includes \p RecipeTy
+/// recipes. The accesses are casted to \p RecipeTy.
+template <typename RecipeTy, typename T> auto recipesOnly(T &&Range) {
+ auto Filter = make_filter_range(std::forward<T>(Range),
+ [](auto &R) { return isa<RecipeTy>(R); });
+ return map_range(Filter,
+ [](auto &R) -> RecipeTy & { return cast<RecipeTy>(R); });
----------------
fhahn wrote:
Yep this comes with the same limitations/constraints as `make_filter_range`. I moved this to a generic helper w/o any changes in the vectorizer code https://github.com/llvm/llvm-project/pull/223414
https://github.com/llvm/llvm-project/pull/222770
More information about the llvm-commits
mailing list