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 do outline indirect calls when it is not specified
7 declare void @f1(ptr, ptr);
8 declare void @f2(ptr, ptr);
10 define void @function1(ptr %func) {
12 %a = alloca i32, align 4
13 %b = alloca i32, align 4
14 %c = alloca i32, align 4
15 store i32 2, ptr %a, align 4
16 store i32 3, ptr %b, align 4
17 store i32 4, ptr %c, align 4
19 %al = load i32, ptr %a
20 %bl = load i32, ptr %b
21 %cl = load i32, ptr %c
25 define void @function2(ptr %func) {
27 %a = alloca i32, align 4
28 %b = alloca i32, align 4
29 %c = alloca i32, align 4
30 store i32 2, ptr %a, align 4
31 store i32 3, ptr %b, align 4
32 store i32 4, ptr %c, align 4
34 %al = load i32, ptr %a
35 %bl = load i32, ptr %b
36 %cl = load i32, ptr %c
39 ; CHECK-LABEL: @function1(
41 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
42 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
43 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
44 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[A]], ptr [[B]], ptr [[C]], ptr [[FUNC:%.*]])
45 ; CHECK-NEXT: ret void
48 ; CHECK-LABEL: @function2(
50 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
51 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
52 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
53 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[A]], ptr [[B]], ptr [[C]], ptr [[FUNC:%.*]])
54 ; CHECK-NEXT: ret void
57 ; CHECK-LABEL: define internal void @outlined_ir_func_0(
58 ; CHECK-NEXT: newFuncRoot:
59 ; CHECK-NEXT: br label [[ENTRY_TO_OUTLINE:%.*]]
60 ; CHECK: entry_to_outline:
61 ; CHECK-NEXT: store i32 2, ptr [[TMP0:%.*]], align 4
62 ; CHECK-NEXT: store i32 3, ptr [[TMP1:%.*]], align 4
63 ; CHECK-NEXT: store i32 4, ptr [[TMP2:%.*]], align 4
64 ; CHECK-NEXT: call void [[TMP3:%.*]]()
65 ; CHECK-NEXT: [[AL:%.*]] = load i32, ptr [[TMP0]], align 4
66 ; CHECK-NEXT: [[BL:%.*]] = load i32, ptr [[TMP1]], align 4
67 ; CHECK-NEXT: [[CL:%.*]] = load i32, ptr [[TMP2]], align 4
68 ; CHECK-NEXT: br label [[ENTRY_AFTER_OUTLINE_EXITSTUB:%.*]]
69 ; CHECK: entry_after_outline.exitStub:
70 ; CHECK-NEXT: ret void