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 successfully outline identical memset instructions.
6 declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i32, i1)
8 define i64 @function1(i64 %x, i64 %z, i64 %n) {
10 %pool = alloca [59 x i64], align 4
11 call void @llvm.memset.p0.i64(ptr nonnull %pool, i8 0, i64 236, i32 4, i1 false)
12 %cmp3 = icmp eq i64 %n, 0
18 define i64 @function2(i64 %x, i64 %z, i64 %n) {
20 %pool = alloca [59 x i64], align 4
21 call void @llvm.memset.p0.i64(ptr nonnull %pool, i8 0, i64 236, i32 4, i1 false)
22 %cmp3 = icmp eq i64 %n, 0
27 ; CHECK-LABEL: @function1(
29 ; CHECK-NEXT: [[POOL:%.*]] = alloca [59 x i64], align 4
30 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[POOL]], i64 [[N:%.*]], i64 [[X:%.*]], i64 [[Z:%.*]])
31 ; CHECK-NEXT: ret i64 0
34 ; CHECK-LABEL: @function2(
36 ; CHECK-NEXT: [[POOL:%.*]] = alloca [59 x i64], align 4
37 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[POOL]], i64 [[N:%.*]], i64 [[X:%.*]], i64 [[Z:%.*]])
38 ; CHECK-NEXT: ret i64 0
41 ; CHECK: define internal void @outlined_ir_func_0(
42 ; CHECK-NEXT: newFuncRoot:
43 ; CHECK-NEXT: br label [[ENTRY_TO_OUTLINE:%.*]]
44 ; CHECK: entry_to_outline:
45 ; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr nonnull align 4 [[TMP0:%.*]], i8 0, i64 236, i1 false)
46 ; CHECK-NEXT: [[CMP3:%.*]] = icmp eq i64 [[TMP1:%.*]], 0
47 ; CHECK-NEXT: [[A:%.*]] = add i64 [[TMP2:%.*]], [[TMP3:%.*]]
48 ; CHECK-NEXT: [[C:%.*]] = add i64 [[TMP2]], [[TMP3]]
49 ; CHECK-NEXT: br label [[ENTRY_AFTER_OUTLINE_EXITSTUB:%.*]]
50 ; CHECK: entry_after_outline.exitStub:
51 ; CHECK-NEXT: ret void