[PATCH] D76892: [llvm][Type] Return fixed size for scalar types. [NFC]
Francesco Petrogalli via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 26 16:20:19 PDT 2020
fpetrogalli created this revision.
fpetrogalli added reviewers: efriedma, sdesmalen.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D76892
Files:
llvm/lib/IR/Type.cpp
Index: llvm/lib/IR/Type.cpp
===================================================================
--- llvm/lib/IR/Type.cpp
+++ llvm/lib/IR/Type.cpp
@@ -132,7 +132,8 @@
}
unsigned Type::getScalarSizeInBits() const {
- return getScalarType()->getPrimitiveSizeInBits();
+ // Is is safe to assume that the scalar types have a fixed size.
+ return getScalarType()->getPrimitiveSizeInBits().getFixedSize();
}
int Type::getFPMantissaWidth() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76892.253001.patch
Type: text/x-patch
Size: 451 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200326/c96d7e05/attachment.bin>
More information about the llvm-commits
mailing list