Skip to content

Commit 5ba0969

Browse files
committed
[SLP][REVEC] NFC. Provide an universal interface for getNumElements.
1 parent 255625e commit 5ba0969

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ static FixedVectorType *getWidenedType(Type *ScalarTy, unsigned VF) {
245245
return FixedVectorType::get(ScalarTy, VF);
246246
}
247247

248+
static unsigned getNumElements(Type *Ty) {
249+
if (auto *VecTy = dyn_cast<FixedVectorType>(Ty))
250+
return VecTy->getNumElements();
251+
return 1;
252+
}
253+
248254
/// \returns True if the value is a constant (but not globals/constant
249255
/// expressions).
250256
static bool isConstant(Value *V) {

0 commit comments

Comments
 (0)