From 78350f6cef1290131aab23321ee4612ea04b2300 Mon Sep 17 00:00:00 2001 From: Francesco Petrogalli Date: Fri, 27 Mar 2020 21:41:03 +0000 Subject: [PATCH] [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 --- lib/IR/Type.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/IR/Type.cpp b/lib/IR/Type.cpp index e91bc8aa7e7..b288ab00fde 100644 --- a/lib/IR/Type.cpp +++ b/lib/IR/Type.cpp @@ -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 {