xref: /llvm-project/llvm/test/Transforms/MoveAutoInit/branch.ll (revision afa13ba18d9e0eb0de4cccb7061222fe900b732f)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -S -passes='move-auto-init' -verify-memoryssa | FileCheck %s
3
4@__const.foo.buffer = private unnamed_addr constant [8 x i32] [i32 -1431655766, i32 -1431655766, i32 -1431655766, i32 -1431655766, i32 -1431655766, i32 -1431655766, i32 -1431655766, i32 -1431655766], align 16
5
6define void @foo(i32 %x) {
7; CHECK-LABEL: @foo(
8; CHECK-NEXT:  entry:
9; CHECK-NEXT:    [[BUFFER:%.*]] = alloca [8 x i32], align 16
10; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp ne i32 [[X:%.*]], 0
11; CHECK-NEXT:    br i1 [[TOBOOL]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
12; CHECK:       if.then:
13; CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 16 [[BUFFER]], ptr align 16 @__const.foo.buffer, i64 32, i1 false), !annotation !0
14; CHECK-NEXT:    call void @dump(ptr [[BUFFER]])
15; CHECK-NEXT:    br label [[IF_END]]
16; CHECK:       if.end:
17; CHECK-NEXT:    ret void
18;
19
20entry:
21  %buffer = alloca [8 x i32], align 16
22  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %buffer, ptr align 16 @__const.foo.buffer, i64 32, i1 false), !annotation !0
23  %tobool = icmp ne i32 %x, 0
24  br i1 %tobool, label %if.then, label %if.end
25
26if.then:                                          ; preds = %entry
27  call void @dump(ptr %buffer)
28  br label %if.end
29
30if.end:                                           ; preds = %if.then, %entry
31  ret void
32}
33
34
35
36declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg)
37
38declare void @dump(ptr)
39
40!0 = !{!"auto-init"}
41
42