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 looks at the constants in the regions, and if it they are the
5 ; same it outlines them as constants rather than elevating them to arguments.
7 define void @outline_constants1() {
8 ; CHECK-LABEL: @outline_constants1(
10 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
11 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
12 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
13 ; CHECK-NEXT: call void @[[FUNCTION_0:.*]](i32* [[A]], i32* [[B]], i32* [[C]])
14 ; CHECK-NEXT: ret void
17 %a = alloca i32, align 4
18 %b = alloca i32, align 4
19 %c = alloca i32, align 4
20 store i32 2, i32* %a, align 4
21 store i32 3, i32* %b, align 4
22 store i32 4, i32* %c, align 4
23 %al = load i32, i32* %a
24 %bl = load i32, i32* %b
25 %cl = load i32, i32* %c
29 define void @outline_constants2() {
30 ; CHECK-LABEL: @outline_constants2(
32 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
33 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
34 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
35 ; CHECK-NEXT: call void @[[FUNCTION_0]](i32* [[A]], i32* [[B]], i32* [[C]])
36 ; CHECK-NEXT: ret void
39 %a = alloca i32, align 4
40 %b = alloca i32, align 4
41 %c = alloca i32, align 4
42 store i32 2, i32* %a, align 4
43 store i32 3, i32* %b, align 4
44 store i32 4, i32* %c, align 4
45 %al = load i32, i32* %a
46 %bl = load i32, i32* %b
47 %cl = load i32, i32* %c
51 ; CHECK: define internal void @[[FUNCTION_0]](i32* [[ARG0:%.*]], i32* [[ARG1:%.*]], i32* [[ARG2:%.*]])
52 ; CHECK: entry_to_outline:
53 ; CHECK-NEXT: store i32 2, i32* [[ARG0]], align 4
54 ; CHECK-NEXT: store i32 3, i32* [[ARG1]], align 4
55 ; CHECK-NEXT: store i32 4, i32* [[ARG2]], align 4
56 ; CHECK-NEXT: [[AL:%.*]] = load i32, i32* [[ARG0]], align 4
57 ; CHECK-NEXT: [[BL:%.*]] = load i32, i32* [[ARG1]], align 4
58 ; CHECK-NEXT: [[CL:%.*]] = load i32, i32* [[ARG2]], align 4