From c55d3f1ba1e78466d2f5703a9e291f4849ddcc94 Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Sat, 27 Jun 2015 14:39:22 -0700 Subject: [PATCH] rt: Move personality to functions from their landing pads This is for llvm/cc714e214298cfbf11de65b46de31900d51422cf --- src/rt/rust_try.ll | 17 ++++++++++------- src/rt/rust_try_msvc_64.ll | 8 +++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/rt/rust_try.ll b/src/rt/rust_try.ll index 845fc097cdc7..8643131d0fb7 100644 --- a/src/rt/rust_try.ll +++ b/src/rt/rust_try.ll @@ -14,7 +14,9 @@ ; See also: libstd/rt/unwind/mod.rs -define i8* @rust_try(void (i8*)* %f, i8* %env) { +define i8* @rust_try(void (i8*)* %f, i8* %env) + personality i8* bitcast (i32 (...)* @rust_eh_personality_catch to i8*) +{ %1 = invoke i8* @rust_try_inner(void (i8*)* %f, i8* %env) to label %normal @@ -24,13 +26,15 @@ normal: ret i8* %1 catch: - landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @rust_eh_personality_catch to i8*) - catch i8* null - ; rust_try_inner's landing pad does not resume unwinds, so execution will never reach here + landingpad { i8*, i32 } catch i8* null + ; rust_try_inner's landing pad does not resume unwinds, so execution will + ; never reach here ret i8* null } -define internal i8* @rust_try_inner(void (i8*)* %f, i8* %env) { +define internal i8* @rust_try_inner(void (i8*)* %f, i8* %env) + personality i8* bitcast (i32 (...)* @rust_eh_personality to i8*) +{ invoke void %f(i8* %env) to label %normal @@ -40,8 +44,7 @@ normal: ret i8* null catch: - %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @rust_eh_personality to i8*) - catch i8* null + %1 = landingpad { i8*, i32 } catch i8* null ; extract and return pointer to the exception object %2 = extractvalue { i8*, i32 } %1, 0 ret i8* %2 diff --git a/src/rt/rust_try_msvc_64.ll b/src/rt/rust_try_msvc_64.ll index bda136d84780..c38e6081bf2d 100644 --- a/src/rt/rust_try_msvc_64.ll +++ b/src/rt/rust_try_msvc_64.ll @@ -21,7 +21,9 @@ ; ; See also: src/libstd/rt/unwind/seh.rs -define i8* @rust_try(void (i8*)* %f, i8* %env) { +define i8* @rust_try(void (i8*)* %f, i8* %env) + personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +{ invoke void %f(i8* %env) to label %normal unwind label %catch @@ -58,8 +60,8 @@ normal: ; but apparently LLVM chokes on this, so we do the more complicated thing to ; placate it. catch: - %vals = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) - catch i8* bitcast (i32 (i8*, i8*)* @__rust_try_filter to i8*) + %vals = landingpad { i8*, i32 } + catch i8* bitcast (i32 (i8*, i8*)* @__rust_try_filter to i8*) %ehptr = extractvalue { i8*, i32 } %vals, 0 %sel = extractvalue { i8*, i32 } %vals, 1 %filter_sel = call i32 @llvm.eh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @__rust_try_filter to i8*))