1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s | FileCheck %s
4 ; This test shows that we do not outline from basic blocks with their address
7 @ba1 = constant ptr blockaddress (@dontoutline, %new_block)
9 define void @outline_1() {
10 ; CHECK-LABEL: @outline_1(
12 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
13 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
14 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
15 ; CHECK-NEXT: call void @[[FUNCTION_1:.*]](ptr [[A]], ptr [[B]], ptr [[C]])
16 ; CHECK-NEXT: ret void
19 %a = alloca i32, align 4
20 %b = alloca i32, align 4
21 %c = alloca i32, align 4
22 store i32 2, ptr %a, align 4
23 store i32 3, ptr %b, align 4
24 store i32 4, ptr %c, align 4
25 %al = load i32, ptr %a
26 %bl = load i32, ptr %b
27 %cl = load i32, ptr %c
31 define void @outline_2() {
32 ; CHECK-LABEL: @outline_2(
34 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
35 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
36 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
37 ; CHECK-NEXT: call void @[[FUNCTION_1]](ptr [[A]], ptr [[B]], ptr [[C]])
38 ; CHECK-NEXT: ret void
41 %a = alloca i32, align 4
42 %b = alloca i32, align 4
43 %c = alloca i32, align 4
44 store i32 2, ptr %a, align 4
45 store i32 3, ptr %b, align 4
46 store i32 4, ptr %c, align 4
47 %al = load i32, ptr %a
48 %bl = load i32, ptr %b
49 %cl = load i32, ptr %c
53 define void @dontoutline() {
54 ; CHECK-LABEL: @dontoutline(
56 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
57 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
58 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
59 ; CHECK-NEXT: br label [[NEW_BLOCK:%.*]]
61 ; CHECK-NEXT: store i32 2, ptr [[A]], align 4
62 ; CHECK-NEXT: store i32 3, ptr [[B]], align 4
63 ; CHECK-NEXT: store i32 4, ptr [[C]], align 4
64 ; CHECK-NEXT: [[AL:%.*]] = load i32, ptr [[A]], align 4
65 ; CHECK-NEXT: [[BL:%.*]] = load i32, ptr [[B]], align 4
66 ; CHECK-NEXT: [[CL:%.*]] = load i32, ptr [[C]], align 4
67 ; CHECK-NEXT: ret void
70 %a = alloca i32, align 4
71 %b = alloca i32, align 4
72 %c = alloca i32, align 4
75 store i32 2, ptr %a, align 4
76 store i32 3, ptr %b, align 4
77 store i32 4, ptr %c, align 4
78 %al = load i32, ptr %a
79 %bl = load i32, ptr %b
80 %cl = load i32, ptr %c
84 ; CHECK: define internal void @[[FUNCTION_1]](ptr [[ARG0:%.*]], ptr [[ARG1:%.*]], ptr [[ARG2:%.*]])
85 ; CHECK: entry_to_outline:
86 ; CHECK-NEXT: store i32 2, ptr [[ARG0]], align 4
87 ; CHECK-NEXT: store i32 3, ptr [[ARG1]], align 4
88 ; CHECK-NEXT: store i32 4, ptr [[ARG2]], align 4
89 ; CHECK-NEXT: [[AL:%.*]] = load i32, ptr [[ARG0]], align 4
90 ; CHECK-NEXT: [[BL:%.*]] = load i32, ptr [[ARG1]], align 4
91 ; CHECK-NEXT: [[CL:%.*]] = load i32, ptr [[ARG2]], align 4