Skip to content

Commit a0a7173

Browse files
committed
Do not thread through Assert terminator.
1 parent 6ab44fb commit a0a7173

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
@@ -518,11 +518,6 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> {
518518
cost: &CostChecker<'_, 'tcx>,
519519
depth: usize,
520520
) {
521-
let register_opportunity = |c: Condition| {
522-
debug!(?bb, ?c.target, "register");
523-
self.opportunities.push(ThreadingOpportunity { chain: vec![bb], target: c.target })
524-
};
525-
526521
let term = self.body.basic_blocks[bb].terminator();
527522
let place_to_flood = match term.kind {
528523
// We come from a target, so those are not possible.
@@ -544,16 +539,8 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> {
544539
// Flood the overwritten place, and progress through.
545540
TerminatorKind::Drop { place: destination, .. }
546541
| TerminatorKind::Call { destination, .. } => Some(destination),
547-
// Treat as an `assume(cond == expected)`.
548-
TerminatorKind::Assert { ref cond, expected, .. } => {
549-
if let Some(place) = cond.place()
550-
&& let Some(conditions) = state.try_get(place.as_ref(), self.map)
551-
{
552-
let expected = if expected { ScalarInt::TRUE } else { ScalarInt::FALSE };
553-
conditions.iter_matches(expected).for_each(register_opportunity);
554-
}
555-
None
556-
}
542+
// Ignore, as this can be a no-op at codegen time.
543+
TerminatorKind::Assert { .. } => None,
557544
};
558545

559546
// We can recurse through this terminator.

0 commit comments

Comments
 (0)