From 4b3d94051ca2cfc43f276c05f0619d22fc7deb87 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 --- llvm/lib/IR/Type.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp index e91bc8aa7e70..b288ab00fde3 100644 --- a/llvm/lib/IR/Type.cpp +++ b/llvm/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 {