@@ -655,6 +655,8 @@ class PartitionOp {
655655 return source.get <SILInstruction *>();
656656 }
657657
658+ bool hasSourceInst () const { return source.is <SILInstruction *>(); }
659+
658660 Operand *getSourceOp () const { return source.get <Operand *>(); }
659661
660662 SILLocation getSourceLoc () const { return getSourceInst ()->getLoc (); }
@@ -1095,6 +1097,11 @@ struct PartitionOpEvaluator {
10951097 // / if they need to.
10961098 static SILLocation getLoc (SILInstruction *inst) { return Impl::getLoc (inst); }
10971099
1100+ // / Some evaluators pass in mock operands that one cannot call getLoc()
1101+ // / upon. So to allow for this, provide a routine that our impl can override
1102+ // / if they need to.
1103+ static SILLocation getLoc (Operand *op) { return Impl::getLoc (op); }
1104+
10981105 // / Apply \p op to the partition op.
10991106 void apply (const PartitionOp &op) const {
11001107 if (shouldEmitVerboseLogging ()) {
@@ -1113,7 +1120,9 @@ struct PartitionOpEvaluator {
11131120
11141121 // Set the boundary so that as we push, this shows when to stop processing
11151122 // for this PartitionOp.
1116- p.pushHistorySequenceBoundary (getLoc (op.getSourceInst ()));
1123+ SILLocation loc = op.hasSourceInst () ? getLoc (op.getSourceInst ())
1124+ : getLoc (op.getSourceOp ());
1125+ p.pushHistorySequenceBoundary (loc);
11171126
11181127 switch (op.getKind ()) {
11191128 case PartitionOpKind::Assign:
@@ -1356,6 +1365,7 @@ struct PartitionOpEvaluatorBaseImpl : PartitionOpEvaluator<Subclass> {
13561365 bool shouldTryToSquelchErrors () const { return true ; }
13571366
13581367 static SILLocation getLoc (SILInstruction *inst) { return inst->getLoc (); }
1368+ static SILLocation getLoc (Operand *op) { return op->getUser ()->getLoc (); }
13591369};
13601370
13611371// / A subclass of PartitionOpEvaluatorBaseImpl that doesn't have any special
0 commit comments