1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs
2 ; RUN: opt -S -passes=iroutliner -ir-outlining-no-cost < %s | FileCheck %s
4 target datalayout = "A5"
6 define i32 @func_with_outgoing_new_allocas() {
8 %i = tail call i32 @func0(i32 0, i32 1)
10 %i2 = tail call i32 @func0(i32 %i1, i32 0)
12 %i4 = tail call i32 @llvm.foo(i32 %i3, i32 0)
16 declare i32 @func0(i32, i32)
17 declare i32 @llvm.foo(i32, i32)
19 ; CHECK-LABEL: define {{[^@]+}}@func_with_outgoing_new_allocas() {
21 ; CHECK-NEXT: [[I3_LOC:%.*]] = alloca i32, align 4, addrspace(5)
22 ; CHECK-NEXT: [[I1_LOC:%.*]] = alloca i32, align 4, addrspace(5)
23 ; CHECK-NEXT: call void @llvm.lifetime.start.p5(i64 -1, ptr addrspace(5) [[I1_LOC]])
24 ; CHECK-NEXT: call void @outlined_ir_func_0(i32 0, i32 1, ptr addrspace(5) [[I1_LOC]])
25 ; CHECK-NEXT: [[I1_RELOAD:%.*]] = load i32, ptr addrspace(5) [[I1_LOC]], align 4
26 ; CHECK-NEXT: call void @llvm.lifetime.end.p5(i64 -1, ptr addrspace(5) [[I1_LOC]])
27 ; CHECK-NEXT: call void @llvm.lifetime.start.p5(i64 -1, ptr addrspace(5) [[I3_LOC]])
28 ; CHECK-NEXT: call void @outlined_ir_func_0(i32 [[I1_RELOAD]], i32 0, ptr addrspace(5) [[I3_LOC]])
29 ; CHECK-NEXT: [[I3_RELOAD:%.*]] = load i32, ptr addrspace(5) [[I3_LOC]], align 4
30 ; CHECK-NEXT: call void @llvm.lifetime.end.p5(i64 -1, ptr addrspace(5) [[I3_LOC]])
31 ; CHECK-NEXT: [[I4:%.*]] = tail call i32 @llvm.foo(i32 [[I3_RELOAD]], i32 0)
32 ; CHECK-NEXT: ret i32 0
35 ; CHECK-LABEL: define {{[^@]+}}@outlined_ir_func_0
36 ; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], ptr addrspace(5) [[TMP2:%.*]]) #[[ATTR1:[0-9]+]] {
37 ; CHECK-NEXT: newFuncRoot:
38 ; CHECK-NEXT: br label [[BB_TO_OUTLINE:%.*]]
39 ; CHECK: bb_to_outline:
40 ; CHECK-NEXT: [[I:%.*]] = tail call i32 @func0(i32 [[TMP0]], i32 [[TMP1]])
41 ; CHECK-NEXT: [[I1:%.*]] = or i32 [[TMP0]], [[I]]
42 ; CHECK-NEXT: br label [[BB_AFTER_OUTLINE_EXITSTUB:%.*]]
43 ; CHECK: bb_after_outline.exitStub:
44 ; CHECK-NEXT: store i32 [[I1]], ptr addrspace(5) [[TMP2]], align 4
45 ; CHECK-NEXT: ret void