-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Empty landing pads aren't optimized away on x86_64-pc-windows-gnu #43151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cc @vadimcn |
@vadimcn I wonder if we should codegen |
@alexcrichton: Do you know why those landing pads are empty? Is it because LLVM has optimized everything away, or just because we've created them empty? If the latter, maybe we can avoid creating empty landing pads in the first place? |
@alexcrichton, yes, I suppose we could do what you suggest. Also, looks like it might be possible to override the libcall name: |
@alexcrichton is it still relevant? ; ModuleID = 'foo.3a1fbbbh-cgu.0'
source_filename = "foo.3a1fbbbh-cgu.0"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-gnu"
%A = type {}
%"unwind::libunwind::EXCEPTION_RECORD" = type { [0 x i8] }
%"unwind::libunwind::CONTEXT" = type { [0 x i8] }
%"unwind::libunwind::DISPATCHER_CONTEXT" = type { [0 x i8] }
; <foo::A as core::ops::drop::Drop>::drop
; Function Attrs: norecurse nounwind readnone uwtable
define void @"_ZN48_$LT$foo..A$u20$as$u20$core..ops..drop..Drop$GT$4drop17h095156138f26c8b3E"(%A* nocapture nonnull align 1 %self) unnamed_addr #0 {
start:
ret void
}
; foo::foo
; Function Attrs: uwtable
define void @_ZN3foo3foo17he8a114b84f989db4E() unnamed_addr #1 personality i32 (%"unwind::libunwind::EXCEPTION_RECORD"*, i8*, %"unwind::libunwind::CONTEXT"*, %"unwind::libunwind::DISPATCHER_CONTEXT"*)* @rust_eh_personality {
start:
; call bar::bar
tail call void @_ZN3bar3bar17h6d6497eda9d60abfE()
ret void
}
; Function Attrs: nounwind uwtable
declare i32 @rust_eh_personality(%"unwind::libunwind::EXCEPTION_RECORD"*, i8*, %"unwind::libunwind::CONTEXT"*, %"unwind::libunwind::DISPATCHER_CONTEXT"*) unnamed_addr #2
; bar::bar
; Function Attrs: uwtable
declare void @_ZN3bar3bar17h6d6497eda9d60abfE() unnamed_addr #1
attributes #0 = { norecurse nounwind readnone uwtable "target-cpu"="x86-64" }
attributes #1 = { uwtable "target-cpu"="x86-64" }
attributes #2 = { nounwind uwtable "target-cpu"="x86-64" }
!llvm.module.flags = !{!0}
!0 = !{i32 7, !"PIC Level", i32 2} |
Looks like the need for |
It looks like empty landing pads are not optimized away due to our usage of
rust_eh_unwind_resume
instead of the standard resumption function. For example:yields this IR, notably:
On other targets such as x86_64-unknown-linux-gnu this is optimized away.
The text was updated successfully, but these errors were encountered: