[llvm] [VPlan] Use pointee-range in blocksOnly (NFC) (PR #212441)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 02:23:49 PDT 2026


https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/212441

The map_range can be replaced by make_pointee_range.

>From da856025fd68c2c837feb4fab601959d77e2af53 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <artagnon at tenstorrent.com>
Date: Tue, 28 Jul 2026 10:20:55 +0100
Subject: [PATCH] [VPlan] Use pointee-range in blocksOnly (NFC)

The map_range can be replaced by make_pointee_range.
---
 llvm/lib/Transforms/Vectorize/VPlanUtils.h | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.h b/llvm/lib/Transforms/Vectorize/VPlanUtils.h
index 2849b3f9b0c81..0c556dbab1eab 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUtils.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.h
@@ -386,12 +386,11 @@ class VPBlockUtils {
     using BaseTy = std::conditional_t<std::is_const<BlockTy>::value,
                                       const VPBlockBase, VPBlockBase>;
 
-    // We need to first create an iterator range over (const) BlocktTy & instead
-    // of (const) BlockTy * for filter_range to work properly.
-    auto Mapped =
-        map_range(Range, [](BaseTy *Block) -> BaseTy & { return *Block; });
-    auto Filter = make_filter_range(
-        Mapped, [](BaseTy &Block) { return isa<BlockTy>(&Block); });
+    // We need the pointee range over (const) BlocktTy & instead of (const)
+    // BlockTy * for filter_range to work properly.
+    auto Filter =
+        make_filter_range(make_pointee_range(Range),
+                          [](BaseTy &Block) { return isa<BlockTy>(&Block); });
     return map_range(Filter, [](BaseTy &Block) -> BlockTy * {
       return cast<BlockTy>(&Block);
     });



More information about the llvm-commits mailing list