1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -instcombine -verify < %s | FileCheck %s
3
4define <vscale x 4 x i32> @alloca(<vscale x 4 x i32> %z) {
5; CHECK-LABEL: @alloca(
6; CHECK-NEXT:    ret <vscale x 4 x i32> [[Z:%.*]]
7;
8  %a = alloca <vscale x 4 x i32>
9  store <vscale x 4 x i32> %z, <vscale x 4 x i32>* %a
10  %load = load <vscale x 4 x i32>, <vscale x 4 x i32>* %a
11  ret <vscale x 4 x i32> %load
12}
13
14define void @alloca_dead_store(<vscale x 4 x i32> %z) {
15; CHECK-LABEL: @alloca_dead_store(
16; CHECK-NEXT:    ret void
17;
18  %a = alloca <vscale x 4 x i32>
19  store <vscale x 4 x i32> %z, <vscale x 4 x i32>* %a
20  ret void
21}
22
23declare void @use(...)
24define void @alloca_zero_byte_move_first_inst() {
25; CHECK-LABEL: @alloca_zero_byte_move_first_inst(
26; CHECK-NEXT:    [[B:%.*]] = alloca {}, align 8
27; CHECK-NEXT:    [[A:%.*]] = alloca <vscale x 16 x i8>, align 16
28; CHECK-NEXT:    call void (...) @use(<vscale x 16 x i8>* nonnull [[A]])
29; CHECK-NEXT:    call void (...) @use({}* nonnull [[B]])
30; CHECK-NEXT:    ret void
31;
32  %a = alloca <vscale x 16 x i8>
33  call void (...) @use( <vscale x 16 x i8>* %a )
34  %b = alloca {  }
35  call void (...) @use( {  }* %b )
36  ret void
37}
38