[PATCH] D76738: [llvm] Use correct type in variable declaration. [NFC]

Francesco Petrogalli via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 15:52:32 PDT 2020


fpetrogalli created this revision.
fpetrogalli added a reviewer: sdesmalen.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

We should avoid implicit casts of TypeSize into integers because such
implicit cast is deprecated.

The code surrounding this change works without modifications when
using TypeSize directly instead of integers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76738

Files:
  llvm/lib/IR/Instructions.cpp


Index: llvm/lib/IR/Instructions.cpp
===================================================================
--- llvm/lib/IR/Instructions.cpp
+++ llvm/lib/IR/Instructions.cpp
@@ -3238,8 +3238,8 @@
     return false;
 
   // Get the size of the types in bits, we'll need this later
-  unsigned SrcBitSize = SrcTy->getScalarSizeInBits();
-  unsigned DstBitSize = DstTy->getScalarSizeInBits();
+  TypeSize SrcBitSize = SrcTy->getPrimitiveSizeInBits();
+  TypeSize DstBitSize = DstTy->getPrimitiveSizeInBits();
 
   // If these are vector types, get the lengths of the vectors (using zero for
   // scalar types means that checking that vector lengths match also checks that


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76738.252447.patch
Type: text/x-patch
Size: 666 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200324/a8e19c32/attachment.bin>


More information about the llvm-commits mailing list