xref: /llvm-project/llvm/test/Transforms/InstCombine/scalable-bitcast-inseltpoison.ll (revision acdc419c897f8a9414c7a00c8908ac32312afee2)
1*acdc419cSBjorn Pettersson; RUN: opt -passes=instcombine -S < %s | FileCheck %s
2b723aa2aSNashe Mncube
3b723aa2aSNashe Mncube; We shouldn't fold bitcast(insert <vscale x 1 x iX> .., iX %val, i32 0)
4b723aa2aSNashe Mncube; into bitcast(iX %val) for scalable vectors.
5b723aa2aSNashe Mncubedefine <vscale x 2 x i8> @bitcast_of_insert_i8_i16(i16 %val) #0 {
6b723aa2aSNashe Mncube; CHECK-LABEL: @bitcast_of_insert_i8_i16(
7b723aa2aSNashe Mncube; CHECK-NOT:   bitcast i16 %val to <vscale x 2 x i8>
8b723aa2aSNashe Mncube; CHECK:       bitcast <vscale x 1 x i16> %op2 to <vscale x 2 x i8>
9b723aa2aSNashe Mncubeentry:
10b723aa2aSNashe Mncube  %op2 = insertelement <vscale x 1 x i16> poison, i16 %val, i32 0
11b723aa2aSNashe Mncube  %0 = bitcast <vscale x 1 x i16> %op2 to <vscale x 2 x i8>
12b723aa2aSNashe Mncube  ret <vscale x 2 x i8> %0
13b723aa2aSNashe Mncube}
14