1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -p iroutliner,verify -ir-outlining-no-cost < %s | FileCheck %s
4 ; This test ensures that we do not include llvm.assumes. There are exceptions
5 ; in the CodeExtractor's algorithm for llvm.assumes, so we ignore it for now.
7 define void @outline_assumes() {
8 ; CHECK-LABEL: @outline_assumes(
10 ; CHECK-NEXT: [[DL_LOC:%.*]] = alloca i1, align 1
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: [[D:%.*]] = alloca i1, align 4
15 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr [[DL_LOC]])
16 ; CHECK-NEXT: call void @outlined_ir_func_4(i1 true, ptr [[D]], ptr [[DL_LOC]])
17 ; CHECK-NEXT: [[DL_RELOAD:%.*]] = load i1, ptr [[DL_LOC]], align 1
18 ; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 -1, ptr [[DL_LOC]])
19 ; CHECK-NEXT: [[SPLIT_INST:%.*]] = sub i1 [[DL_RELOAD]], [[DL_RELOAD]]
20 ; CHECK-NEXT: call void @outlined_ir_func_1(ptr [[A]], ptr [[B]], ptr [[C]])
21 ; CHECK-NEXT: call void @llvm.assume(i1 [[DL_RELOAD]])
22 ; CHECK-NEXT: call void @outlined_ir_func_2(ptr [[A]], ptr [[B]], ptr [[C]])
23 ; CHECK-NEXT: ret void
26 %a = alloca i32, align 4
27 %b = alloca i32, align 4
28 %c = alloca i32, align 4
29 %d = alloca i1, align 4
30 store i1 1, ptr %d, align 4
32 %split_inst = sub i1 %dl, %dl
33 store i32 2, ptr %a, align 4
34 store i32 3, ptr %b, align 4
35 store i32 4, ptr %c, align 4
36 call void @llvm.assume(i1 %dl)
37 %al = load i32, ptr %a
38 %bl = load i32, ptr %b
39 %cl = load i32, ptr %c
43 define void @outline_assumes2() {
44 ; CHECK-LABEL: @outline_assumes2(
46 ; CHECK-NEXT: [[DL_LOC:%.*]] = alloca i1, align 1
47 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
48 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
49 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
50 ; CHECK-NEXT: [[D:%.*]] = alloca i1, align 4
51 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr [[DL_LOC]])
52 ; CHECK-NEXT: call void @outlined_ir_func_4(i1 false, ptr [[D]], ptr [[DL_LOC]])
53 ; CHECK-NEXT: [[DL_RELOAD:%.*]] = load i1, ptr [[DL_LOC]], align 1
54 ; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 -1, ptr [[DL_LOC]])
55 ; CHECK-NEXT: call void @outlined_ir_func_1(ptr [[A]], ptr [[B]], ptr [[C]])
56 ; CHECK-NEXT: call void @llvm.assume(i1 [[DL_RELOAD]])
57 ; CHECK-NEXT: call void @outlined_ir_func_2(ptr [[A]], ptr [[B]], ptr [[C]])
58 ; CHECK-NEXT: ret void
61 %a = alloca i32, align 4
62 %b = alloca i32, align 4
63 %c = alloca i32, align 4
64 %d = alloca i1, align 4
65 store i1 0, ptr %d, align 4
67 store i32 2, ptr %a, align 4
68 store i32 3, ptr %b, align 4
69 store i32 4, ptr %c, align 4
70 call void @llvm.assume(i1 %dl)
71 %al = load i32, ptr %a
72 %bl = load i32, ptr %b
73 %cl = load i32, ptr %c
77 define void @outline_assumes3() {
78 ; CHECK-LABEL: @outline_assumes3(
80 ; CHECK-NEXT: [[DL_LOC:%.*]] = alloca i1, align 1
81 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
82 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
83 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
84 ; CHECK-NEXT: [[D:%.*]] = alloca i1, align 4
85 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr [[DL_LOC]])
86 ; CHECK-NEXT: call void @outlined_ir_func_0(i1 true, ptr [[D]], ptr [[A]], ptr [[B]], ptr [[C]], ptr [[DL_LOC]])
87 ; CHECK-NEXT: [[DL_RELOAD:%.*]] = load i1, ptr [[DL_LOC]], align 1
88 ; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 -1, ptr [[DL_LOC]])
89 ; CHECK-NEXT: call void @llvm.assume(i1 [[DL_RELOAD]])
90 ; CHECK-NEXT: call void @outlined_ir_func_3(ptr [[A]])
91 ; CHECK-NEXT: ret void
94 %a = alloca i32, align 4
95 %b = alloca i32, align 4
96 %c = alloca i32, align 4
97 %d = alloca i1, align 4
98 store i1 1, ptr %d, align 4
100 %split_inst = add i1 %dl, %dl
101 store i32 2, ptr %a, align 4
102 store i32 3, ptr %b, align 4
103 store i32 4, ptr %c, align 4
104 call void @llvm.assume(i1 %dl)
105 %al = load i32, ptr %a
106 %bl = add i32 %al, %al
110 define void @outline_assumes4() {
111 ; CHECK-LABEL: @outline_assumes4(
113 ; CHECK-NEXT: [[DL_LOC:%.*]] = alloca i1, align 1
114 ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
115 ; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
116 ; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4
117 ; CHECK-NEXT: [[D:%.*]] = alloca i1, align 4
118 ; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr [[DL_LOC]])
119 ; CHECK-NEXT: call void @outlined_ir_func_0(i1 false, ptr [[D]], ptr [[A]], ptr [[B]], ptr [[C]], ptr [[DL_LOC]])
120 ; CHECK-NEXT: [[DL_RELOAD:%.*]] = load i1, ptr [[DL_LOC]], align 1
121 ; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 -1, ptr [[DL_LOC]])
122 ; CHECK-NEXT: call void @llvm.assume(i1 [[DL_RELOAD]])
123 ; CHECK-NEXT: call void @outlined_ir_func_3(ptr [[A]])
124 ; CHECK-NEXT: ret void
127 %a = alloca i32, align 4
128 %b = alloca i32, align 4
129 %c = alloca i32, align 4
130 %d = alloca i1, align 4
131 store i1 0, ptr %d, align 4
132 %dl = load i1, ptr %d
133 %split_inst = add i1 %dl, %dl
134 store i32 2, ptr %a, align 4
135 store i32 3, ptr %b, align 4
136 store i32 4, ptr %c, align 4
137 call void @llvm.assume(i1 %dl)
138 %al = load i32, ptr %a
139 %bl = add i32 %al, %al
143 declare void @llvm.assume(i1)