Skip to content

Commit c55d3f1

Browse files
richoalexcrichton
authored andcommitted
rt: Move personality to functions from their landing pads
This is for llvm/cc714e214298cfbf11de65b46de31900d51422cf
1 parent ea317e8 commit c55d3f1

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/rt/rust_try.ll

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414

1515
; See also: libstd/rt/unwind/mod.rs
1616

17-
define i8* @rust_try(void (i8*)* %f, i8* %env) {
17+
define i8* @rust_try(void (i8*)* %f, i8* %env)
18+
personality i8* bitcast (i32 (...)* @rust_eh_personality_catch to i8*)
19+
{
1820

1921
%1 = invoke i8* @rust_try_inner(void (i8*)* %f, i8* %env)
2022
to label %normal
@@ -24,13 +26,15 @@ normal:
2426
ret i8* %1
2527

2628
catch:
27-
landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @rust_eh_personality_catch to i8*)
28-
catch i8* null
29-
; rust_try_inner's landing pad does not resume unwinds, so execution will never reach here
29+
landingpad { i8*, i32 } catch i8* null
30+
; rust_try_inner's landing pad does not resume unwinds, so execution will
31+
; never reach here
3032
ret i8* null
3133
}
3234

33-
define internal i8* @rust_try_inner(void (i8*)* %f, i8* %env) {
35+
define internal i8* @rust_try_inner(void (i8*)* %f, i8* %env)
36+
personality i8* bitcast (i32 (...)* @rust_eh_personality to i8*)
37+
{
3438

3539
invoke void %f(i8* %env)
3640
to label %normal
@@ -40,8 +44,7 @@ normal:
4044
ret i8* null
4145

4246
catch:
43-
%1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @rust_eh_personality to i8*)
44-
catch i8* null
47+
%1 = landingpad { i8*, i32 } catch i8* null
4548
; extract and return pointer to the exception object
4649
%2 = extractvalue { i8*, i32 } %1, 0
4750
ret i8* %2

src/rt/rust_try_msvc_64.ll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
;
2222
; See also: src/libstd/rt/unwind/seh.rs
2323

24-
define i8* @rust_try(void (i8*)* %f, i8* %env) {
24+
define i8* @rust_try(void (i8*)* %f, i8* %env)
25+
personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
26+
{
2527
invoke void %f(i8* %env)
2628
to label %normal
2729
unwind label %catch
@@ -58,8 +60,8 @@ normal:
5860
; but apparently LLVM chokes on this, so we do the more complicated thing to
5961
; placate it.
6062
catch:
61-
%vals = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
62-
catch i8* bitcast (i32 (i8*, i8*)* @__rust_try_filter to i8*)
63+
%vals = landingpad { i8*, i32 }
64+
catch i8* bitcast (i32 (i8*, i8*)* @__rust_try_filter to i8*)
6365
%ehptr = extractvalue { i8*, i32 } %vals, 0
6466
%sel = extractvalue { i8*, i32 } %vals, 1
6567
%filter_sel = call i32 @llvm.eh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @__rust_try_filter to i8*))

0 commit comments

Comments
 (0)