David Majnemer | 086fec2 | 2016-01-08 08:03:55 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s | FileCheck %s |
| 2 | |
| 3 | target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" |
| 4 | target triple = "x86_64-pc-windows-msvc" |
| 5 | |
| 6 | declare void @throw() |
| 7 | |
| 8 | declare i32 @__CxxFrameHandler3(...) |
| 9 | |
| 10 | define void @test1() personality i32 (...)* @__CxxFrameHandler3 { |
| 11 | entry: |
| 12 | %alloca2 = alloca i8*, align 4 |
| 13 | %alloca1 = alloca i8*, align 4 |
| 14 | store volatile i8* null, i8** %alloca1 |
| 15 | invoke void @throw() |
| 16 | to label %unreachable unwind label %catch.dispatch |
| 17 | |
| 18 | ; CHECK-LABEL: test1: |
David Majnemer | 1ef6540 | 2016-03-03 00:01:25 +0000 | [diff] [blame] | 19 | ; CHECK: movq $0, -8(%rbp) |
David Majnemer | 086fec2 | 2016-01-08 08:03:55 +0000 | [diff] [blame] | 20 | ; CHECK: callq throw |
| 21 | |
| 22 | catch.dispatch: ; preds = %entry |
| 23 | %cs = catchswitch within none [label %catch.pad] unwind to caller |
| 24 | |
| 25 | catch.pad: ; preds = %catch.dispatch |
| 26 | %cp = catchpad within %cs [i8* null, i32 0, i8** %alloca1] |
| 27 | store volatile i8* null, i8** %alloca1 |
| 28 | %bc1 = bitcast i8** %alloca1 to i8* |
| 29 | call void @llvm.lifetime.end(i64 4, i8* nonnull %bc1) |
| 30 | %bc2 = bitcast i8** %alloca2 to i8* |
| 31 | call void @llvm.lifetime.start(i64 4, i8* %bc2) |
| 32 | store volatile i8* null, i8** %alloca1 |
| 33 | unreachable |
| 34 | |
| 35 | ; CHECK-LABEL: "?catch$2@?0?test1@4HA" |
David Majnemer | 1ef6540 | 2016-03-03 00:01:25 +0000 | [diff] [blame] | 36 | ; CHECK: movq $0, -8(%rbp) |
| 37 | ; CHECK: movq $0, -8(%rbp) |
David Majnemer | 086fec2 | 2016-01-08 08:03:55 +0000 | [diff] [blame] | 38 | ; CHECK: ud2 |
| 39 | |
| 40 | unreachable: ; preds = %entry |
| 41 | unreachable |
| 42 | } |
| 43 | |
| 44 | ; CHECK-LABEL: $cppxdata$test1: |
David Majnemer | 1ef6540 | 2016-03-03 00:01:25 +0000 | [diff] [blame] | 45 | ; CHECK: .long 56 # CatchObjOffset |
David Majnemer | 086fec2 | 2016-01-08 08:03:55 +0000 | [diff] [blame] | 46 | |
David Majnemer | 2a6368f | 2016-01-08 17:24:47 +0000 | [diff] [blame] | 47 | define void @test2() personality i32 (...)* @__CxxFrameHandler3 { |
| 48 | entry: |
| 49 | %alloca2 = alloca i8*, align 4 |
| 50 | %alloca1 = alloca i8*, align 4 |
| 51 | store volatile i8* null, i8** %alloca1 |
| 52 | invoke void @throw() |
| 53 | to label %unreachable unwind label %catch.dispatch |
| 54 | |
| 55 | ; CHECK-LABEL: test2: |
| 56 | ; CHECK: movq $0, -16(%rbp) |
| 57 | ; CHECK: callq throw |
| 58 | |
| 59 | catch.dispatch: ; preds = %entry |
| 60 | %cs = catchswitch within none [label %catch.pad] unwind to caller |
| 61 | |
| 62 | catch.pad: ; preds = %catch.dispatch |
| 63 | %cp = catchpad within %cs [i8* null, i32 0, i8** null] |
| 64 | store volatile i8* null, i8** %alloca1 |
| 65 | %bc1 = bitcast i8** %alloca1 to i8* |
| 66 | call void @llvm.lifetime.end(i64 4, i8* nonnull %bc1) |
| 67 | %bc2 = bitcast i8** %alloca2 to i8* |
| 68 | call void @llvm.lifetime.start(i64 4, i8* %bc2) |
| 69 | store volatile i8* null, i8** %alloca1 |
| 70 | unreachable |
| 71 | |
| 72 | ; CHECK-LABEL: "?catch$2@?0?test2@4HA" |
| 73 | ; CHECK: movq $0, -16(%rbp) |
| 74 | ; CHECK: movq $0, -16(%rbp) |
| 75 | ; CHECK: ud2 |
| 76 | |
| 77 | unreachable: ; preds = %entry |
| 78 | unreachable |
| 79 | } |
| 80 | |
| 81 | ; CHECK-LABEL: $cppxdata$test2: |
| 82 | ; CHECK: .long 0 # CatchObjOffset |
| 83 | |
| 84 | |
David Majnemer | 086fec2 | 2016-01-08 08:03:55 +0000 | [diff] [blame] | 85 | ; Function Attrs: argmemonly nounwind |
| 86 | declare void @llvm.lifetime.start(i64, i8* nocapture) #0 |
| 87 | |
| 88 | ; Function Attrs: argmemonly nounwind |
| 89 | declare void @llvm.lifetime.end(i64, i8* nocapture) #0 |
| 90 | |
| 91 | attributes #0 = { argmemonly nounwind } |