Add cycle checking to cleanup control flow validation
This commit is contained in:
parent
f49126e3d6
commit
ec3d993410
2 changed files with 54 additions and 22 deletions
|
@ -512,13 +512,16 @@ 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:
|
||||
/// 4. The control flow between cleanup blocks must look like an upside down tree. Roughly
|
||||
/// speaking, this means that control flow that looks like a V is allowed, while control flow
|
||||
/// that looks like a W is not. This is necessary to ensure that landing pad information can be
|
||||
/// correctly codegened on MSVC. 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.
|
||||
/// deleting self edges and duplicate edges in the process. Now remove all vertices from `G`
|
||||
/// that are not cleanup vertices or are not reachable. The resulting graph must be an inverted
|
||||
/// tree, that is each vertex may have at most one successor and there may be no cycles.
|
||||
#[derive(Clone, TyEncodable, TyDecodable, Hash, HashStable, PartialEq, TypeFoldable, TypeVisitable)]
|
||||
pub enum TerminatorKind<'tcx> {
|
||||
/// Block has one successor; we continue execution there.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue