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 is a negative case to show that when we have the same set of
5 ; instructions, but in a different order, they are not outlined in the same way.
6 ; In this case, the arguments passed into the function are in a different order.
8 define void @outline_constants1() {
9 ; CHECK-LABEL: @outline_constants1(
11 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
12 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
13 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
14 ; CHECK-NEXT: store i32 2, ptr [[A]], align 4
15 ; CHECK-NEXT: store i32 3, ptr [[B]], align 4
16 ; CHECK-NEXT: store i32 4, ptr [[C]], align 4
17 ; CHECK-NEXT: call void @[[FUNCTION_0:.*]](ptr [[A]], ptr [[C]], ptr [[B]])
18 ; CHECK-NEXT: ret void
21 %a = alloca i32, align 4
22 %b = alloca i32, align 4
23 %c = alloca i32, align 4
24 store i32 2, ptr %a, align 4
25 store i32 3, ptr %b, align 4
26 store i32 4, ptr %c, align 4
27 %al = load i32, ptr %a
28 %cl = load i32, ptr %c
29 %bl = load i32, ptr %b
33 define void @outline_constants2() {
34 ; CHECK-LABEL: @outline_constants2(
36 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
37 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
38 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
39 ; CHECK-NEXT: store i32 2, ptr [[A]], align 4
40 ; CHECK-NEXT: store i32 3, ptr [[B]], align 4
41 ; CHECK-NEXT: store i32 4, ptr [[C]], align 4
42 ; CHECK-NEXT: call void @[[FUNCTION_0]](ptr [[A]], ptr [[B]], ptr [[C]])
43 ; CHECK-NEXT: ret void
46 %a = alloca i32, align 4
47 %b = alloca i32, align 4
48 %c = alloca i32, align 4
49 store i32 2, ptr %a, align 4
50 store i32 3, ptr %b, align 4
51 store i32 4, ptr %c, align 4
52 %al = load i32, ptr %a
53 %bl = load i32, ptr %b
54 %cl = load i32, ptr %c
58 ; CHECK: define internal void @[[FUNCTION_0]](ptr [[ARG0:%.*]], ptr [[ARG1:%.*]], ptr [[ARG2:%.*]])
59 ; CHECK: entry_to_outline:
60 ; CHECK-NEXT: [[AL:%.*]] = load i32, ptr [[ARG0]], align 4
61 ; CHECK-NEXT: [[BL:%.*]] = load i32, ptr [[ARG1]], align 4
62 ; CHECK-NEXT: [[CL:%.*]] = load i32, ptr [[ARG2]], align 4