[PATCH] D76738: [llvm][IR][CastInst] Update `castIsValid` for scalable vectors.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 13:02:47 PDT 2020


efriedma added inline comments.


================
Comment at: llvm/lib/IR/Instructions.cpp:3242
+  TypeSize SrcBitSize = SrcTy->getScalarType()->getPrimitiveSizeInBits();
+  TypeSize DstBitSize = DstTy->getScalarType()->getPrimitiveSizeInBits();
 
----------------
What's wrong with getScalarSizeInBits()?


================
Comment at: llvm/lib/IR/Instructions.cpp:3284
     if (VectorType *VT = dyn_cast<VectorType>(SrcTy))
-      if (VT->getNumElements() != cast<VectorType>(DstTy)->getNumElements())
+      if (VT->getElementCount() != cast<VectorType>(DstTy)->getElementCount())
         return false;
----------------
Can we simplify some of the getElementCount() calls by using SrcLength/DstLength instead?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76738/new/

https://reviews.llvm.org/D76738





More information about the llvm-commits mailing list