diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2024-01-20 19:11:59 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2024-01-23 00:00:24 +0000 |
| commit | afaac75ac76cfbc38066d0474f8ca69d92ca184d (patch) | |
| tree | 37e036d14f65e555f49577deb44405ef7c247618 | |
| parent | d7a7be4049672d3a3b5a1a8380fbe843b52775c2 (diff) | |
| download | rust-afaac75ac76cfbc38066d0474f8ca69d92ca184d.tar.gz rust-afaac75ac76cfbc38066d0474f8ca69d92ca184d.zip | |
Do not thread through Assert terminator.
| -rw-r--r-- | compiler/rustc_mir_transform/src/jump_threading.rs | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/compiler/rustc_mir_transform/src/jump_threading.rs b/compiler/rustc_mir_transform/src/jump_threading.rs index e87f68a0905..7a70ed5cb7f 100644 --- a/compiler/rustc_mir_transform/src/jump_threading.rs +++ b/compiler/rustc_mir_transform/src/jump_threading.rs @@ -566,11 +566,6 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> { cost: &CostChecker<'_, 'tcx>, depth: usize, ) { - let register_opportunity = |c: Condition| { - debug!(?bb, ?c.target, "register"); - self.opportunities.push(ThreadingOpportunity { chain: vec![bb], target: c.target }) - }; - let term = self.body.basic_blocks[bb].terminator(); let place_to_flood = match term.kind { // We come from a target, so those are not possible. @@ -592,16 +587,8 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> { // Flood the overwritten place, and progress through. TerminatorKind::Drop { place: destination, .. } | TerminatorKind::Call { destination, .. } => Some(destination), - // Treat as an `assume(cond == expected)`. - TerminatorKind::Assert { ref cond, expected, .. } => { - if let Some(place) = cond.place() - && let Some(conditions) = state.try_get(place.as_ref(), self.map) - { - let expected = if expected { ScalarInt::TRUE } else { ScalarInt::FALSE }; - conditions.iter_matches(expected).for_each(register_opportunity); - } - None - } + // Ignore, as this can be a no-op at codegen time. + TerminatorKind::Assert { .. } => None, }; // We can recurse through this terminator. |
