UnwindAction::Terminate edge is also critical edge

This commit is contained in:
Gary Guo 2023-04-06 22:19:22 +01:00
parent 04126398c2
commit 1499a6faad

View File

@ -53,7 +53,8 @@ impl AddCallGuards {
kind: TerminatorKind::Call { target: Some(ref mut destination), unwind, .. },
source_info,
}) if pred_count[*destination] > 1
&& (matches!(unwind, UnwindAction::Cleanup(_)) || self == &AllCallEdges) =>
&& (matches!(unwind, UnwindAction::Cleanup(_) | UnwindAction::Terminate)
|| self == &AllCallEdges) =>
{
// It's a critical edge, break it
let call_guard = BasicBlockData {