1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -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 i8* 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:.*]](i32* [[A]], i32* [[B]], i32* [[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, i32* %a, align 4
23 store i32 3, i32* %b, align 4
24 store i32 4, i32* %c, align 4
25 %al = load i32, i32* %a
26 %bl = load i32, i32* %b
27 %cl = load i32, i32* %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]](i32* [[A]], i32* [[B]], i32* [[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, i32* %a, align 4
45 store i32 3, i32* %b, align 4
46 store i32 4, i32* %c, align 4
47 %al = load i32, i32* %a
48 %bl = load i32, i32* %b
49 %cl = load i32, i32* %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, i32* [[A]], align 4
62 ; CHECK-NEXT: store i32 3, i32* [[B]], align 4
63 ; CHECK-NEXT: store i32 4, i32* [[C]], align 4
64 ; CHECK-NEXT: [[AL:%.*]] = load i32, i32* [[A]], align 4
65 ; CHECK-NEXT: [[BL:%.*]] = load i32, i32* [[B]], align 4
66 ; CHECK-NEXT: [[CL:%.*]] = load i32, i32* [[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, i32* %a, align 4
76 store i32 3, i32* %b, align 4
77 store i32 4, i32* %c, align 4
78 %al = load i32, i32* %a
79 %bl = load i32, i32* %b
80 %cl = load i32, i32* %c
84 ; CHECK: define internal void @[[FUNCTION_1]](i32* [[ARG0:%.*]], i32* [[ARG1:%.*]], i32* [[ARG2:%.*]])
85 ; CHECK: entry_to_outline:
86 ; CHECK-NEXT: store i32 2, i32* [[ARG0]], align 4
87 ; CHECK-NEXT: store i32 3, i32* [[ARG1]], align 4
88 ; CHECK-NEXT: store i32 4, i32* [[ARG2]], align 4
89 ; CHECK-NEXT: [[AL:%.*]] = load i32, i32* [[ARG0]], align 4
90 ; CHECK-NEXT: [[BL:%.*]] = load i32, i32* [[ARG1]], align 4
91 ; CHECK-NEXT: [[CL:%.*]] = load i32, i32* [[ARG2]], align 4