1
Fork 0

mir-opt: Do not handle the cleanup BB in the EarlyOtherwiseBranch

This commit is contained in:
DianQK 2024-11-27 06:40:02 +08:00
parent 93aea1d0fe
commit d08738c397
No known key found for this signature in database
4 changed files with 53 additions and 86 deletions

View file

@ -244,6 +244,10 @@ fn evaluate_candidate<'tcx>(
parent: BasicBlock,
) -> Option<OptimizationData<'tcx>> {
let bbs = &body.basic_blocks;
// NB: If this BB is a cleanup, we may need to figure out what else needs to be handled.
if bbs[parent].is_cleanup {
return None;
}
let TerminatorKind::SwitchInt { targets, discr: parent_discr } = &bbs[parent].terminator().kind
else {
return None;