llvm.org GIT mirror llvm / 7088fb6
Add a test case for PR14750. This was fixed by r174402. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174405 91177308-0d34-0410-b5e6-96231b3b80d8 Jakob Stoklund Olesen 7 years ago
1 changed file(s) with 40 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
0 ; Check that eh_return & unwind_init were properly lowered
1 ; RUN: llc < %s | grep %rbp | count 7
2 ; RUN: llc < %s | grep %rcx | count 3
1 ; RUN: llc < %s -verify-machineinstrs | FileCheck %s
32
43 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"
54 target triple = "x86_64-unknown-linux-gnu"
65
6 ; CHECK: test
7 ; CHECK: pushq %rbp
8 ; CHECK: movq %rsp, %rbp
9 ; CHECK: popq %rbp
10 ; CHECK: movq %rcx, %rsp
11 ; CHECK: ret # eh_return, addr: %rcx
712 define i8* @test(i64 %a, i8* %b) {
813 entry:
914 call void @llvm.eh.unwind.init()
1419
1520 declare void @llvm.eh.return.i64(i64, i8*)
1621 declare void @llvm.eh.unwind.init()
22
23 @b = common global i32 0, align 4
24 @a = common global i32 0, align 4
25
26 ; PR14750
27 ; This function contains a normal return as well as eh_return.
28 ; CHECK: _Unwind_Resume_or_Rethrow
29 define i32 @_Unwind_Resume_or_Rethrow() nounwind uwtable ssp {
30 entry:
31 %0 = load i32* @b, align 4
32 %tobool = icmp eq i32 %0, 0
33 br i1 %tobool, label %if.end, label %if.then
34
35 if.then: ; preds = %entry
36 ret i32 0
37
38 if.end: ; preds = %entry
39 %call = tail call i32 (...)* @_Unwind_ForcedUnwind_Phase2() nounwind
40 store i32 %call, i32* @a, align 4
41 %tobool1 = icmp eq i32 %call, 0
42 br i1 %tobool1, label %cond.end, label %cond.true
43
44 cond.true: ; preds = %if.end
45 tail call void @abort() noreturn nounwind
46 unreachable
47
48 cond.end: ; preds = %if.end
49 tail call void @llvm.eh.return.i64(i64 0, i8* null)
50 unreachable
51 }
52
53 declare i32 @_Unwind_ForcedUnwind_Phase2(...)
54 declare void @abort() noreturn