Skip to content

Commit fffff5c

Browse files
committed
Merge commit '1e04923d21f8e2a3557690340ac7e7936dab20e5' into feature/merge-get-vector-num-elements
2 parents 9d1ba9e + 1e04923 commit fffff5c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

llvm/include/llvm/Support/MachineValueType.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,11 @@ namespace llvm {
872872
}
873873

874874
unsigned getVectorNumElements() const {
875-
// TODO: Check that this isn't a scalable vector.
875+
if (isScalableVector())
876+
llvm::reportInvalidSizeRequest(
877+
"Possible incorrect use of MVT::getVectorNumElements() for "
878+
"scalable vector. Scalable flag may be dropped, use "
879+
"MVT::getVectorElementCount() instead");
876880
return getVectorMinNumElements();
877881
}
878882

llvm/lib/Support/LowLevelType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ using namespace llvm;
1717

1818
LLT::LLT(MVT VT) {
1919
if (VT.isVector()) {
20-
bool asVector = VT.getVectorNumElements() > 1;
20+
bool asVector = VT.getVectorMinNumElements() > 1;
2121
init(/*IsPointer=*/false, asVector, /*IsScalar=*/!asVector,
2222
VT.getVectorElementCount(), VT.getVectorElementType().getSizeInBits(),
2323
/*AddressSpace=*/0);

0 commit comments

Comments
 (0)