Disable ConstGoto opt in cleanup blocks
This commit is contained in:
parent
e187f8871e
commit
f8aaf9aadb
1 changed files with 9 additions and 0 deletions
|
@ -57,6 +57,15 @@ impl<'tcx> MirPass<'tcx> for ConstGoto {
|
|||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for ConstGotoOptimizationFinder<'_, 'tcx> {
|
||||
fn visit_basic_block_data(&mut self, block: BasicBlock, data: &BasicBlockData<'tcx>) {
|
||||
if data.is_cleanup {
|
||||
// Because of the restrictions around control flow in cleanup blocks, we don't perform
|
||||
// this optimization at all in such blocks.
|
||||
return;
|
||||
}
|
||||
self.super_basic_block_data(block, data);
|
||||
}
|
||||
|
||||
fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) {
|
||||
let _: Option<_> = try {
|
||||
let target = terminator.kind.as_goto()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue