[PATCH] D80559: [SVE] Remove getNumElements() warnings in InstCombiner::visitBitCast

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 26 23:22:48 PDT 2020


david-arm marked 2 inline comments as done.
david-arm added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:2529
 
   if (VectorType *DestVTy = dyn_cast<VectorType>(DestTy)) {
     // Beware: messing with this target-specific oddity may cause trouble.
----------------
efriedma wrote:
> Probably should just be `if (auto *DestVTy = dyn_cast<FixedVectorType>(DestTy)) {`.  A bitcast with a scalable vector dest type must have a scalable vector src type, anyway.
OK, perhaps you're right. I thought that some of the code below (optimizeIntegerToVectorInsertions) may still kick in for scalable vectors. I'll have a deeper look.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:2560
+  if (FixedVectorType *SrcVTy = dyn_cast<FixedVectorType>(SrcTy)) {
     if (SrcVTy->getNumElements() == 1) {
       // If our destination is not a vector, then make this a straight
----------------
efriedma wrote:
> We should have a test that we don't do these folds for scalable vectors.
Sure. I hit this while trying to compile a clang ACLE test, so I can reproduce some of that code in a smaller test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80559





More information about the llvm-commits mailing list