[cfg] Add Ownership SIL utility method splitAllCondBrCriticalEdgesWithNonTrivialArgs.

Currently, the ownership verifier assumes that all cond_br with critical edges
do not have non-trivial arguments. This utility method fixes any such issues and
should be run /after/ any passes that mess with the CFG in ownership SIL if this
could come up.

Chopping this off of a larger commit.

rdar://31521023
This commit is contained in:
Michael Gottesman
2017-11-14 10:07:14 -08:00
parent ff9e717a37
commit 1c33bc19c4
2 changed files with 43 additions and 0 deletions

View File

@@ -125,6 +125,16 @@ bool hasCriticalEdges(SILFunction &F, bool OnlyNonCondBr);
bool splitAllCriticalEdges(SILFunction &F, bool OnlyNonCondBr,
DominanceInfo *DT, SILLoopInfo *LI);
/// \brief Split all cond_br critical edges with non-trivial arguments in the
/// function updating the dominator tree and loop information (if they are not
/// set to null).
///
/// A current invariant of Ownership SIL is that cond_br can only have critical
/// edges with non-trivial arguments. This simplifies computation.
bool splitAllCondBrCriticalEdgesWithNonTrivialArgs(SILFunction &F,
DominanceInfo *DT,
SILLoopInfo *LI);
/// \brief Merge a basic block ending in a branch with its successor
/// if possible. If dominance information or loop info is non null update it.
/// Return true if block was merged.