1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs
2 ; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s | FileCheck %s
4 ; This test checks that we sucecssfully outline identical memmove instructions.
6 declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1)
8 define i8 @function1(ptr noalias %s, ptr noalias %d, i64 %len) {
12 call void @llvm.memmove.p0.p0.i64(ptr %d, ptr %s, i64 %len, i1 false)
14 %ret = load i8, ptr %s
18 define i8 @function2(ptr noalias %s, ptr noalias %d, i64 %len) {
22 call void @llvm.memmove.p0.p0.i64(ptr %d, ptr %s, i64 %len, i1 false)
24 %ret = load i8, ptr %s
27 ; CHECK-LABEL: @function1(
29 ; CHECK-NEXT: [[RET_LOC:%.*]] = alloca i8, align 1
30 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr [[RET_LOC]])
31 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[S:%.*]], ptr [[D:%.*]], i64 [[LEN:%.*]], ptr [[RET_LOC]])
32 ; CHECK-NEXT: [[RET_RELOAD:%.*]] = load i8, ptr [[RET_LOC]], align 1
33 ; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 -1, ptr [[RET_LOC]])
34 ; CHECK-NEXT: ret i8 [[RET_RELOAD]]
37 ; CHECK-LABEL: @function2(
39 ; CHECK-NEXT: [[RET_LOC:%.*]] = alloca i8, align 1
40 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr [[RET_LOC]])
41 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[S:%.*]], ptr [[D:%.*]], i64 [[LEN:%.*]], ptr [[RET_LOC]])
42 ; CHECK-NEXT: [[RET_RELOAD:%.*]] = load i8, ptr [[RET_LOC]], align 1
43 ; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 -1, ptr [[RET_LOC]])
44 ; CHECK-NEXT: ret i8 [[RET_RELOAD]]
47 ; CHECK: define internal void @outlined_ir_func_0(
48 ; CHECK-NEXT: newFuncRoot:
49 ; CHECK-NEXT: br label [[ENTRY_TO_OUTLINE:%.*]]
50 ; CHECK: entry_to_outline:
51 ; CHECK-NEXT: [[A:%.*]] = load i8, ptr [[TMP0:%.*]], align 1
52 ; CHECK-NEXT: [[B:%.*]] = load i8, ptr [[TMP1:%.*]], align 1
53 ; CHECK-NEXT: call void @llvm.memmove.p0.p0.i64(ptr [[TMP1]], ptr [[TMP0]], i64 [[TMP2:%.*]], i1 false)
54 ; CHECK-NEXT: [[C:%.*]] = add i8 [[A]], [[B]]
55 ; CHECK-NEXT: [[RET:%.*]] = load i8, ptr [[TMP0]], align 1
56 ; CHECK-NEXT: br label [[ENTRY_AFTER_OUTLINE_EXITSTUB:%.*]]
57 ; CHECK: entry_after_outline.exitStub:
58 ; CHECK-NEXT: store i8 [[RET]], ptr [[TMP3:%.*]], align 1
59 ; CHECK-NEXT: ret void