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 ; Check alloca with non-0 address spaces works correctly.
6 target datalayout = "A5"
8 define i32 @outlineable() {
10 %i = tail call i32 @func(i32 0, i32 1)
12 %i2 = tail call i32 @func(i32 %i1, i32 0)
17 declare i32 @func(i32, i32)
18 ; CHECK-LABEL: define {{[^@]+}}@outlineable() {
20 ; CHECK-NEXT: [[I1_LOC:%.*]] = alloca i32, align 4, addrspace(5)
21 ; CHECK-NEXT: call void @llvm.lifetime.start.p5(i64 -1, ptr addrspace(5) [[I1_LOC]])
22 ; CHECK-NEXT: call void @outlined_ir_func_0(i32 0, i32 1, ptr addrspace(5) [[I1_LOC]], i32 0)
23 ; CHECK-NEXT: [[I1_RELOAD:%.*]] = load i32, ptr addrspace(5) [[I1_LOC]], align 4
24 ; CHECK-NEXT: call void @llvm.lifetime.end.p5(i64 -1, ptr addrspace(5) [[I1_LOC]])
25 ; CHECK-NEXT: call void @outlined_ir_func_0(i32 [[I1_RELOAD]], i32 0, ptr addrspace(5) null, i32 -1)
26 ; CHECK-NEXT: ret i32 0
29 ; CHECK-LABEL: define {{[^@]+}}@outlined_ir_func_0
30 ; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]], ptr addrspace(5) [[TMP2:%.*]], i32 [[TMP3:%.*]]) #[[ATTR1:[0-9]+]] {
31 ; CHECK-NEXT: newFuncRoot:
32 ; CHECK-NEXT: br label [[BB_TO_OUTLINE:%.*]]
33 ; CHECK: bb_to_outline:
34 ; CHECK-NEXT: [[I:%.*]] = tail call i32 @func(i32 [[TMP0]], i32 [[TMP1]])
35 ; CHECK-NEXT: [[I1:%.*]] = or i32 [[TMP0]], [[I]]
36 ; CHECK-NEXT: br label [[BB_AFTER_OUTLINE_EXITSTUB:%.*]]
37 ; CHECK: bb_after_outline.exitStub:
38 ; CHECK-NEXT: switch i32 [[TMP3]], label [[FINAL_BLOCK_0:%.*]] [
39 ; CHECK-NEXT: i32 0, label [[OUTPUT_BLOCK_0_0:%.*]]
41 ; CHECK: output_block_0_0:
42 ; CHECK-NEXT: store i32 [[I1]], ptr addrspace(5) [[TMP2]], align 4
43 ; CHECK-NEXT: br label [[FINAL_BLOCK_0]]
44 ; CHECK: final_block_0:
45 ; CHECK-NEXT: ret void