Skip to content

Commit a85877c

Browse files
committed
[NFC] fast-path to skip a requirement scan
1 parent 0895081 commit a85877c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/AST/RequirementMachine/RequirementLowering.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,11 @@ void swift::rewriting::applyInverses(
820820
inverses[canSubject] = state;
821821
}
822822

823+
// Fast-path: if there are no valid inverses, then there are no requirements
824+
// to be removed.
825+
if (inverses.empty())
826+
return;
827+
823828
// Scan the structural requirements and cancel out any inferred requirements
824829
// based on the inverses we saw.
825830
result.erase(llvm::remove_if(result, [&](StructuralRequirement structReq) {

0 commit comments

Comments
 (0)