Skip to content

Commit 1bbf722

Browse files
committed
[RISCV] Use getBuiltinVectorTypeInfo to simplify code. NFC
1 parent a6e77fd commit 1bbf722

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

clang/lib/Sema/SemaChecking.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5082,12 +5082,10 @@ static bool CheckInvalidVLENandLMUL(const TargetInfo &TI, CallExpr *TheCall,
50825082
assert((EGW == 128 || EGW == 256) && "EGW can only be 128 or 256 bits");
50835083

50845084
// LMUL * VLEN >= EGW
5085-
unsigned ElemSize = Type->isRVVType(32, false) ? 32 : 64;
5086-
unsigned MinElemCount = Type->isRVVType(1) ? 1
5087-
: Type->isRVVType(2) ? 2
5088-
: Type->isRVVType(4) ? 4
5089-
: Type->isRVVType(8) ? 8
5090-
: 16;
5085+
ASTContext::BuiltinVectorTypeInfo Info =
5086+
S.Context.getBuiltinVectorTypeInfo(Type->castAs<BuiltinType>());
5087+
unsigned ElemSize = S.Context.getTypeSize(Info.ElementType);
5088+
unsigned MinElemCount = Info.EC.getKnownMinValue();
50915089

50925090
unsigned EGS = EGW / ElemSize;
50935091
// If EGS is less than or equal to the minimum number of elements, then the

0 commit comments

Comments
 (0)