[SelectionDAG][NFC] Rename isConstantSequence to isArithmeticSequence#179108
Merged
[SelectionDAG][NFC] Rename isConstantSequence to isArithmeticSequence#179108
Conversation
ab526ef to
061f7b1
Compare
The previous name was misleading: the method checks for an arithmetic progression `(start, start+stride, start+2*stride, ...)`, not just any constant sequence. The new name uses precise mathematical terminology. llvm#176671 (comment)
Member
|
@llvm/pr-subscribers-llvm-selectiondag @llvm/pr-subscribers-backend-aarch64 Author: Philip Ginsbach-Chen (ginsbach) ChangesThe previous name was misleading: the method checks for an arithmetic Full diff: https://github.com/llvm/llvm-project/pull/179108.diff 4 Files Affected:
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
index a23b26e145185..536dca4602c03 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -2333,7 +2333,7 @@ class BuildVectorSDNode : public SDNode {
/// integer, the value "<a, n>" is returned. Arithmetic is performed modulo
/// 2^BitWidth, so this also matches sequences that wrap around. Poison
/// elements are ignored and can take any value.
- LLVM_ABI std::optional<std::pair<APInt, APInt>> isConstantSequence() const;
+ LLVM_ABI std::optional<std::pair<APInt, APInt>> isArithmeticSequence() const;
/// Recast bit data \p SrcBitElements to \p DstEltSizeInBits wide elements.
/// Undef elements are treated as zero, and entirely undefined elements are
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 16a8c264a42b3..f3c4ef8712a91 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -14188,7 +14188,7 @@ bool BuildVectorSDNode::isConstant() const {
}
std::optional<std::pair<APInt, APInt>>
-BuildVectorSDNode::isConstantSequence() const {
+BuildVectorSDNode::isArithmeticSequence() const {
unsigned NumOps = getNumOperands();
if (NumOps < 2)
return std::nullopt;
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 2775ddcff353c..1f7fc248d6da0 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -15904,7 +15904,7 @@ SDValue AArch64TargetLowering::LowerFixedLengthBuildVectorToSVE(
EVT ContainerVT = getContainerForFixedLengthVector(DAG, VT);
auto *BVN = cast<BuildVectorSDNode>(Op);
- if (auto SeqInfo = BVN->isConstantSequence()) {
+ if (auto SeqInfo = BVN->isArithmeticSequence()) {
SDValue Start = DAG.getConstant(SeqInfo->first, DL, ContainerVT);
SDValue Steps = DAG.getStepVector(DL, ContainerVT, SeqInfo->second);
SDValue Seq = DAG.getNode(ISD::ADD, DL, ContainerVT, Start, Steps);
@@ -15961,7 +15961,7 @@ SDValue AArch64TargetLowering::LowerBUILD_VECTOR(SDValue Op,
EVT VT = Op.getValueType();
bool OverrideNEON = !Subtarget->isNeonAvailable() ||
- cast<BuildVectorSDNode>(Op)->isConstantSequence();
+ cast<BuildVectorSDNode>(Op)->isArithmeticSequence();
if (useSVEForFixedLengthVectorVT(VT, OverrideNEON))
return LowerFixedLengthBuildVectorToSVE(Op, DAG);
diff --git a/llvm/test/CodeGen/AArch64/sve-fixed-length-build-vector.ll b/llvm/test/CodeGen/AArch64/sve-fixed-length-build-vector.ll
index 9c85548aee0b1..96056713857cb 100644
--- a/llvm/test/CodeGen/AArch64/sve-fixed-length-build-vector.ll
+++ b/llvm/test/CodeGen/AArch64/sve-fixed-length-build-vector.ll
@@ -164,7 +164,7 @@ define void @build_vector_fractional_stride_v8i32(ptr %a) #0 {
}
; zip1 pattern: constant <0, 1, 2, 3> is expanded to <0, 1, 2, 3, poison, poison, poison, poison>
-; to match the shuffle result width. isConstantSequence recognizes this as a sequence.
+; to match the shuffle result width. isArithmeticSequence recognizes this as a sequence.
define <8 x i8> @zip_const_seq_with_variable(i8 %x) #0 {
; VBITS_GE_256-LABEL: zip_const_seq_with_variable:
; VBITS_GE_256: // %bb.0:
|
jayfoad
approved these changes
Feb 2, 2026
Contributor
jayfoad
left a comment
There was a problem hiding this comment.
Makes sense to me. Thanks.
rishabhmadan19
pushed a commit
to rishabhmadan19/llvm-project
that referenced
this pull request
Feb 9, 2026
…llvm#179108) The previous name was misleading: the method checks for an arithmetic progression `(start, start+stride, start+2*stride, ...)`, not just any constant sequence. The new name uses precise mathematical terminology. llvm#176671 (comment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The previous name was misleading: the method checks for an arithmetic
progression
(start, start+stride, start+2*stride, ...), not just anyconstant sequence. The new name uses precise mathematical terminology.
#176671 (comment)