1 ; Check that eh_return & unwind_init were properly lowered
2 ; RUN: llc < %s -verify-machineinstrs | FileCheck %s
4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
5 target triple = "x86_64-unknown-linux-gnu"
9 ; CHECK: movq %rsp, %rbp
11 ; CHECK: movq %rcx, %rsp
12 ; CHECK: retq # eh_return, addr: %rcx
13 define ptr @test(i64 %a, ptr %b) {
15 call void @llvm.eh.unwind.init()
17 call void @llvm.eh.return.i64(i64 %a, ptr %b)
21 declare void @llvm.eh.return.i64(i64, ptr)
22 declare void @llvm.eh.unwind.init()
24 @b = common global i32 0, align 4
25 @a = common global i32 0, align 4
28 ; This function contains a normal return as well as eh_return.
29 ; CHECK: _Unwind_Resume_or_Rethrow
30 define i32 @_Unwind_Resume_or_Rethrow() nounwind uwtable ssp {
32 %0 = load i32, ptr @b, align 4
33 %tobool = icmp eq i32 %0, 0
34 br i1 %tobool, label %if.end, label %if.then
36 if.then: ; preds = %entry
39 if.end: ; preds = %entry
40 %call = tail call i32 (...) @_Unwind_ForcedUnwind_Phase2() nounwind
41 store i32 %call, ptr @a, align 4
42 %tobool1 = icmp eq i32 %call, 0
43 br i1 %tobool1, label %cond.end, label %cond.true
45 cond.true: ; preds = %if.end
46 tail call void @abort() noreturn nounwind
49 cond.end: ; preds = %if.end
50 tail call void @llvm.eh.return.i64(i64 0, ptr null)
54 declare i32 @_Unwind_ForcedUnwind_Phase2(...)
55 declare void @abort() noreturn