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 ; Show that we do extract phi nodes from the regions.
6 define void @function1(ptr %a, ptr %b) {
8 %0 = alloca i32, align 4
9 %c = load i32, ptr %0, align 4
12 %e = load i32, ptr %0, align 4
15 %d = load i32, ptr %0, align 4
18 %1 = phi i32 [ %c, %test ], [ %e, %test1 ]
19 store i32 2, ptr %a, align 4
20 store i32 3, ptr %b, align 4
24 define void @function2(ptr %a, ptr %b) {
26 %0 = alloca i32, align 4
27 %c = load i32, ptr %0, align 4
30 %e = load i32, ptr %0, align 4
33 %d = load i32, ptr %0, align 4
36 %1 = phi i32 [ %c, %test ], [ %e, %test1 ]
37 store i32 2, ptr %a, align 4
38 store i32 3, ptr %b, align 4
41 ; CHECK-LABEL: @function1(
43 ; CHECK-NEXT: [[TMP0:%.*]] = alloca i32, align 4
44 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[TMP0]], ptr [[A:%.*]], ptr [[B:%.*]])
45 ; CHECK-NEXT: ret void
48 ; CHECK-LABEL: @function2(
50 ; CHECK-NEXT: [[TMP0:%.*]] = alloca i32, align 4
51 ; CHECK-NEXT: call void @outlined_ir_func_0(ptr [[TMP0]], ptr [[A:%.*]], ptr [[B:%.*]])
52 ; CHECK-NEXT: ret void
55 ; CHECK: define internal void @outlined_ir_func_0(
56 ; CHECK-NEXT: newFuncRoot:
57 ; CHECK-NEXT: br label [[ENTRY_TO_OUTLINE:%.*]]
58 ; CHECK: entry_to_outline:
59 ; CHECK-NEXT: [[C:%.*]] = load i32, ptr [[TMP0:%.*]], align 4
60 ; CHECK-NEXT: br label [[TEST1:%.*]]
62 ; CHECK-NEXT: [[E:%.*]] = load i32, ptr [[TMP0]], align 4
63 ; CHECK-NEXT: br label [[FIRST:%.*]]
65 ; CHECK-NEXT: [[D:%.*]] = load i32, ptr [[TMP0]], align 4
66 ; CHECK-NEXT: br label [[FIRST]]
68 ; CHECK-NEXT: [[TMP3:%.*]] = phi i32 [ [[C]], [[TEST:%.*]] ], [ [[E]], [[TEST1]] ]
69 ; CHECK-NEXT: store i32 2, ptr [[TMP1:%.*]], align 4
70 ; CHECK-NEXT: store i32 3, ptr [[TMP2:%.*]], align 4
71 ; CHECK-NEXT: br label [[ENTRY_AFTER_OUTLINE_EXITSTUB:%.*]]
72 ; CHECK: entry_after_outline.exitStub:
73 ; CHECK-NEXT: ret void