Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -0,0 +1,12 @@
; RUN: opt < %s -prune-eh -S | not grep nounwind
define weak void @f() {
entry:
ret void
}
define void @g() {
entry:
call void @f()
ret void
}

View File

@@ -0,0 +1,43 @@
; RUN: opt -S -prune-eh < %s | FileCheck %s
declare void @may_throw()
; @callee below may be an optimized form of this function, which can
; throw at runtime (see r265762 for more details):
;
; define linkonce_odr void @callee(i32* %ptr) noinline {
; entry:
; %val0 = load atomic i32, i32* %ptr unordered, align 4
; %val1 = load atomic i32, i32* %ptr unordered, align 4
; %cmp = icmp eq i32 %val0, %val1
; br i1 %cmp, label %left, label %right
; left:
; ret void
; right:
; call void @may_throw()
; ret void
; }
define linkonce_odr void @callee(i32* %ptr) noinline {
ret void
}
define i32 @caller(i32* %ptr) personality i32 3 {
; CHECK-LABEL: @caller(
; CHECK: invoke void @callee(i32* %ptr)
; CHECK-NEXT: to label %normal unwind label %unwind
entry:
invoke void @callee(i32* %ptr)
to label %normal unwind label %unwind
normal:
ret i32 1
unwind:
%res = landingpad { i8*, i32 }
cleanup
ret i32 2
}

View File

@@ -0,0 +1,26 @@
; RUN: opt < %s -prune-eh -S | FileCheck %s
declare void @nounwind() nounwind
define internal void @foo() {
call void @nounwind()
ret void
}
define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
; CHECK-LABEL: @caller(
; CHECK-NOT: invoke
; CHECK: call void @foo() [ "foo"(i32 0, i8 1) ]
invoke void @foo() [ "foo"(i32 0, i8 1) ]
to label %Normal unwind label %Except
Normal: ; preds = %0
ret i32 0
Except: ; preds = %0
landingpad { i8*, i32 }
catch i8* null
ret i32 1
}
declare i32 @__gxx_personality_v0(...)

View File

@@ -0,0 +1,21 @@
; RUN: opt -S -prune-eh < %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @f() #0 {
entry:
call void asm sideeffect "ret\0A\09", "~{dirflag},~{fpsr},~{flags}"()
unreachable
}
define i32 @g() {
entry:
call void @f()
ret i32 42
}
; CHECK-LABEL: define i32 @g()
; CHECK: ret i32 42
attributes #0 = { naked noinline }

View File

@@ -0,0 +1,56 @@
; RUN: opt -prune-eh -S < %s | FileCheck %s
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i386-pc-windows-msvc"
declare void @neverthrows() nounwind
define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
invoke void @neverthrows()
to label %try.cont unwind label %cleanuppad
try.cont:
ret void
cleanuppad:
%cp = cleanuppad within none []
br label %cleanupret
cleanupret:
cleanupret from %cp unwind to caller
}
; CHECK-LABEL: define void @test1(
; CHECK: call void @neverthrows()
; CHECK: %[[cp:.*]] = cleanuppad within none []
; CHECK-NEXT: unreachable
; CHECK: cleanupret from %[[cp]] unwind to caller
define void @test2() personality i32 (...)* @__CxxFrameHandler3 {
invoke void @neverthrows()
to label %try.cont unwind label %catchswitch
try.cont:
ret void
catchswitch:
%cs = catchswitch within none [label %catchpad] unwind to caller
catchpad:
%cp = catchpad within %cs []
unreachable
ret:
ret void
}
; CHECK-LABEL: define void @test2(
; CHECK: call void @neverthrows()
; CHECK: %[[cs:.*]] = catchswitch within none [label
; CHECK: catchpad within %[[cs]] []
; CHECK-NEXT: unreachable
declare i32 @__CxxFrameHandler3(...)

View File

@@ -0,0 +1,25 @@
; RUN: opt < %s -prune-eh -S | not grep invoke
define internal i32 @foo() personality i32 (...)* @__gxx_personality_v0 {
invoke i32 @foo( )
to label %Normal unwind label %Except ; <i32>:1 [#uses=0]
Normal: ; preds = %0
ret i32 12
Except: ; preds = %0
landingpad { i8*, i32 }
catch i8* null
ret i32 123
}
define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
invoke i32 @foo( )
to label %Normal unwind label %Except ; <i32>:1 [#uses=0]
Normal: ; preds = %0
ret i32 0
Except: ; preds = %0
landingpad { i8*, i32 }
catch i8* null
ret i32 1
}
declare i32 @__gxx_personality_v0(...)

View File

@@ -0,0 +1,31 @@
; RUN: opt -S -prune-eh < %s | FileCheck %s
; Don't remove invokes of nounwind functions if the personality handles async
; exceptions. The @div function in this test can fault, even though it can't
; throw a synchronous exception.
define i32 @div(i32 %n, i32 %d) nounwind {
entry:
%div = sdiv i32 %n, %d
ret i32 %div
}
define i32 @main() nounwind personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
entry:
%call = invoke i32 @div(i32 10, i32 0)
to label %__try.cont unwind label %lpad
lpad:
%0 = landingpad { i8*, i32 }
catch i8* null
br label %__try.cont
__try.cont:
%retval.0 = phi i32 [ %call, %entry ], [ 0, %lpad ]
ret i32 %retval.0
}
; CHECK-LABEL: define i32 @main()
; CHECK: invoke i32 @div(i32 10, i32 0)
declare i32 @__C_specific_handler(...)

View File

@@ -0,0 +1,13 @@
; RUN: opt < %s -prune-eh -S | not grep "ret i32"
declare void @noreturn() noreturn
define i32 @caller() {
call void @noreturn( )
ret i32 17
}
define i32 @caller2() {
%T = call i32 @caller( ) ; <i32> [#uses=1]
ret i32 %T
}

View File

@@ -0,0 +1,23 @@
; RUN: opt < %s -prune-eh -S | not grep invoke
declare void @nounwind() nounwind
define internal void @foo() {
call void @nounwind()
ret void
}
define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
invoke void @foo( )
to label %Normal unwind label %Except
Normal: ; preds = %0
ret i32 0
Except: ; preds = %0
landingpad { i8*, i32 }
catch i8* null
ret i32 1
}
declare i32 @__gxx_personality_v0(...)