[PATCH] D82056: [SVE] Remove calls to VectorType::getNumElements from Transforms/Vectorize

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 14:12:59 PDT 2020


ctetreau marked an inline comment as done.
ctetreau added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/VectorCombine.cpp:339
+  auto *DestTy = dyn_cast<FixedVectorType>(I.getType());
+  auto *SrcTy = cast<FixedVectorType>(V->getType());
   if (!DestTy || I.getOperand(0)->getType() != SrcTy)
----------------
spatel wrote:
> IIUC, we can't safely cast to FixedVectorType at this point (the dyn_cast may have failed).
> 
> Should we add a test like this:
> 
> ```
> define <vscale x 4 x float> @scalable_bitcast_same_elt_size(<vscale x 4 x i32> %v) {
>   %shuf = shufflevector <vscale x 4 x i32> %v, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer
>   %r = bitcast <vscale x 4 x i32> %shuf to <vscale x 4 x float>
>   ret <vscale x 4 x float> %r
> }
> 
> ```
> 
> I would add that in a preliminary commit myself, but it already crashes somewhere in the TTI cost model.
I can take a look at adding this test case and seeing if I can get to this line with a scalable vector.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82056





More information about the llvm-commits mailing list