Don't evaluate self.fn_can_unwind(...) if can_unwind is already true

This commit is contained in:
hyd-dev 2021-05-22 19:32:55 +08:00
parent 835405199a
commit e743eeb743
No known key found for this signature in database
GPG Key ID: 74FA7FD5B8DA14B8

View File

@ -306,8 +306,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
check_abi(callee_abi)?;
}
let callee_can_unwind =
self.fn_can_unwind(self.tcx.codegen_fn_attrs(callee_def_id).flags, callee_abi);
let can_unwind = can_unwind
&& self
.fn_can_unwind(self.tcx.codegen_fn_attrs(callee_def_id).flags, callee_abi);
self.push_stack_frame(
instance,
@ -315,7 +316,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
ret.map(|p| p.0),
StackPopCleanup::Goto {
ret: ret.map(|p| p.1),
unwind: if can_unwind && callee_can_unwind {
unwind: if can_unwind {
StackPopUnwind::Cleanup(unwind)
} else {
StackPopUnwind::NotAllowed