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