@@ -4315,47 +4315,7 @@ class EndBorrowInst
4315
4315
EndBorrowInst (SILDebugLocation debugLoc, SILValue borrowedValue)
4316
4316
: UnaryInstructionBase(debugLoc, borrowedValue) {}
4317
4317
4318
- public:
4319
- // / Return the value that this end_borrow is ending the borrow of if we are
4320
- // / borrowing a single value.
4321
- SILValue getSingleOriginalValue () const {
4322
- SILValue v = getOperand ();
4323
- if (auto *bbi = dyn_cast<BeginBorrowInst>(v))
4324
- return bbi->getOperand ();
4325
- if (auto *lbi = dyn_cast<LoadBorrowInst>(v))
4326
- return lbi->getOperand ();
4327
- return SILValue ();
4328
- }
4329
4318
4330
- // / Return the set of guaranteed values that have scopes ended by this
4331
- // / end_borrow.
4332
- // /
4333
- // / Discussion: We can only have multiple values associated with an end_borrow
4334
- // / in the case of having Phi arguments with guaranteed inputs. This is
4335
- // / necessary to represent certain conditional operations such as:
4336
- // /
4337
- // / class Klass {
4338
- // / let k1: Klass
4339
- // / let k2: Klass
4340
- // / }
4341
- // /
4342
- // / func useKlass(k: Klass) { ... }
4343
- // / var boolValue : Bool { ... }
4344
- // /
4345
- // / func f(k: Klass) {
4346
- // / useKlass(boolValue ? k.k1 : k.k2)
4347
- // / }
4348
- // /
4349
- // / Today, when we SILGen such code, we copy k.k1 and k.k2 before the Phi when
4350
- // / it could potentially be avoided. So today this just appends
4351
- // / getSingleOriginalValue() to originalValues.
4352
- // /
4353
- // / TODO: Once this changes, this code must be update.
4354
- void getOriginalValues (SmallVectorImpl<SILValue> &originalValues) const {
4355
- SILValue value = getSingleOriginalValue ();
4356
- assert (value && " Guaranteed phi arguments are not supported now" );
4357
- originalValues.emplace_back (value);
4358
- }
4359
4319
};
4360
4320
4361
4321
// / Different kinds of access.
0 commit comments