2016-01-08 16:03:55 +08:00
|
|
|
; RUN: llc < %s | FileCheck %s
|
|
|
|
|
|
|
|
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
|
|
|
|
target triple = "x86_64-pc-windows-msvc"
|
|
|
|
|
|
|
|
declare void @throw()
|
|
|
|
|
|
|
|
declare i32 @__CxxFrameHandler3(...)
|
|
|
|
|
|
|
|
define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
|
|
|
|
entry:
|
|
|
|
%alloca2 = alloca i8*, align 4
|
|
|
|
%alloca1 = alloca i8*, align 4
|
|
|
|
store volatile i8* null, i8** %alloca1
|
|
|
|
invoke void @throw()
|
|
|
|
to label %unreachable unwind label %catch.dispatch
|
|
|
|
|
|
|
|
; CHECK-LABEL: test1:
|
2016-03-03 08:01:25 +08:00
|
|
|
; CHECK: movq $0, -8(%rbp)
|
2016-01-08 16:03:55 +08:00
|
|
|
; CHECK: callq throw
|
|
|
|
|
|
|
|
catch.dispatch: ; preds = %entry
|
|
|
|
%cs = catchswitch within none [label %catch.pad] unwind to caller
|
|
|
|
|
|
|
|
catch.pad: ; preds = %catch.dispatch
|
|
|
|
%cp = catchpad within %cs [i8* null, i32 0, i8** %alloca1]
|
|
|
|
store volatile i8* null, i8** %alloca1
|
|
|
|
%bc1 = bitcast i8** %alloca1 to i8*
|
2017-04-11 04:18:21 +08:00
|
|
|
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %bc1)
|
2016-01-08 16:03:55 +08:00
|
|
|
%bc2 = bitcast i8** %alloca2 to i8*
|
2017-04-11 04:18:21 +08:00
|
|
|
call void @llvm.lifetime.start.p0i8(i64 4, i8* %bc2)
|
2016-01-08 16:03:55 +08:00
|
|
|
store volatile i8* null, i8** %alloca1
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
; CHECK-LABEL: "?catch$2@?0?test1@4HA"
|
2016-03-03 08:01:25 +08:00
|
|
|
; CHECK: movq $0, -8(%rbp)
|
|
|
|
; CHECK: movq $0, -8(%rbp)
|
2016-01-08 16:03:55 +08:00
|
|
|
; CHECK: ud2
|
|
|
|
|
|
|
|
unreachable: ; preds = %entry
|
|
|
|
unreachable
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: $cppxdata$test1:
|
2016-03-03 08:01:25 +08:00
|
|
|
; CHECK: .long 56 # CatchObjOffset
|
2016-01-08 16:03:55 +08:00
|
|
|
|
2016-01-09 01:24:47 +08:00
|
|
|
define void @test2() personality i32 (...)* @__CxxFrameHandler3 {
|
|
|
|
entry:
|
|
|
|
%alloca2 = alloca i8*, align 4
|
|
|
|
%alloca1 = alloca i8*, align 4
|
|
|
|
store volatile i8* null, i8** %alloca1
|
|
|
|
invoke void @throw()
|
|
|
|
to label %unreachable unwind label %catch.dispatch
|
|
|
|
|
|
|
|
; CHECK-LABEL: test2:
|
|
|
|
; CHECK: movq $0, -16(%rbp)
|
|
|
|
; CHECK: callq throw
|
|
|
|
|
|
|
|
catch.dispatch: ; preds = %entry
|
|
|
|
%cs = catchswitch within none [label %catch.pad] unwind to caller
|
|
|
|
|
|
|
|
catch.pad: ; preds = %catch.dispatch
|
|
|
|
%cp = catchpad within %cs [i8* null, i32 0, i8** null]
|
|
|
|
store volatile i8* null, i8** %alloca1
|
|
|
|
%bc1 = bitcast i8** %alloca1 to i8*
|
2017-04-11 04:18:21 +08:00
|
|
|
call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %bc1)
|
2016-01-09 01:24:47 +08:00
|
|
|
%bc2 = bitcast i8** %alloca2 to i8*
|
2017-04-11 04:18:21 +08:00
|
|
|
call void @llvm.lifetime.start.p0i8(i64 4, i8* %bc2)
|
2016-01-09 01:24:47 +08:00
|
|
|
store volatile i8* null, i8** %alloca1
|
|
|
|
unreachable
|
|
|
|
|
|
|
|
; CHECK-LABEL: "?catch$2@?0?test2@4HA"
|
|
|
|
; CHECK: movq $0, -16(%rbp)
|
|
|
|
; CHECK: movq $0, -16(%rbp)
|
|
|
|
; CHECK: ud2
|
|
|
|
|
|
|
|
unreachable: ; preds = %entry
|
|
|
|
unreachable
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: $cppxdata$test2:
|
|
|
|
; CHECK: .long 0 # CatchObjOffset
|
|
|
|
|
|
|
|
|
2016-01-08 16:03:55 +08:00
|
|
|
; Function Attrs: argmemonly nounwind
|
2017-04-11 04:18:21 +08:00
|
|
|
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #0
|
2016-01-08 16:03:55 +08:00
|
|
|
|
|
|
|
; Function Attrs: argmemonly nounwind
|
2017-04-11 04:18:21 +08:00
|
|
|
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #0
|
2016-01-08 16:03:55 +08:00
|
|
|
|
|
|
|
attributes #0 = { argmemonly nounwind }
|