Skip to content

Commit afaac75

Browse files
committed
Do not thread through Assert terminator.
1 parent d7a7be4 commit afaac75

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

compiler/rustc_mir_transform/src/jump_threading.rs

+2-15
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,6 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> {
566566
cost: &CostChecker<'_, 'tcx>,
567567
depth: usize,
568568
) {
569-
let register_opportunity = |c: Condition| {
570-
debug!(?bb, ?c.target, "register");
571-
self.opportunities.push(ThreadingOpportunity { chain: vec![bb], target: c.target })
572-
};
573-
574569
let term = self.body.basic_blocks[bb].terminator();
575570
let place_to_flood = match term.kind {
576571
// We come from a target, so those are not possible.
@@ -592,16 +587,8 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> {
592587
// Flood the overwritten place, and progress through.
593588
TerminatorKind::Drop { place: destination, .. }
594589
| TerminatorKind::Call { destination, .. } => Some(destination),
595-
// Treat as an `assume(cond == expected)`.
596-
TerminatorKind::Assert { ref cond, expected, .. } => {
597-
if let Some(place) = cond.place()
598-
&& let Some(conditions) = state.try_get(place.as_ref(), self.map)
599-
{
600-
let expected = if expected { ScalarInt::TRUE } else { ScalarInt::FALSE };
601-
conditions.iter_matches(expected).for_each(register_opportunity);
602-
}
603-
None
604-
}
590+
// Ignore, as this can be a no-op at codegen time.
591+
TerminatorKind::Assert { .. } => None,
605592
};
606593

607594
// We can recurse through this terminator.

0 commit comments

Comments
 (0)