xref: /llvm-project/llvm/test/Transforms/InstCombine/vscale_alloca.ll (revision 5fb9e840476d531cb5377c69941f2ccfe4145475)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -passes=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, ptr %a
10  %load = load <vscale x 4 x i32>, ptr %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, ptr %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(ptr nonnull [[A]])
29; CHECK-NEXT:    call void (...) @use(ptr nonnull [[B]])
30; CHECK-NEXT:    ret void
31;
32  %a = alloca <vscale x 16 x i8>
33  call void (...) @use( ptr %a )
34  %b = alloca {  }
35  call void (...) @use( ptr %b )
36  ret void
37}
38