1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -enable-machine-outliner -mattr=+m -mtriple=riscv64 < %s | FileCheck %s
4 ; Ensure that we won't outline CFIs when they are needed in unwinding.
6 define i32 @func1(i32 %x) #0 {
8 ; CHECK: # %bb.0: # %entry
9 ; CHECK-NEXT: addi sp, sp, -16
10 ; CHECK-NEXT: .cfi_def_cfa_offset 16
11 ; CHECK-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
12 ; CHECK-NEXT: sd s0, 0(sp) # 8-byte Folded Spill
13 ; CHECK-NEXT: .cfi_offset ra, -8
14 ; CHECK-NEXT: .cfi_offset s0, -16
15 ; CHECK-NEXT: mul a0, a0, a0
16 ; CHECK-NEXT: addi s0, a0, 1
17 ; CHECK-NEXT: li a0, 4
18 ; CHECK-NEXT: call __cxa_allocate_exception
19 ; CHECK-NEXT: sw s0, 0(a0)
20 ; CHECK-NEXT: lui a1, %hi(_ZTIi)
21 ; CHECK-NEXT: addi a1, a1, %lo(_ZTIi)
22 ; CHECK-NEXT: li a2, 0
23 ; CHECK-NEXT: call __cxa_throw
26 %add = add i32 %mul, 1
27 %exception = tail call ptr @__cxa_allocate_exception(i64 4)
28 store i32 %add, ptr %exception
29 tail call void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null)
33 define i32 @func2(i32 %x) #0 {
35 ; CHECK: # %bb.0: # %entry
36 ; CHECK-NEXT: addi sp, sp, -16
37 ; CHECK-NEXT: .cfi_def_cfa_offset 16
38 ; CHECK-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
39 ; CHECK-NEXT: sd s0, 0(sp) # 8-byte Folded Spill
40 ; CHECK-NEXT: .cfi_offset ra, -8
41 ; CHECK-NEXT: .cfi_offset s0, -16
42 ; CHECK-NEXT: mul a0, a0, a0
43 ; CHECK-NEXT: addi s0, a0, 1
44 ; CHECK-NEXT: li a0, 4
45 ; CHECK-NEXT: call __cxa_allocate_exception
46 ; CHECK-NEXT: sw s0, 0(a0)
47 ; CHECK-NEXT: lui a1, %hi(_ZTIi)
48 ; CHECK-NEXT: addi a1, a1, %lo(_ZTIi)
49 ; CHECK-NEXT: li a2, 0
50 ; CHECK-NEXT: call __cxa_throw
53 %add = add i32 %mul, 1
54 %exception = tail call ptr @__cxa_allocate_exception(i64 4)
55 store i32 %add, ptr %exception
56 tail call void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null)
60 @_ZTIi = external constant ptr
61 declare ptr @__cxa_allocate_exception(i64)
62 declare void @__cxa_throw(ptr, ptr, ptr)
64 attributes #0 = { minsize noreturn }