Skip to content

Consolidate duplicate numeric-vector type predicates into TypeSemantics#34

Merged
NripeshN merged 1 commit into
mainfrom
hir/consolidate-numeric-vector-predicate
Jun 21, 2026
Merged

Consolidate duplicate numeric-vector type predicates into TypeSemantics#34
NripeshN merged 1 commit into
mainfrom
hir/consolidate-numeric-vector-predicate

Conversation

@NripeshN

Copy link
Copy Markdown
Member

Summary

Round 2 of the type-predicate consolidation started in #33. Three files each carried their own copy of the "numeric vector" predicate:

  • HIR.cpp::isNumericVectorTypeName
  • HIRPassManager.cpp::isHIRNumericVectorTypeName
  • Intrinsics.cpp::isNumericVectorType

All three enumerated the same set (vec / ivec / uvec × {2,3,4}, excluding the boolean bvecN). They are replaced by a single canonical crossgl::isNumericVectorTypeName in TypeSemantics, defined in terms of the existing canonical isVectorType so the numeric-vector set stays in lock-step with the vector set:

bool isNumericVectorTypeName(std::string_view name) {
  // Vector types with numeric components: every vector type except the boolean
  // vectors (bvecN).
  return isVectorType(name) && !name.starts_with("bvec");
}

This removes the last of the hand-maintained vector-type literal lists outside TypeSemantics, eliminating a class of drift bug (the three copies could silently disagree if a new vector type were ever added).

Verification

Full suite green: 100% tests passed, 0 tests failed out of 2452.

Three identical numeric-vector predicates (HIR.cpp isNumericVectorTypeName,
HIRPassManager isHIRNumericVectorTypeName, Intrinsics isNumericVectorType) each
enumerated the vec/ivec/uvec types. Replace them with a single canonical
TypeSemantics::isNumericVectorTypeName, defined as isVectorType(name) &&
!name.starts_with("bvec") so the numeric-vector set tracks the canonical vector
set automatically. Continues the predicate consolidation from #33.
@NripeshN NripeshN merged commit 0823092 into main Jun 21, 2026
7 checks passed
@NripeshN NripeshN deleted the hir/consolidate-numeric-vector-predicate branch June 21, 2026 13:38
NripeshN added a commit that referenced this pull request Jun 21, 2026
…#35)

Replace three equivalent isFloatVectorType definitions with canonical crossgl::isFloatVectorType overloads in TypeSemantics. Continues #33/#34.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant