1 ; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=aarch64 < %s | FileCheck %s
2 ; RUN: llc -verify-machineinstrs -enable-machine-outliner -mtriple=aarch64 -stop-after=machine-outliner < %s | FileCheck %s -check-prefix=TARGET_FEATURES
4 ; Make sure that we haven't added nouwind.
5 ; TARGET_FEATURES: define internal void @OUTLINED_FUNCTION_0()
6 ; TARGET_FEATURES-SAME: #[[ATTR_NUM:[0-9]+]]
7 ; TARGET_FEATURES: attributes #[[ATTR_NUM]] = { minsize optsize }
9 define dso_local i32 @_Z5func1i(i32 %x) #0 {
10 ; CHECK-LABEL: _Z5func1i:
11 ; CHECK: // %bb.0: // %entry
12 ; CHECK-NEXT: stp x30, x19, [sp, #-16]! // 16-byte Folded Spill
13 ; CHECK-NEXT: .cfi_def_cfa_offset 16
14 ; CHECK-NEXT: .cfi_offset w19, -8
15 ; CHECK-NEXT: .cfi_offset w30, -16
16 ; CHECK-NEXT: mov w8, #1
17 ; CHECK-NEXT: madd w19, w0, w0, w8
18 ; CHECK-NEXT: mov w0, #4
19 ; CHECK-NEXT: bl __cxa_allocate_exception
20 ; CHECK-NEXT: bl OUTLINED_FUNCTION_0
22 %mul = mul nsw i32 %x, %x
23 %add = add nuw nsw i32 %mul, 1
24 %exception = tail call ptr @__cxa_allocate_exception(i64 4) #1
25 store i32 %add, ptr %exception, align 16
26 tail call void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null) #2
30 define dso_local i32 @_Z5func2c(i8 %x) #0 {
31 ; CHECK-LABEL: _Z5func2c:
32 ; CHECK: // %bb.0: // %entry
33 ; CHECK-NEXT: stp x30, x19, [sp, #-16]! // 16-byte Folded Spill
34 ; CHECK-NEXT: .cfi_def_cfa_offset 16
35 ; CHECK-NEXT: .cfi_offset w19, -8
36 ; CHECK-NEXT: .cfi_offset w30, -16
37 ; CHECK-NEXT: and w8, w0, #0xff
38 ; CHECK-NEXT: mov w0, #4
39 ; CHECK-NEXT: mov w9, #1
40 ; CHECK-NEXT: madd w19, w8, w8, w9
41 ; CHECK-NEXT: bl __cxa_allocate_exception
42 ; CHECK-NEXT: bl OUTLINED_FUNCTION_0
44 %conv = zext i8 %x to i32
45 %mul = mul nuw nsw i32 %conv, %conv
46 %add = add nuw nsw i32 %mul, 1
47 %exception = tail call ptr @__cxa_allocate_exception(i64 4) #1
48 store i32 %add, ptr %exception, align 16
49 tail call void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null) #2
53 ; CHECK-LABEL: OUTLINED_FUNCTION_0:
54 ; CHECK: .cfi_startproc
55 ; CHECK: adrp x1, _ZTIi
56 ; CHECK-NEXT: add x1, x1, :lo12:_ZTIi
57 ; CHECK-NEXT: mov x2, xzr
58 ; CHECK-NEXT: str w19, [x0]
59 ; CHECK-NEXT: b __cxa_throw
63 @_ZTIi = external dso_local constant ptr
64 declare dso_local ptr @__cxa_allocate_exception(i64) local_unnamed_addr
65 declare dso_local void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr
67 attributes #0 = { minsize noreturn optsize }
68 attributes #1 = { nounwind }
69 attributes #2 = { noreturn }