[llvm] [AArch64] Optimized generated assembly for bool to svbool_t conversions (PR #83001)

Momchil Velikov via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 08:03:01 PST 2024


================
@@ -276,6 +276,7 @@ static bool isZeroingInactiveLanes(SDValue Op) {
     if (ISD::isConstantSplatVectorAllOnes(Op.getNode()))
       return true;
     return false;
+  case ISD::SPLAT_VECTOR:
----------------
momchil-velikov wrote:

Is the code above (`isConstantSplatVectorAllOnes`) needed anymore. Or at all?

Before this patch it could handle
```
  %.splatinsert = insertelement <vscale x 4 x i1> poison, i1 1, i64 0
  %.splat = shufflevector <vscale x 4 x i1> %.splatinsert, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
  %0 = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> %.splat)
```

but not

```
  %.splatinsert = insertelement <vscale x 4 x i1> poison, i1 0, i64 0
  %.splat = shufflevector <vscale x 4 x i1> %.splatinsert, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
  %0 = tail call <vscale x 16 x i1> @llvm.aarch64.sve.convert.to.svbool.nxv4i1(<vscale x 4 x i1> %.splat)
```

which makes me a bit skeptical about it in general. Now it becomes meaningless, except when you have a sequence of bitcasts ending with a `splat_vector`, but then maybe you should handle such a sequence in this patch?

https://github.com/llvm/llvm-project/pull/83001


More information about the llvm-commits mailing list