@@ -347,6 +347,7 @@ class IterativeBackwardReachability final {
347347 // / void visitBarrierInstruction(SILInstruction *)
348348 // / void visitBarrierPhi(SILBasicBlock *)
349349 // / void visitBarrierBlock(SILBasicBlock *)
350+ // / void visitInitialBlock(SILBasicBlock *)
350351 // / }
351352 template <typename Visitor>
352353 void findBarriers (Visitor &visitor);
@@ -423,6 +424,7 @@ class IterativeBackwardReachability final {
423424 // / void visitBarrierInstruction(SILInstruction *)
424425 // / void visitBarrierPhi(SILBasicBlock *)
425426 // / void visitBarrierBlock(SILBasicBlock *)
427+ // / void visitInitialBlock(SILBasicBlock *)
426428 // / }
427429 template <typename Visitor>
428430 bool findBarrier (SILInstruction *from, SILBasicBlock *block,
@@ -710,6 +712,10 @@ IterativeBackwardReachability<Effects>::meetOverSuccessors(
710712// / /// Additionally, this may be invoked with the effective def block if
711713// / /// no barriers are found between the gens and it.
712714// / void visitBarrierBlock(SILBasicBlock *)
715+ // /
716+ // / /// Invoked with either the function entry block or one of the specified
717+ // / /// initial blocks.
718+ // / void visitInitialBlock(SILBasicBlock *)
713719// / }
714720template <typename Effects>
715721template <typename Visitor>
@@ -765,6 +771,10 @@ void IterativeBackwardReachability<Effects>::findBarriers(Visitor &visitor) {
765771// / /// Additionally, this may be invoked with the effective def block if
766772// / /// no barriers are found between the gens and it.
767773// / void visitBarrierBlock(SILBasicBlock *)
774+ // /
775+ // / /// Invoked with either the function entry block or one of the specified
776+ // / /// initial blocks.
777+ // / void visitInitialBlock(SILBasicBlock *)
768778// / }
769779template <typename Effects>
770780template <typename Visitor>
@@ -793,7 +803,7 @@ bool IterativeBackwardReachability<Effects>::findBarrier(SILInstruction *from,
793803 }
794804 assert (result.getEffectForBlock (block) != Effect::Kill ());
795805 if (stopAtBlock (block)) {
796- visitor.visitBarrierBlock (block);
806+ visitor.visitInitialBlock (block);
797807 return true ;
798808 }
799809 return false ;
@@ -922,6 +932,12 @@ struct ReachableBarriers final {
922932 // / (2) at least one adjacent edge's target is not reachable-at-begin.
923933 llvm::SmallVector<SILBasicBlock *, 4 > edges;
924934
935+ // / Terminal blocks that were reached; blocks such that
936+ // / (1) the block is reachable-at-begin
937+ // / (2) it is either the function's entry block or one of the blocks passed
938+ // / to findBarriersBackward's \p initialBlocks parameter.
939+ llvm::SmallVector<SILBasicBlock *, 2 > initialBlocks;
940+
925941 ReachableBarriers () {}
926942 ReachableBarriers (ReachableBarriers const &) = delete ;
927943 ReachableBarriers &operator =(ReachableBarriers const &) = delete ;
0 commit comments