Skip to content

Commit 61bae5b

Browse files
committed
Handle critical edges consistently in all SIL stages.
This will allow passes that optimize phis to be run in the mandatory pipeline. It also simplifies SIL invariants and will unblock much needed simplification of BlockArgument handling.
1 parent 140ee56 commit 61bae5b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lib/SIL/SILVerifier.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4530,29 +4530,26 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
45304530
return true;
45314531
};
45324532

4533-
SILModule &M = F->getModule();
45344533
for (auto &BB : *F) {
45354534
TermInst *TI = BB.getTerminator();
45364535
CurInstruction = TI;
45374536

4538-
// Check for non-cond_br critical edges in canonical SIL.
4539-
if (!isa<CondBranchInst>(TI) && M.getStage() == SILStage::Canonical) {
4537+
// Check for non-cond_br critical edges.
4538+
auto *CBI = dyn_cast<CondBranchInst>(TI);
4539+
if (!CBI) {
45404540
for (unsigned Idx = 0, e = BB.getSuccessors().size(); Idx != e; ++Idx) {
45414541
require(!isCriticalEdgePred(TI, Idx),
45424542
"non cond_br critical edges not allowed");
45434543
}
45444544
continue;
45454545
}
4546-
45474546
// In ownership qualified SIL, ban critical edges from CondBranchInst that
45484547
// have non-trivial arguments.
4548+
//
4549+
// FIXME: it would be far simpler to ban all critical edges in general.
45494550
if (!F->hasQualifiedOwnership())
45504551
continue;
45514552

4552-
auto *CBI = dyn_cast<CondBranchInst>(TI);
4553-
if (!CBI)
4554-
continue;
4555-
45564553
if (isCriticalEdgePred(CBI, CondBranchInst::TrueIdx)) {
45574554
require(
45584555
llvm::all_of(CBI->getTrueArgs(),

0 commit comments

Comments
 (0)