@@ -190,13 +190,15 @@ SILDebugVariable::createFromAllocation(const AllocationInst *AI) {
190190AllocStackInst::AllocStackInst (SILDebugLocation Loc, SILType elementType,
191191 ArrayRef<SILValue> TypeDependentOperands,
192192 SILFunction &F, Optional<SILDebugVariable> Var,
193- bool hasDynamicLifetime, bool isLexical)
193+ bool hasDynamicLifetime, bool isLexical,
194+ bool wasMoved)
194195 : InstructionBase(Loc, elementType.getAddressType()),
195196 SILDebugVariableSupplement(Var ? Var->DIExpr.getNumElements() : 0,
196197 Var ? Var->Type.hasValue() : false,
197198 Var ? Var->Loc.hasValue() : false,
198199 Var ? Var->Scope != nullptr : false),
199- dynamicLifetime(hasDynamicLifetime), lexical(isLexical) {
200+ dynamicLifetime(hasDynamicLifetime), lexical(isLexical),
201+ wasMoved(wasMoved) {
200202 SILNode::Bits.AllocStackInst .NumOperands =
201203 TypeDependentOperands.size ();
202204 assert (SILNode::Bits.AllocStackInst .NumOperands ==
@@ -221,15 +223,16 @@ AllocStackInst::AllocStackInst(SILDebugLocation Loc, SILType elementType,
221223AllocStackInst *AllocStackInst::create (SILDebugLocation Loc,
222224 SILType elementType, SILFunction &F,
223225 Optional<SILDebugVariable> Var,
224- bool hasDynamicLifetime,
225- bool isLexical ) {
226+ bool hasDynamicLifetime, bool isLexical,
227+ bool wasMoved ) {
226228 SmallVector<SILValue, 8 > TypeDependentOperands;
227229 collectTypeDependentOperands (TypeDependentOperands, F,
228230 elementType.getASTType ());
229231 void *Buffer = allocateDebugVarCarryingInst<AllocStackInst>(
230232 F.getModule (), Var, TypeDependentOperands);
231- return ::new (Buffer) AllocStackInst (Loc, elementType, TypeDependentOperands,
232- F, Var, hasDynamicLifetime, isLexical);
233+ return ::new (Buffer)
234+ AllocStackInst (Loc, elementType, TypeDependentOperands, F, Var,
235+ hasDynamicLifetime, isLexical, wasMoved);
233236}
234237
235238VarDecl *AllocationInst::getDecl () const {
@@ -334,7 +337,8 @@ SILType AllocBoxInst::getAddressType() const {
334337}
335338
336339DebugValueInst::DebugValueInst (SILDebugLocation DebugLoc, SILValue Operand,
337- SILDebugVariable Var, bool poisonRefs)
340+ SILDebugVariable Var, bool poisonRefs,
341+ bool wasMoved)
338342 : UnaryInstructionBase(DebugLoc, Operand),
339343 SILDebugVariableSupplement(Var.DIExpr.getNumElements(),
340344 Var.Type.hasValue(), Var.Loc.hasValue(),
@@ -346,26 +350,31 @@ DebugValueInst::DebugValueInst(SILDebugLocation DebugLoc, SILValue Operand,
346350 if (auto *VD = DebugLoc.getLocation ().getAsASTNode <VarDecl>())
347351 VarInfo.setImplicit (VD->isImplicit () || VarInfo.isImplicit ());
348352 setPoisonRefs (poisonRefs);
353+ if (wasMoved)
354+ markAsMoved ();
349355}
350356
351357DebugValueInst *DebugValueInst::create (SILDebugLocation DebugLoc,
352358 SILValue Operand, SILModule &M,
353- SILDebugVariable Var, bool poisonRefs) {
359+ SILDebugVariable Var, bool poisonRefs,
360+ bool wasMoved) {
354361 void *buf = allocateDebugVarCarryingInst<DebugValueInst>(M, Var);
355- return ::new (buf) DebugValueInst (DebugLoc, Operand, Var, poisonRefs);
362+ return ::new (buf)
363+ DebugValueInst (DebugLoc, Operand, Var, poisonRefs, wasMoved);
356364}
357365
358366DebugValueInst *DebugValueInst::createAddr (SILDebugLocation DebugLoc,
359367 SILValue Operand, SILModule &M,
360- SILDebugVariable Var) {
368+ SILDebugVariable Var,
369+ bool wasMoved) {
361370 // For alloc_stack, debug_value is used to annotate the associated
362371 // memory location, so we shouldn't attach op_deref.
363372 if (!isa<AllocStackInst>(Operand))
364373 Var.DIExpr .prependElements (
365374 {SILDIExprElement::createOperator (SILDIExprOperator::Dereference)});
366375 void *buf = allocateDebugVarCarryingInst<DebugValueInst>(M, Var);
367376 return ::new (buf) DebugValueInst (DebugLoc, Operand, Var,
368- /* poisonRefs=*/ false );
377+ /* poisonRefs=*/ false , wasMoved );
369378}
370379
371380bool DebugValueInst::exprStartsWithDeref () const {
0 commit comments