1
Fork 0

Document wf constraints on control flow in cleanup blocks

Also fixes a bug in dominator computation
This commit is contained in:
Jakob Degen 2023-01-08 18:23:13 -08:00
parent 4781233a77
commit f49126e3d6
3 changed files with 68 additions and 6 deletions

View file

@ -512,6 +512,13 @@ pub struct CopyNonOverlapping<'tcx> {
/// must also be `cleanup`. This is a part of the type system and checked statically, so it is
/// still an error to have such an edge in the CFG even if it's known that it won't be taken at
/// runtime.
/// 4. The induced subgraph on cleanup blocks must look roughly like an upside down tree. This is
/// necessary to ensure that landing pad information can be correctly codegened. More precisely:
///
/// Begin with the standard control flow graph `G`. Modify `G` as follows: for any two cleanup
/// vertices `u` and `v` such that `u` dominates `v`, contract `u` and `v` into a single vertex,
/// deleting self edges and duplicate edges in the process. The cleanup blocks of the resulting
/// graph must form an inverted forest.
#[derive(Clone, TyEncodable, TyDecodable, Hash, HashStable, PartialEq, TypeFoldable, TypeVisitable)]
pub enum TerminatorKind<'tcx> {
/// Block has one successor; we continue execution there.