Skip to content

Commit

Permalink
Add comment to reverse_postorder function
Browse files Browse the repository at this point in the history
  • Loading branch information
celinval committed Mar 8, 2024
1 parent 598e81b commit a1435a9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kani-compiler/src/codegen_cprover_gotoc/codegen/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ impl<'tcx> GotocCtx<'tcx> {
}
}

/// Iterate over the basic blocks in reverse post-order.
///
/// The `reverse_postorder` function used before was internal to the compiler and reflected the
/// internal body representation.
///
/// As we introduce transformations on the top of SMIR body, there will be not guarantee of a
/// 1:1 relationship between basic blocks from internal body and monomorphic body from StableMIR.
pub fn reverse_postorder(body: &Body) -> impl Iterator<Item = BasicBlockIdx> {
postorder(body, 0, &mut HashSet::with_capacity(body.blocks.len())).into_iter().rev()
}
Expand Down

0 comments on commit a1435a9

Please sign in to comment.