[PATCH] D124997: [InstCombine] Fix scalable-vector bitwise select matching

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 08:11:20 PDT 2022


spatel added a comment.

In D124997#3493988 <https://reviews.llvm.org/D124997#3493988>, @frasercrmck wrote:

> I was under the impression that if `Cond->getType()` is //any// vector type we must either be able to do the bitcast or bail. So wouldn't we just need the other checks I've added in an `else`?

We can still have a vector bitcast where the cast is to a type that matches the number of elements in the vector condition. That's the 2nd test IIUC, so if we just do the dyn_cast, it becomes:

  define <vscale x 1 x i64> @vec_of_casted_bools_scalable(<vscale x 1 x i64> %a, <vscale x 1 x i64> %b, <vscale x 8 x i1> %cond) {
    %1 = bitcast <vscale x 1 x i64> %a to <vscale x 8 x i8>
    %2 = bitcast <vscale x 1 x i64> %b to <vscale x 8 x i8>
    %3 = select <vscale x 8 x i1> %cond, <vscale x 8 x i8> %1, <vscale x 8 x i8> %2
    %4 = bitcast <vscale x 8 x i8> %3 to <vscale x 1 x i64>
    ret <vscale x 1 x i64> %4
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124997



More information about the llvm-commits mailing list