@@ -489,17 +489,18 @@ bool PrunedLiveRange<LivenessWithDefs>::isWithinBoundary(
489489 llvm_unreachable (" instruction must be in its parent block" );
490490}
491491
492+ static bool checkDeadEnd (SILInstruction *inst, DeadEndBlocks *deadEndBlocks) {
493+ return deadEndBlocks && deadEndBlocks->isDeadEnd (inst->getParent ());
494+ }
495+
492496template <typename LivenessWithDefs>
493497bool PrunedLiveRange<LivenessWithDefs>::areUsesWithinBoundary(
494498 ArrayRef<Operand *> uses, DeadEndBlocks *deadEndBlocks) const {
495499 assert (asImpl ().isInitialized ());
496500
497- auto checkDeadEnd = [deadEndBlocks](SILInstruction *inst) {
498- return deadEndBlocks && deadEndBlocks->isDeadEnd (inst->getParent ());
499- };
500501 for (auto *use : uses) {
501502 auto *user = use->getUser ();
502- if (!asImpl ().isWithinBoundary (user) && !checkDeadEnd (user))
503+ if (!asImpl ().isWithinBoundary (user) && !checkDeadEnd (user, deadEndBlocks ))
503504 return false ;
504505 }
505506 return true ;
@@ -510,12 +511,9 @@ bool PrunedLiveRange<LivenessWithDefs>::areUsesOutsideBoundary(
510511 ArrayRef<Operand *> uses, DeadEndBlocks *deadEndBlocks) const {
511512 assert (asImpl ().isInitialized ());
512513
513- auto checkDeadEnd = [deadEndBlocks](SILInstruction *inst) {
514- return deadEndBlocks && deadEndBlocks->isDeadEnd (inst->getParent ());
515- };
516514 for (auto *use : uses) {
517515 auto *user = use->getUser ();
518- if (asImpl ().isWithinBoundary (user) || checkDeadEnd (user))
516+ if (asImpl ().isWithinBoundary (user) || checkDeadEnd (user, deadEndBlocks ))
519517 return false ;
520518 }
521519 return true ;
0 commit comments