[llvm] [VPlan] Add ExplicitVectorLength to isSingleScalar (PR #106818)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 18:57:39 PDT 2024


https://github.com/michaelmaitland created https://github.com/llvm/llvm-project/pull/106818

The docstring of this function:

> Returns true if this VPInstruction's operands are single scalars and the
> result is also a single scalar.

ExplicitVectorLength fits this description. I don't have a test for it now, but it is needed by #106560.

>From b1c58d49d9c5fcef6c8224feae4c9f35c4d3d527 Mon Sep 17 00:00:00 2001
From: Michael Maitland <michaeltmaitland at gmail.com>
Date: Fri, 30 Aug 2024 18:53:10 -0700
Subject: [PATCH] [VPlan] Add ExplicitVectorLength to isSingleScalar

The docstring of this function:

> Returns true if this VPInstruction's operands are single scalars and the
> result is also a single scalar.

ExplicitVectorLength fits this description. I don't have a test for it now,
but it is needed by #106560.
---
 llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index f84317ba51257a..5877aae81a7955 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -680,7 +680,8 @@ bool VPInstruction::isVectorToScalar() const {
 }
 
 bool VPInstruction::isSingleScalar() const {
-  return getOpcode() == VPInstruction::ResumePhi;
+  return getOpcode() == VPInstruction::ResumePhi ||
+         getOpcode() == VPInstruction::ExplicitVectorLength;
 }
 
 #if !defined(NDEBUG)



More information about the llvm-commits mailing list