@@ -489,17 +489,18 @@ bool PrunedLiveRange<LivenessWithDefs>::isWithinBoundary(
489
489
llvm_unreachable (" instruction must be in its parent block" );
490
490
}
491
491
492
+ static bool checkDeadEnd (SILInstruction *inst, DeadEndBlocks *deadEndBlocks) {
493
+ return deadEndBlocks && deadEndBlocks->isDeadEnd (inst->getParent ());
494
+ }
495
+
492
496
template <typename LivenessWithDefs>
493
497
bool PrunedLiveRange<LivenessWithDefs>::areUsesWithinBoundary(
494
498
ArrayRef<Operand *> uses, DeadEndBlocks *deadEndBlocks) const {
495
499
assert (asImpl ().isInitialized ());
496
500
497
- auto checkDeadEnd = [deadEndBlocks](SILInstruction *inst) {
498
- return deadEndBlocks && deadEndBlocks->isDeadEnd (inst->getParent ());
499
- };
500
501
for (auto *use : uses) {
501
502
auto *user = use->getUser ();
502
- if (!asImpl ().isWithinBoundary (user) && !checkDeadEnd (user))
503
+ if (!asImpl ().isWithinBoundary (user) && !checkDeadEnd (user, deadEndBlocks ))
503
504
return false ;
504
505
}
505
506
return true ;
@@ -510,12 +511,9 @@ bool PrunedLiveRange<LivenessWithDefs>::areUsesOutsideBoundary(
510
511
ArrayRef<Operand *> uses, DeadEndBlocks *deadEndBlocks) const {
511
512
assert (asImpl ().isInitialized ());
512
513
513
- auto checkDeadEnd = [deadEndBlocks](SILInstruction *inst) {
514
- return deadEndBlocks && deadEndBlocks->isDeadEnd (inst->getParent ());
515
- };
516
514
for (auto *use : uses) {
517
515
auto *user = use->getUser ();
518
- if (asImpl ().isWithinBoundary (user) || checkDeadEnd (user))
516
+ if (asImpl ().isWithinBoundary (user) || checkDeadEnd (user, deadEndBlocks ))
519
517
return false ;
520
518
}
521
519
return true ;
0 commit comments