[llvm][Type] Return fixed size for scalar types. [NFC]

Summary:
It is safe to assume that the TypeSize associated to scalar types has
a fixed size.

This avoids an implicit cast of TypeSize to integer inside
`Type::getScalarSizeInBits()`, as such implicit cast is deprecated.

Reviewers: efriedma, sdesmalen

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D76892
This commit is contained in:
Francesco Petrogalli 2020-03-27 21:41:03 +00:00
parent 9ce198d6ed
commit 4b3d94051c
1 changed files with 2 additions and 1 deletions

View File

@ -132,7 +132,8 @@ TypeSize Type::getPrimitiveSizeInBits() const {
}
unsigned Type::getScalarSizeInBits() const {
return getScalarType()->getPrimitiveSizeInBits();
// It is safe to assume that the scalar types have a fixed size.
return getScalarType()->getPrimitiveSizeInBits().getFixedSize();
}
int Type::getFPMantissaWidth() const {