diff --git a/include/swift/SIL/DebugUtils.h b/include/swift/SIL/DebugUtils.h index de15bb0509416..ebe5fc7f015a5 100644 --- a/include/swift/SIL/DebugUtils.h +++ b/include/swift/SIL/DebugUtils.h @@ -11,7 +11,7 @@ //===----------------------------------------------------------------------===// // // This file contains utilities to work with debug-info related instructions: -// debug_value and debug_value_addr. +// debug_value, alloc_stack, and alloc_box. // // SIL optimizations should deal with debug-info related instructions when // looking at the uses of a value. @@ -228,7 +228,6 @@ struct DebugVarCarryingInst { enum class Kind { Invalid = 0, DebugValue, - DebugValueAddr, AllocStack, AllocBox, }; @@ -239,8 +238,6 @@ struct DebugVarCarryingInst { DebugVarCarryingInst() : kind(Kind::Invalid), inst(nullptr) {} DebugVarCarryingInst(DebugValueInst *dvi) : kind(Kind::DebugValue), inst(dvi) {} - DebugVarCarryingInst(DebugValueAddrInst *dvai) - : kind(Kind::DebugValueAddr), inst(dvai) {} DebugVarCarryingInst(AllocStackInst *asi) : kind(Kind::AllocStack), inst(asi) {} DebugVarCarryingInst(AllocBoxInst *abi) : kind(Kind::AllocBox), inst(abi) {} @@ -252,9 +249,6 @@ struct DebugVarCarryingInst { case SILInstructionKind::DebugValueInst: kind = Kind::DebugValue; break; - case SILInstructionKind::DebugValueAddrInst: - kind = Kind::DebugValueAddr; - break; case SILInstructionKind::AllocStackInst: kind = Kind::AllocStack; break; @@ -283,8 +277,6 @@ struct DebugVarCarryingInst { llvm_unreachable("Invalid?!"); case Kind::DebugValue: return cast(inst)->getDecl(); - case Kind::DebugValueAddr: - return cast(inst)->getDecl(); case Kind::AllocStack: return cast(inst)->getDecl(); case Kind::AllocBox: @@ -299,8 +291,6 @@ struct DebugVarCarryingInst { llvm_unreachable("Invalid?!"); case Kind::DebugValue: return cast(inst)->getVarInfo(); - case Kind::DebugValueAddr: - return cast(inst)->getVarInfo(); case Kind::AllocStack: return cast(inst)->getVarInfo(); case Kind::AllocBox: @@ -316,9 +306,6 @@ struct DebugVarCarryingInst { case Kind::DebugValue: cast(inst)->setDebugVarScope(NewDS); break; - case Kind::DebugValueAddr: - cast(inst)->setDebugVarScope(NewDS); - break; case Kind::AllocStack: cast(inst)->setDebugVarScope(NewDS); break; diff --git a/include/swift/SIL/Projection.h b/include/swift/SIL/Projection.h index d80b253cef181..c0d57a0c0aece 100644 --- a/include/swift/SIL/Projection.h +++ b/include/swift/SIL/Projection.h @@ -859,7 +859,7 @@ class ProjectionTree { ProjectionTree &operator=(ProjectionTree &&) = default; /// Compute liveness and use information in this projection tree using Base. - /// All debug instructions (debug_value, debug_value_addr) are ignored. + /// All debug_value instructions are ignored. void computeUsesAndLiveness(SILValue Base); /// Create a root SILValue iout of the given leaf node values by walking on diff --git a/include/swift/SIL/SILBuilder.h b/include/swift/SIL/SILBuilder.h index b1421f1264720..42c4bba51d8e8 100644 --- a/include/swift/SIL/SILBuilder.h +++ b/include/swift/SIL/SILBuilder.h @@ -927,10 +927,10 @@ class SILBuilder { DebugValueInst *createDebugValue(SILLocation Loc, SILValue src, SILDebugVariable Var, bool poisonRefs = false); - DebugValueAddrInst *createDebugValueAddr(SILLocation Loc, SILValue src, - SILDebugVariable Var); + DebugValueInst *createDebugValueAddr(SILLocation Loc, SILValue src, + SILDebugVariable Var); - /// Create a debug_value_addr if \p src is an address; a debug_value if not. + /// Create a debug_value according to the type of \p src SILInstruction *emitDebugDescription(SILLocation Loc, SILValue src, SILDebugVariable Var) { if (src->getType().isAddress()) diff --git a/include/swift/SIL/SILCloner.h b/include/swift/SIL/SILCloner.h index 858bcff7964ee..0c2779898b47b 100644 --- a/include/swift/SIL/SILCloner.h +++ b/include/swift/SIL/SILCloner.h @@ -1254,24 +1254,6 @@ SILCloner::visitDebugValueInst(DebugValueInst *Inst) { remapDebugVarInfo(DebugVarCarryingInst(NewInst)); recordClonedInstruction(Inst, NewInst); } -template -void -SILCloner::visitDebugValueAddrInst(DebugValueAddrInst *Inst) { - // We cannot inline/clone debug intrinsics without a scope. If they - // describe function arguments there is no way to determine which - // function they belong to. - if (!Inst->getDebugScope()) - return; - - // Do not remap the location for a debug Instruction. - SILDebugVariable VarInfo = *Inst->getVarInfo(); - SILValue OpValue = getOpValue(Inst->getOperand()); - getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope())); - auto *NewInst = getBuilder().createDebugValueAddr(Inst->getLoc(), OpValue, - *Inst->getVarInfo()); - remapDebugVarInfo(DebugVarCarryingInst(NewInst)); - recordClonedInstruction(Inst, NewInst); -} #define NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, name, ...) \ template \ diff --git a/include/swift/SIL/SILDebugInfoExpression.h b/include/swift/SIL/SILDebugInfoExpression.h index ecc6f7917d53d..c5d9b42f24912 100644 --- a/include/swift/SIL/SILDebugInfoExpression.h +++ b/include/swift/SIL/SILDebugInfoExpression.h @@ -162,6 +162,15 @@ class SILDebugInfoExpression { appendElements(Tail.Elements); } + void prependElements(llvm::ArrayRef NewElements) { + Elements.insert(Elements.begin(), + NewElements.begin(), NewElements.end()); + } + + void eraseElement(const_iterator It) { + Elements.erase(It); + } + /// The iterator for SILDIExprOperand class op_iterator { friend class SILDebugInfoExpression; diff --git a/include/swift/SIL/SILInstruction.h b/include/swift/SIL/SILInstruction.h index 9738363bb2e74..57991dc768e79 100644 --- a/include/swift/SIL/SILInstruction.h +++ b/include/swift/SIL/SILInstruction.h @@ -734,8 +734,7 @@ class SILInstruction : public llvm::ilist_node { /// Returns true if the instruction is only relevant for debug /// informations and has no other impact on program semantics. bool isDebugInstruction() const { - return getKind() == SILInstructionKind::DebugValueInst || - getKind() == SILInstructionKind::DebugValueAddrInst; + return getKind() == SILInstructionKind::DebugValueInst; } /// Returns true if the instruction is a meta instruction which is @@ -1720,8 +1719,8 @@ class UnaryInstructionWithTypeDependentOperandsBase }; /// Holds common debug information about local variables and function -/// arguments that are needed by DebugValueInst, DebugValueAddrInst, -/// AllocStackInst, and AllocBoxInst. +/// arguments that are needed by DebugValueInst, AllocStackInst, +/// and AllocBoxInst. struct SILDebugVariable { StringRef Name; unsigned ArgNo : 16; @@ -4672,6 +4671,8 @@ class DebugValueInst final static DebugValueInst *create(SILDebugLocation DebugLoc, SILValue Operand, SILModule &M, SILDebugVariable Var, bool poisonRefs); + static DebugValueInst *createAddr(SILDebugLocation DebugLoc, SILValue Operand, + SILModule &M, SILDebugVariable Var); SIL_DEBUG_VAR_SUPPLEMENT_TRAILING_OBJS_IMPL() @@ -4706,6 +4707,23 @@ class DebugValueInst final *getTrailingObjects() = NewDS; } + /// Whether the SSA value associated with the current debug_value + /// instruction has an address type. + bool hasAddrVal() const { + return getOperand()->getType().isAddress(); + } + + /// An utility to check if \p I is DebugValueInst and + /// whether it's associated with address type SSA value. + static DebugValueInst *hasAddrVal(SILInstruction *I) { + auto *DVI = dyn_cast_or_null(I); + return DVI && DVI->hasAddrVal()? DVI : nullptr; + } + + /// Whether the attached di-expression (if there is any) starts + /// with `op_deref`. + bool exprStartsWithDeref() const; + /// True if all references within this debug value will be overwritten with a /// poison sentinel at this point in the program. This is used in debug builds /// when shortening non-trivial value lifetimes to ensure the debugger cannot @@ -4722,58 +4740,6 @@ class DebugValueInst final } }; -/// Define the start or update to a symbolic variable value (for address-only -/// types) . -class DebugValueAddrInst final - : public UnaryInstructionBase, - private SILDebugVariableSupplement, - private llvm::TrailingObjects { - friend TrailingObjects; - friend SILBuilder; - - TailAllocatedDebugVariable VarInfo; - - DebugValueAddrInst(SILDebugLocation DebugLoc, SILValue Operand, - SILDebugVariable Var); - static DebugValueAddrInst *create(SILDebugLocation DebugLoc, - SILValue Operand, SILModule &M, - SILDebugVariable Var); - - SIL_DEBUG_VAR_SUPPLEMENT_TRAILING_OBJS_IMPL() - -public: - /// Return the underlying variable declaration that this denotes, - /// or null if we don't have one. - VarDecl *getDecl() const; - /// Return the debug variable information attached to this instruction. - Optional getVarInfo() const { - Optional AuxVarType; - Optional VarDeclLoc; - const SILDebugScope *VarDeclScope = nullptr; - if (HasAuxDebugVariableType) - AuxVarType = *getTrailingObjects(); - - if (hasAuxDebugLocation()) - VarDeclLoc = *getTrailingObjects(); - if (hasAuxDebugScope()) - VarDeclScope = *getTrailingObjects(); - - llvm::ArrayRef DIExprElements( - getTrailingObjects(), NumDIExprOperands); - - return VarInfo.get(getDecl(), getTrailingObjects(), AuxVarType, - VarDeclLoc, VarDeclScope, DIExprElements); - } - - void setDebugVarScope(const SILDebugScope *NewDS) { - if (hasAuxDebugScope()) - *getTrailingObjects() = NewDS; - } -}; - /// An abstract class representing a load from some kind of reference storage. template class LoadReferenceInstBase diff --git a/include/swift/SIL/SILNodes.def b/include/swift/SIL/SILNodes.def index 297ed151c7ec8..7faf5b34d1888 100644 --- a/include/swift/SIL/SILNodes.def +++ b/include/swift/SIL/SILNodes.def @@ -875,8 +875,6 @@ NON_VALUE_INST(MarkFunctionEscapeInst, mark_function_escape, SILInstruction, None, DoesNotRelease) BRIDGED_NON_VALUE_INST(DebugValueInst, debug_value, SILInstruction, None, DoesNotRelease) -BRIDGED_NON_VALUE_INST(DebugValueAddrInst, debug_value_addr, - SILInstruction, None, DoesNotRelease) #define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, name, ...) \ NON_VALUE_INST(Store##Name##Inst, store_##name, \ SILInstruction, MayWrite, DoesNotRelease) diff --git a/include/swift/SILOptimizer/Utils/CanonicalOSSALifetime.h b/include/swift/SILOptimizer/Utils/CanonicalOSSALifetime.h index 5191e7bbda42a..ff283bc349d36 100644 --- a/include/swift/SILOptimizer/Utils/CanonicalOSSALifetime.h +++ b/include/swift/SILOptimizer/Utils/CanonicalOSSALifetime.h @@ -27,14 +27,14 @@ /// bb0(%arg : @owned $T, %addr : @trivial $*T): /// %copy = copy_value %arg : $T /// store %copy to [init] %addr : $*T -/// debug_value_addr %addr : $*T +/// debug_value %addr : $*T, expr op_deref /// destroy_value %arg : $T /// /// Will be transformed to: /// /// bb0(%arg : @owned $T, %addr : @trivial $*T): /// store %copy to [init] %addr : $*T -/// debug_value_addr %addr : $*T +/// debug_value %addr : $*T, expr op_deref /// /// Example #2: Destroys are hoisted to the last use. Copies are inserted only /// at consumes within the lifetime (to directly satisfy ownership conventions): @@ -43,7 +43,7 @@ /// %copy1 = copy_value %arg : $T /// store %arg to [init] %addr : $*T /// %_ = apply %_(%copy1) : $@convention(thin) (@guaranteed T) -> () -/// debug_value_addr %addr : $*T +/// debug_value %addr : $*T, expr op_deref /// destroy_value %copy1 : $T /// /// Will be transformed to: @@ -53,7 +53,7 @@ /// store %copy1 to [init] %addr : $*T /// %_ = apply %_(%arg) : $@convention(thin) (@guaranteed T) -> () /// destroy_value %arg : $T -/// debug_value_addr %addr : $*T +/// debug_value %addr : $*T, expr op_deref /// /// Example #3: Handle control flow. /// diff --git a/include/swift/SILOptimizer/Utils/DebugOptUtils.h b/include/swift/SILOptimizer/Utils/DebugOptUtils.h index 43a9b68e65dd9..181150a1ac248 100644 --- a/include/swift/SILOptimizer/Utils/DebugOptUtils.h +++ b/include/swift/SILOptimizer/Utils/DebugOptUtils.h @@ -44,8 +44,7 @@ inline void deleteAllDebugUses(SILInstruction *inst, } /// Transfer debug info associated with (the result of) \p I to a -/// new `debug_value` or `debug_value_addr` instruction before \p I is -/// deleted. +/// new `debug_value` instruction before \p I is deleted. void salvageDebugInfo(SILInstruction *I); /// Erases the instruction \p I from it's parent block and deletes it, including diff --git a/lib/IRGen/IRGenDebugInfo.cpp b/lib/IRGen/IRGenDebugInfo.cpp index 6e36a6a0ce02c..e7e6157a286d9 100644 --- a/lib/IRGen/IRGenDebugInfo.cpp +++ b/lib/IRGen/IRGenDebugInfo.cpp @@ -2410,6 +2410,9 @@ bool IRGenDebugInfoImpl::buildDebugInfoExpression( if (!handleFragmentDIExpr(ExprOperand, Operands)) return false; break; + case SILDIExprOperator::Dereference: + Operands.push_back(llvm::dwarf::DW_OP_deref); + break; default: llvm_unreachable("Unrecognized operator"); } diff --git a/lib/IRGen/IRGenSIL.cpp b/lib/IRGen/IRGenSIL.cpp index c7ad88de3d2a1..925e4d95b5422 100644 --- a/lib/IRGen/IRGenSIL.cpp +++ b/lib/IRGen/IRGenSIL.cpp @@ -1146,7 +1146,6 @@ class IRGenSILFunction : llvm_unreachable("unimplemented"); } void visitDebugValueInst(DebugValueInst *i); - void visitDebugValueAddrInst(DebugValueAddrInst *i); void visitRetainValueInst(RetainValueInst *i); void visitRetainValueAddrInst(RetainValueAddrInst *i); void visitCopyValueInst(CopyValueInst *i); @@ -1637,7 +1636,7 @@ void LoweredValue::getExplosion(IRGenFunction &IGF, SILType type, case Kind::DynamicallyEnforcedAddress: case Kind::CoroutineState: llvm_unreachable("not a value"); - + case Kind::ExplosionVector: ex.add(Storage.get(kind)); return; @@ -4713,7 +4712,11 @@ static bool InCoroContext(SILFunction &f, SILInstruction &i) { } void IRGenSILFunction::visitDebugValueInst(DebugValueInst *i) { + auto SILVal = i->getOperand(); + bool IsAddrVal = SILVal->getType().isAddress(); if (i->poisonRefs()) { + assert(!IsAddrVal && + "SIL values with address type should not have poison"); emitPoisonDebugValueInst(i); return; } @@ -4722,16 +4725,17 @@ void IRGenSILFunction::visitDebugValueInst(DebugValueInst *i) { auto VarInfo = i->getVarInfo(); assert(VarInfo && "debug_value without debug info"); - auto SILVal = i->getOperand(); if (isa(SILVal)) { // We cannot track the location of inlined error arguments because it has no // representation in SIL. - if (!i->getDebugScope()->InlinedCallSite && VarInfo->Name == "$error") { + if (!IsAddrVal && + !i->getDebugScope()->InlinedCallSite && VarInfo->Name == "$error") { auto funcTy = CurSILFn->getLoweredFunctionType(); emitErrorResultVar(funcTy, funcTy->getErrorResult(), i); } return; } + bool IsInCoro = InCoroContext(*CurSILFn, *i); bool IsAnonymous = false; VarInfo->Name = getVarName(i, IsAnonymous); @@ -4742,87 +4746,49 @@ void IRGenSILFunction::visitDebugValueInst(DebugValueInst *i) { SILTy = *MaybeSILTy; else SILTy = SILVal->getType(); - auto RealTy = SILTy.getASTType(); - if (VarDecl *Decl = i->getDecl()) { - DbgTy = DebugTypeInfo::getLocalVariable( - Decl, RealTy, getTypeInfo(SILVal->getType())); - } else if (!SILTy.hasArchetype() && !VarInfo->Name.empty()) { - // Preliminary support for .sil debug information. - DbgTy = DebugTypeInfo::getFromTypeInfo(RealTy, getTypeInfo(SILTy)); - } else - return; - - // Put the value into a stack slot at -Onone. - llvm::SmallVector Copy; - emitShadowCopyIfNeeded(SILVal, i->getDebugScope(), *VarInfo, IsAnonymous, - Copy); - bindArchetypes(DbgTy.getType()); - if (!IGM.DebugInfo) - return; - - IndirectionKind Indirection = - InCoroContext(*CurSILFn, *i) ? CoroDirectValue : DirectValue; - - emitDebugVariableDeclaration(Copy, DbgTy, SILTy, i->getDebugScope(), - i->getLoc(), *VarInfo, Indirection); -} - -void IRGenSILFunction::visitDebugValueAddrInst(DebugValueAddrInst *i) { - if (i->getDebugScope()->getInlinedFunction()->isTransparent()) - return; - - auto SILVal = i->getOperand(); - if (isa(SILVal)) - return; - auto VarInfo = i->getVarInfo(); - assert(VarInfo && "debug_value_addr without debug info"); - bool IsAnonymous = false; - bool IsLoadablyByAddress = isa(SILVal); - IndirectionKind Indirection = - (IsLoadablyByAddress) ? DirectValue : IndirectValue; - VarInfo->Name = getVarName(i, IsAnonymous); - auto *Addr = getLoweredAddress(SILVal).getAddress(); - SILType SILTy; - if (auto MaybeSILTy = VarInfo->Type) - // If there is auxiliary type info, use it - SILTy = *MaybeSILTy; - else - SILTy = SILVal->getType(); - auto RealType = SILTy.getASTType(); - if (CurSILFn->isAsync() && !i->getDebugScope()->InlinedCallSite) { - Indirection = CoroIndirectValue; + auto RealTy = SILTy.getASTType(); + if (IsAddrVal && IsInCoro) if (auto *PBI = dyn_cast(i->getOperand())) { // Usually debug info only ever describes the *result* of a projectBox // call. To allow the debugger to display a boxed parameter of an async // continuation object, however, the debug info can only describe the box // itself and thus also needs to emit a box type for it so the debugger // knows to call into Remote Mirrors to unbox the value. - RealType = PBI->getOperand()->getType().getASTType(); - assert(isa(RealType)); + RealTy = PBI->getOperand()->getType().getASTType(); + assert(isa(RealTy)); } - } - DebugTypeInfo DbgTy; - if (VarDecl *Decl = i->getDecl()) - DbgTy = DebugTypeInfo::getLocalVariable(Decl, RealType, - getTypeInfo(SILVal->getType())); - else if (i->getFunction()->isBare() && !SILTy.hasArchetype() && - !VarInfo->Name.empty()) + // Figure out the debug variable type + if (VarDecl *Decl = i->getDecl()) { + DbgTy = DebugTypeInfo::getLocalVariable( + Decl, RealTy, getTypeInfo(SILVal->getType())); + } else if (!SILTy.hasArchetype() && !VarInfo->Name.empty()) { // Handle the cases that read from a SIL file - DbgTy = DebugTypeInfo::getFromTypeInfo(RealType, getTypeInfo(SILTy)); - else + DbgTy = DebugTypeInfo::getFromTypeInfo(RealTy, getTypeInfo(SILTy)); + } else return; + // Since debug_value is expressing indirection explicitly via op_deref, + // we're not using either IndirectValue or CoroIndirectValue here. + IndirectionKind Indirection = IsInCoro? CoroDirectValue : DirectValue; + + // Put the value into a shadow-copy stack slot at -Onone. + llvm::SmallVector Copy; + if (IsAddrVal) + Copy.emplace_back( + emitShadowCopyIfNeeded(getLoweredAddress(SILVal).getAddress(), + i->getDebugScope(), *VarInfo, IsAnonymous)); + else + emitShadowCopyIfNeeded(SILVal, i->getDebugScope(), *VarInfo, IsAnonymous, + Copy); + bindArchetypes(DbgTy.getType()); if (!IGM.DebugInfo) return; - // Put the value's address into a stack slot at -Onone and emit a debug - // intrinsic. - emitDebugVariableDeclaration( - emitShadowCopyIfNeeded(Addr, i->getDebugScope(), *VarInfo, IsAnonymous), - DbgTy, SILType(), i->getDebugScope(), i->getLoc(), *VarInfo, Indirection); + emitDebugVariableDeclaration(Copy, DbgTy, SILTy, i->getDebugScope(), + i->getLoc(), *VarInfo, Indirection); } void IRGenSILFunction::visitFixLifetimeInst(swift::FixLifetimeInst *i) { diff --git a/lib/IRGen/LoadableByAddress.cpp b/lib/IRGen/LoadableByAddress.cpp index 8ad17f60f910b..010dfd4cda81b 100644 --- a/lib/IRGen/LoadableByAddress.cpp +++ b/lib/IRGen/LoadableByAddress.cpp @@ -1078,9 +1078,9 @@ static AllocStackInst *allocate(StructLoweringState &pass, SILType type) { // Insert an alloc_stack at the beginning of the function. SILBuilderWithScope allocBuilder(&*pass.F->begin()); // Don't put any variable debug info into the alloc_stack, there will be a - // debug_value_addr insterted later. TODO: It may be more elegant to insert + // debug_value insterted later. TODO: It may be more elegant to insert // the variable info into the alloc_stack instead of additionally generating a - // debug_value_addr. + // debug_value. AllocStackInst *alloc = allocBuilder.createAllocStack( RegularLocation::getAutoGeneratedLocation(), type); @@ -2969,10 +2969,8 @@ void LoadableByAddress::run() { builtinInstrs.insert(instr); break; } - case SILInstructionKind::DebugValueAddrInst: - case SILInstructionKind::DebugValueInst: { + case SILInstructionKind::DebugValueInst: break; - } default: llvm_unreachable("Unhandled use of FunctionRefInst"); } diff --git a/lib/SIL/IR/OperandOwnership.cpp b/lib/SIL/IR/OperandOwnership.cpp index 6a2afb2bc6f4a..aaa7de9e07d1e 100644 --- a/lib/SIL/IR/OperandOwnership.cpp +++ b/lib/SIL/IR/OperandOwnership.cpp @@ -143,7 +143,6 @@ OPERAND_OWNERSHIP(TrivialUse, CondBranch) OPERAND_OWNERSHIP(TrivialUse, CondFail) OPERAND_OWNERSHIP(TrivialUse, CopyAddr) OPERAND_OWNERSHIP(TrivialUse, DeallocStack) -OPERAND_OWNERSHIP(TrivialUse, DebugValueAddr) OPERAND_OWNERSHIP(TrivialUse, DeinitExistentialAddr) OPERAND_OWNERSHIP(TrivialUse, DestroyAddr) OPERAND_OWNERSHIP(TrivialUse, EndAccess) diff --git a/lib/SIL/IR/SILBuilder.cpp b/lib/SIL/IR/SILBuilder.cpp index 66cb8701d546f..5d8b5071b01b1 100644 --- a/lib/SIL/IR/SILBuilder.cpp +++ b/lib/SIL/IR/SILBuilder.cpp @@ -569,7 +569,6 @@ void SILBuilder::emitDestructureValueOperation( DebugValueInst *SILBuilder::createDebugValue(SILLocation Loc, SILValue src, SILDebugVariable Var, bool poisonRefs) { - assert(isLoadableOrOpaque(src->getType())); // Debug location overrides cannot apply to debug value instructions. DebugLocOverrideRAII LocOverride{*this, None}; return insert( @@ -577,12 +576,12 @@ DebugValueInst *SILBuilder::createDebugValue(SILLocation Loc, SILValue src, poisonRefs)); } -DebugValueAddrInst *SILBuilder::createDebugValueAddr(SILLocation Loc, - SILValue src, - SILDebugVariable Var) { +DebugValueInst *SILBuilder::createDebugValueAddr(SILLocation Loc, + SILValue src, + SILDebugVariable Var) { // Debug location overrides cannot apply to debug addr instructions. DebugLocOverrideRAII LocOverride{*this, None}; - return insert(DebugValueAddrInst::create(getSILDebugLocation(Loc), src, + return insert(DebugValueInst::createAddr(getSILDebugLocation(Loc), src, getModule(), Var)); } diff --git a/lib/SIL/IR/SILDebugScope.cpp b/lib/SIL/IR/SILDebugScope.cpp index ed6aa75390a25..9212d4991ccd2 100644 --- a/lib/SIL/IR/SILDebugScope.cpp +++ b/lib/SIL/IR/SILDebugScope.cpp @@ -60,5 +60,5 @@ SILFunction *SILDebugScope::getParentFunction() const { bool swift::maybeScopeless(const SILInstruction &inst) { if (inst.getFunction()->isBare()) return true; - return !isa(inst) && !isa(inst); + return !isa(inst); } diff --git a/lib/SIL/IR/SILInstruction.cpp b/lib/SIL/IR/SILInstruction.cpp index 66820596fc9ad..47ce3171996e2 100644 --- a/lib/SIL/IR/SILInstruction.cpp +++ b/lib/SIL/IR/SILInstruction.cpp @@ -1367,7 +1367,6 @@ bool SILInstruction::isMetaInstruction() const { case SILInstructionKind::AllocBoxInst: case SILInstructionKind::AllocStackInst: case SILInstructionKind::DebugValueInst: - case SILInstructionKind::DebugValueAddrInst: return true; default: return false; diff --git a/lib/SIL/IR/SILInstructions.cpp b/lib/SIL/IR/SILInstructions.cpp index e072926d35162..b0a656f5db9d0 100644 --- a/lib/SIL/IR/SILInstructions.cpp +++ b/lib/SIL/IR/SILInstructions.cpp @@ -357,33 +357,32 @@ DebugValueInst *DebugValueInst::create(SILDebugLocation DebugLoc, return ::new (buf) DebugValueInst(DebugLoc, Operand, Var, poisonRefs); } -DebugValueAddrInst::DebugValueAddrInst(SILDebugLocation DebugLoc, - SILValue Operand, SILDebugVariable Var) - : UnaryInstructionBase(DebugLoc, Operand), - SILDebugVariableSupplement(Var.DIExpr.getNumElements(), - Var.Type.hasValue(), Var.Loc.hasValue(), - Var.Scope), - VarInfo(Var, getTrailingObjects(), getTrailingObjects(), - getTrailingObjects(), - getTrailingObjects(), - getTrailingObjects()) { - if (auto *VD = DebugLoc.getLocation().getAsASTNode()) - VarInfo.setImplicit(VD->isImplicit() || VarInfo.isImplicit()); +DebugValueInst *DebugValueInst::createAddr(SILDebugLocation DebugLoc, + SILValue Operand, SILModule &M, + SILDebugVariable Var) { + // For alloc_stack, debug_value is used to annotate the associated + // memory location, so we shouldn't attach op_deref. + if (!isa(Operand)) + Var.DIExpr.prependElements( + {SILDIExprElement::createOperator(SILDIExprOperator::Dereference)}); + void *buf = allocateDebugVarCarryingInst(M, Var); + return ::new (buf) DebugValueInst(DebugLoc, Operand, Var, + /*poisonRefs=*/false); } -DebugValueAddrInst *DebugValueAddrInst::create(SILDebugLocation DebugLoc, - SILValue Operand, SILModule &M, - SILDebugVariable Var) { - void *buf = allocateDebugVarCarryingInst(M, Var); - return ::new (buf) DebugValueAddrInst(DebugLoc, Operand, Var); +bool DebugValueInst::exprStartsWithDeref() const { + if (!NumDIExprOperands) + return false; + + llvm::ArrayRef DIExprElements( + getTrailingObjects(), NumDIExprOperands); + return DIExprElements.front().getAsOperator() + == SILDIExprOperator::Dereference; } VarDecl *DebugValueInst::getDecl() const { return getLoc().getAsASTNode(); } -VarDecl *DebugValueAddrInst::getDecl() const { - return getLoc().getAsASTNode(); -} AllocExistentialBoxInst *AllocExistentialBoxInst::create( SILDebugLocation Loc, SILType ExistentialType, CanType ConcreteType, diff --git a/lib/SIL/IR/SILPrinter.cpp b/lib/SIL/IR/SILPrinter.cpp index fe6f39362955a..b01d382c057fe 100644 --- a/lib/SIL/IR/SILPrinter.cpp +++ b/lib/SIL/IR/SILPrinter.cpp @@ -1179,31 +1179,37 @@ class SILPrinter : public SILInstructionVisitor { void printDebugVar(Optional Var, const SourceManager *SM = nullptr) { - if (!Var || Var->Name.empty()) + if (!Var) return; - if (Var->Constant) - *this << ", let"; - else - *this << ", var"; - - if ((Var->Loc || Var->Scope) && SM) { - *this << ", (name \"" << Var->Name << '"'; - if (Var->Loc) - printDebugLocRef(*Var->Loc, *SM); - if (Var->Scope) - printDebugScopeRef(Var->Scope, *SM); - *this << ")"; - } else - *this << ", name \"" << Var->Name << '"'; - if (Var->ArgNo) - *this << ", argno " << Var->ArgNo; - if (Var->Implicit) - *this << ", implicit"; - if (Var->Type) { - *this << ", type "; - Var->Type->print(PrintState.OS, PrintState.ASTOptions); + if (!Var->Name.empty()) { + if (Var->Constant) + *this << ", let"; + else + *this << ", var"; + + if ((Var->Loc || Var->Scope) && SM) { + *this << ", (name \"" << Var->Name << '"'; + if (Var->Loc) + printDebugLocRef(*Var->Loc, *SM); + if (Var->Scope) + printDebugScopeRef(Var->Scope, *SM); + *this << ")"; + } else + *this << ", name \"" << Var->Name << '"'; + + if (Var->ArgNo) + *this << ", argno " << Var->ArgNo; + if (Var->Implicit) + *this << ", implicit"; + if (Var->Type) { + *this << ", type "; + Var->Type->print(PrintState.OS, PrintState.ASTOptions); + } } + // Although it's rare in real-world use cases, but during testing, + // sometimes we want to print out di-expression, even the debug + // variable name is empty. if (Var->DIExpr) printDebugInfoExpression(Var->DIExpr); } @@ -1580,12 +1586,6 @@ class SILPrinter : public SILInstructionVisitor { &DVI->getModule().getASTContext().SourceMgr); } - void visitDebugValueAddrInst(DebugValueAddrInst *DVAI) { - *this << getIDAndType(DVAI->getOperand()); - printDebugVar(DVAI->getVarInfo(), - &DVAI->getModule().getASTContext().SourceMgr); - } - #define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \ void visitLoad##Name##Inst(Load##Name##Inst *LI) { \ if (LI->isTake()) \ diff --git a/lib/SIL/Parser/ParseSIL.cpp b/lib/SIL/Parser/ParseSIL.cpp index 0a25b682048cc..90403c09805c1 100644 --- a/lib/SIL/Parser/ParseSIL.cpp +++ b/lib/SIL/Parser/ParseSIL.cpp @@ -1649,7 +1649,10 @@ bool SILParser::parseSILDebugInfoExpression(SILDebugInfoExpression &DIExpr) { return true; // All operators that we currently support - static const SILDIExprOperator AllOps[] = {SILDIExprOperator::Fragment}; + static const SILDIExprOperator AllOps[] = { + SILDIExprOperator::Dereference, + SILDIExprOperator::Fragment + }; do { P.consumeToken(); @@ -3170,20 +3173,16 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B, break; } - case SILInstructionKind::DebugValueInst: - case SILInstructionKind::DebugValueAddrInst: { + case SILInstructionKind::DebugValueInst: { bool poisonRefs = false; SILDebugVariable VarInfo; if (parseSILOptional(poisonRefs, *this, "poison") || parseTypedValueRef(Val, B) || parseSILDebugVar(VarInfo) || parseSILDebugLocation(InstLoc, B)) return true; - if (Opcode == SILInstructionKind::DebugValueInst) - ResultVal = B.createDebugValue(InstLoc, Val, VarInfo, poisonRefs); - else { - assert(!poisonRefs && "debug_value_addr does not support poison"); - ResultVal = B.createDebugValueAddr(InstLoc, Val, VarInfo); - } + if (Val->getType().isAddress()) + assert(!poisonRefs && "debug_value w/ address value does not support poison"); + ResultVal = B.createDebugValue(InstLoc, Val, VarInfo, poisonRefs); break; } diff --git a/lib/SIL/Utils/MemAccessUtils.cpp b/lib/SIL/Utils/MemAccessUtils.cpp index 1bff65e66c37f..9e8bd64c7ad7a 100644 --- a/lib/SIL/Utils/MemAccessUtils.cpp +++ b/lib/SIL/Utils/MemAccessUtils.cpp @@ -1629,9 +1629,12 @@ swift::getSingleInitAllocStackUse(AllocStackInst *asi, if (destroyingUses) destroyingUses->push_back(use); continue; + case SILInstructionKind::DebugValueInst: + if (cast(user)->hasAddrVal()) + continue; + break; case SILInstructionKind::DeallocStackInst: case SILInstructionKind::LoadBorrowInst: - case SILInstructionKind::DebugValueAddrInst: continue; } diff --git a/lib/SIL/Utils/MemoryLocations.cpp b/lib/SIL/Utils/MemoryLocations.cpp index 994fbda0b715c..1b064a8cdf632 100644 --- a/lib/SIL/Utils/MemoryLocations.cpp +++ b/lib/SIL/Utils/MemoryLocations.cpp @@ -362,6 +362,10 @@ bool MemoryLocations::analyzeLocationUsesRecursively(SILValue V, unsigned locIdx if (!cast(user)->getUsersOfType().empty()) return false; break; + case SILInstructionKind::DebugValueInst: + if (cast(user)->hasAddrVal()) + break; + return false; case SILInstructionKind::InjectEnumAddrInst: case SILInstructionKind::SelectEnumAddrInst: case SILInstructionKind::ExistentialMetatypeInst: @@ -379,7 +383,6 @@ bool MemoryLocations::analyzeLocationUsesRecursively(SILValue V, unsigned locIdx case SILInstructionKind::ApplyInst: case SILInstructionKind::TryApplyInst: case SILInstructionKind::BeginApplyInst: - case SILInstructionKind::DebugValueAddrInst: case SILInstructionKind::CopyAddrInst: case SILInstructionKind::YieldInst: case SILInstructionKind::DeallocStackInst: diff --git a/lib/SIL/Verifier/MemoryLifetimeVerifier.cpp b/lib/SIL/Verifier/MemoryLifetimeVerifier.cpp index 92365cf3d8eed..4d88d8c1acf25 100644 --- a/lib/SIL/Verifier/MemoryLifetimeVerifier.cpp +++ b/lib/SIL/Verifier/MemoryLifetimeVerifier.cpp @@ -610,9 +610,18 @@ void MemoryLifetimeVerifier::checkBlock(SILBasicBlock *block, Bits &bits) { case SILInstructionKind::ValueMetatypeInst: case SILInstructionKind::IsUniqueInst: case SILInstructionKind::FixLifetimeInst: - case SILInstructionKind::DebugValueAddrInst: requireBitsSet(bits, I.getOperand(0), &I); break; + case SILInstructionKind::DebugValueInst: + // We don't want to check `debug_value` instructions that + // are used to mark variable declarations (e.g. its SSA value is + // an alloc_stack), which don't have any `op_deref` in its + // di-expression, because that memory does't need to be initialized + // when `debug_value` is referencing it. + if (cast(&I)->hasAddrVal() && + cast(&I)->exprStartsWithDeref()) + requireBitsSet(bits, I.getOperand(0), &I); + break; case SILInstructionKind::UncheckedTakeEnumDataAddrInst: { // Note that despite the name, unchecked_take_enum_data_addr does _not_ // "take" the payload of the Swift.Optional enum. This is a terrible diff --git a/lib/SIL/Verifier/SILVerifier.cpp b/lib/SIL/Verifier/SILVerifier.cpp index 3bfee7edca697..b6ce63c36c3d4 100644 --- a/lib/SIL/Verifier/SILVerifier.cpp +++ b/lib/SIL/Verifier/SILVerifier.cpp @@ -537,7 +537,6 @@ struct ImmutableAddressUseVerifier { } case SILInstructionKind::MarkDependenceInst: case SILInstructionKind::LoadBorrowInst: - case SILInstructionKind::DebugValueAddrInst: case SILInstructionKind::ExistentialMetatypeInst: case SILInstructionKind::ValueMetatypeInst: case SILInstructionKind::FixLifetimeInst: @@ -545,6 +544,13 @@ struct ImmutableAddressUseVerifier { case SILInstructionKind::SwitchEnumAddrInst: case SILInstructionKind::SelectEnumAddrInst: break; + case SILInstructionKind::DebugValueInst: + if (cast(inst)->hasAddrVal()) + break; + else { + llvm::errs() << "Unhandled, unexpected instruction: " << *inst; + llvm_unreachable("invoking standard assertion failure"); + } case SILInstructionKind::AddressToPointerInst: // We assume that the user is attempting to do something unsafe since we // are converting to a raw pointer. So just ignore this use. @@ -1213,8 +1219,6 @@ class SILVerifier : public SILVerifierBase { varInfo = di->getVarInfo(); else if (auto *di = dyn_cast(inst)) varInfo = di->getVarInfo(); - else if (auto *di = dyn_cast(inst)) - varInfo = di->getVarInfo(); if (!varInfo) return; diff --git a/lib/SILOptimizer/Analysis/ARCAnalysis.cpp b/lib/SILOptimizer/Analysis/ARCAnalysis.cpp index 0a804ca876be5..40a8ccbee2b48 100644 --- a/lib/SILOptimizer/Analysis/ARCAnalysis.cpp +++ b/lib/SILOptimizer/Analysis/ARCAnalysis.cpp @@ -157,7 +157,6 @@ bool swift::canUseObject(SILInstruction *Inst) { // Debug values do not use referenced counted values in a manner we care // about. case SILInstructionKind::DebugValueInst: - case SILInstructionKind::DebugValueAddrInst: return false; // Casts do not use pointers in a manner that we care about since we strip @@ -1159,8 +1158,7 @@ SILInstruction *swift::findReleaseToMatchUnsafeGuaranteedValue( continue; } - if (CurInst.mayHaveSideEffects() && !isa(CurInst) && - !isa(CurInst)) + if (CurInst.mayHaveSideEffects() && !DebugValueInst::hasAddrVal(&CurInst)) break; } @@ -1178,8 +1176,7 @@ SILInstruction *swift::findReleaseToMatchUnsafeGuaranteedValue( continue; } - if (CurInst.mayHaveSideEffects() && !isa(CurInst) && - !isa(CurInst)) + if (CurInst.mayHaveSideEffects() && !DebugValueInst::hasAddrVal(&CurInst)) break; } diff --git a/lib/SILOptimizer/Analysis/AccessSummaryAnalysis.cpp b/lib/SILOptimizer/Analysis/AccessSummaryAnalysis.cpp index 3d078d8e8d50d..c642e76384a39 100644 --- a/lib/SILOptimizer/Analysis/AccessSummaryAnalysis.cpp +++ b/lib/SILOptimizer/Analysis/AccessSummaryAnalysis.cpp @@ -116,7 +116,6 @@ void AccessSummaryAnalysis::processArgument(FunctionInfo *info, worklist.append(inst->use_begin(), inst->use_end()); break; } - case SILInstructionKind::DebugValueAddrInst: case SILInstructionKind::AddressToPointerInst: // Ignore these uses, they don't affect formal accesses. break; @@ -124,6 +123,10 @@ void AccessSummaryAnalysis::processArgument(FunctionInfo *info, processPartialApply(info, argumentIndex, cast(user), operand, order); break; + case SILInstructionKind::DebugValueInst: + if (DebugValueInst::hasAddrVal(user)) + break; + LLVM_FALLTHROUGH; default: // FIXME: These likely represent scenarios in which we're not generating // begin access markers. Ignore these for now. But we really should diff --git a/lib/SILOptimizer/Analysis/EscapeAnalysis.cpp b/lib/SILOptimizer/Analysis/EscapeAnalysis.cpp index 06a87fd280148..f4de88c10b9bb 100644 --- a/lib/SILOptimizer/Analysis/EscapeAnalysis.cpp +++ b/lib/SILOptimizer/Analysis/EscapeAnalysis.cpp @@ -2143,7 +2143,6 @@ void EscapeAnalysis::analyzeInstruction(SILInstruction *I, case SILInstructionKind::CondBranchInst: case SILInstructionKind::SwitchEnumInst: case SILInstructionKind::DebugValueInst: - case SILInstructionKind::DebugValueAddrInst: case SILInstructionKind::ValueMetatypeInst: case SILInstructionKind::InitExistentialMetatypeInst: case SILInstructionKind::OpenExistentialMetatypeInst: diff --git a/lib/SILOptimizer/Analysis/MemoryBehavior.cpp b/lib/SILOptimizer/Analysis/MemoryBehavior.cpp index 39dcb0d09d936..cb333baa62ee6 100644 --- a/lib/SILOptimizer/Analysis/MemoryBehavior.cpp +++ b/lib/SILOptimizer/Analysis/MemoryBehavior.cpp @@ -364,7 +364,6 @@ static bool hasEscapingUses(SILValue address, int &numChecks) { return true; switch (user->getKind()) { - case SILInstructionKind::DebugValueAddrInst: case SILInstructionKind::FixLifetimeInst: case SILInstructionKind::LoadInst: case SILInstructionKind::StoreInst: @@ -374,6 +373,10 @@ static bool hasEscapingUses(SILValue address, int &numChecks) { case SILInstructionKind::EndAccessInst: // Those instructions have no result and cannot escape the address. break; + case SILInstructionKind::DebugValueInst: + if (DebugValueInst::hasAddrVal(user)) + break; + return true; case SILInstructionKind::ApplyInst: case SILInstructionKind::TryApplyInst: case SILInstructionKind::BeginApplyInst: diff --git a/lib/SILOptimizer/Differentiation/Common.cpp b/lib/SILOptimizer/Differentiation/Common.cpp index 7f016db2d6dcb..7190475bd0acb 100644 --- a/lib/SILOptimizer/Differentiation/Common.cpp +++ b/lib/SILOptimizer/Differentiation/Common.cpp @@ -259,10 +259,6 @@ findDebugLocationAndVariable(SILValue originalValue) { return dvi->getVarInfo().map([&](SILDebugVariable var) { return std::make_pair(dvi->getDebugLocation(), var); }); - if (auto *dvai = dyn_cast(use->getUser())) - return dvai->getVarInfo().map([&](SILDebugVariable var) { - return std::make_pair(dvai->getDebugLocation(), var); - }); } return None; } diff --git a/lib/SILOptimizer/Differentiation/PullbackCloner.cpp b/lib/SILOptimizer/Differentiation/PullbackCloner.cpp index 4af5e7b30cbf2..e4ab8f3947af2 100644 --- a/lib/SILOptimizer/Differentiation/PullbackCloner.cpp +++ b/lib/SILOptimizer/Differentiation/PullbackCloner.cpp @@ -1676,7 +1676,6 @@ class PullbackCloner::Implementation final // Debugging/reference counting instructions. NO_ADJOINT(DebugValue) - NO_ADJOINT(DebugValueAddr) NO_ADJOINT(RetainValue) NO_ADJOINT(RetainValueAddr) NO_ADJOINT(ReleaseValue) diff --git a/lib/SILOptimizer/IPO/GlobalPropertyOpt.cpp b/lib/SILOptimizer/IPO/GlobalPropertyOpt.cpp index 62857c4c6905c..d6a1930ac3798 100644 --- a/lib/SILOptimizer/IPO/GlobalPropertyOpt.cpp +++ b/lib/SILOptimizer/IPO/GlobalPropertyOpt.cpp @@ -219,7 +219,6 @@ bool GlobalPropertyOpt::canAddressEscape(SILValue V, bool acceptStore) { // These instructions do not cause the address to escape. if (isa(User) || isa(User) || - isa(User) || isa(User) || isa(User) || isa(User) || diff --git a/lib/SILOptimizer/Mandatory/CapturePromotion.cpp b/lib/SILOptimizer/Mandatory/CapturePromotion.cpp index 479ce6c8c739c..67686f606930e 100644 --- a/lib/SILOptimizer/Mandatory/CapturePromotion.cpp +++ b/lib/SILOptimizer/Mandatory/CapturePromotion.cpp @@ -313,7 +313,7 @@ class ClosureCloner : public SILClonerWithScopes { SILValue getProjectBoxMappedVal(SILValue operandValue); - void visitDebugValueAddrInst(DebugValueAddrInst *inst); + void visitDebugValueInst(DebugValueInst *inst); void visitDestroyValueInst(DestroyValueInst *inst); void visitStructElementAddrInst(StructElementAddrInst *inst); void visitLoadInst(LoadInst *inst); @@ -570,16 +570,17 @@ SILValue ClosureCloner::getProjectBoxMappedVal(SILValue operandValue) { return SILValue(); } -/// Handle a debug_value_addr instruction during cloning of a closure; -/// if its operand is the promoted address argument then lower it to a -/// debug_value, otherwise it is handled normally. -void ClosureCloner::visitDebugValueAddrInst(DebugValueAddrInst *inst) { - if (SILValue value = getProjectBoxMappedVal(inst->getOperand())) { - getBuilder().setCurrentDebugScope(getOpScope(inst->getDebugScope())); - getBuilder().createDebugValue(inst->getLoc(), value, *inst->getVarInfo()); - return; - } - SILCloner::visitDebugValueAddrInst(inst); +/// Handle a debug_value instruction during cloning of a closure; +/// if its operand is the promoted address argument then lower it to +/// another debug_value, otherwise it is handled normally. +void ClosureCloner::visitDebugValueInst(DebugValueInst *inst) { + if (inst->hasAddrVal()) + if (SILValue value = getProjectBoxMappedVal(inst->getOperand())) { + getBuilder().setCurrentDebugScope(getOpScope(inst->getDebugScope())); + getBuilder().createDebugValue(inst->getLoc(), value, *inst->getVarInfo()); + return; + } + SILCloner::visitDebugValueInst(inst); } /// Handle a destroy_value instruction during cloning of a closure; if it is a @@ -854,7 +855,7 @@ getPartialApplyArgMutationsAndEscapes(PartialApplyInst *pai, return false; } - if (isa(addrUser) || + if (DebugValueInst::hasAddrVal(addrUser) || isa(addrUser) || isa(addrUser)) { return false; } diff --git a/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp b/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp index 44d93d5a1791e..b078389b754f9 100644 --- a/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp +++ b/lib/SILOptimizer/SILCombiner/SILCombinerMiscVisitors.cpp @@ -508,12 +508,15 @@ bool SILCombiner::optimizeStackAllocatedEnum(AllocStackInst *AS) { for (auto *use : AS->getUses()) { SILInstruction *user = use->getUser(); switch (user->getKind()) { - case SILInstructionKind::DebugValueAddrInst: case SILInstructionKind::DestroyAddrInst: case SILInstructionKind::DeallocStackInst: case SILInstructionKind::InjectEnumAddrInst: // We'll check init_enum_addr below. break; + case SILInstructionKind::DebugValueInst: + if (DebugValueInst::hasAddrVal(user)) + break; + return false; case SILInstructionKind::InitEnumDataAddrInst: { auto *ieda = cast(user); auto *el = ieda->getElement(); @@ -569,7 +572,6 @@ bool SILCombiner::optimizeStackAllocatedEnum(AllocStackInst *AS) { SILInstruction *user = use->getUser(); switch (user->getKind()) { case SILInstructionKind::InjectEnumAddrInst: - case SILInstructionKind::DebugValueAddrInst: eraseInstFromFunction(*user); break; case SILInstructionKind::DestroyAddrInst: @@ -599,6 +601,12 @@ bool SILCombiner::optimizeStackAllocatedEnum(AllocStackInst *AS) { eraseInstFromFunction(*svi); break; } + case SILInstructionKind::DebugValueInst: + if (DebugValueInst::hasAddrVal(user)) { + eraseInstFromFunction(*user); + break; + } + LLVM_FALLTHROUGH; default: llvm_unreachable("unexpected alloc_stack user"); } diff --git a/lib/SILOptimizer/Transforms/AllocBoxToStack.cpp b/lib/SILOptimizer/Transforms/AllocBoxToStack.cpp index 5cfb5ba1c3f79..ea75ac05f07b5 100644 --- a/lib/SILOptimizer/Transforms/AllocBoxToStack.cpp +++ b/lib/SILOptimizer/Transforms/AllocBoxToStack.cpp @@ -65,7 +65,7 @@ static bool useCaptured(Operand *UI) { auto *User = UI->getUser(); // These instructions do not cause the address to escape. - if (isa(User) || isa(User) + if (isa(User) || isa(User) || isa(User) || isa(User)) return false; diff --git a/lib/SILOptimizer/Transforms/AssemblyVisionRemarkGenerator.cpp b/lib/SILOptimizer/Transforms/AssemblyVisionRemarkGenerator.cpp index 6c4cd5d9a5174..2d3dc2c7623fa 100644 --- a/lib/SILOptimizer/Transforms/AssemblyVisionRemarkGenerator.cpp +++ b/lib/SILOptimizer/Transforms/AssemblyVisionRemarkGenerator.cpp @@ -229,7 +229,7 @@ namespace { /// A helper struct that attempts to infer the decl associated with a value from /// one of its uses. It does this by searching the def-use graph locally for -/// debug_value and debug_value_addr instructions. +/// debug_value instructions. struct ValueUseToDeclInferrer { using Argument = ValueToDeclInferrer::Argument; using ArgumentKeyKind = ValueToDeclInferrer::ArgumentKeyKind; @@ -420,7 +420,7 @@ bool ValueToDeclInferrer::infer( } // See if we have a single init alloc_stack and can infer a - // debug_value/debug_value_addr from that. + // debug_value from that. LLVM_DEBUG(llvm::dbgs() << "Checking for single init use!\n"); if (auto *initUse = getSingleInitAllocStackUse(asi)) { LLVM_DEBUG(llvm::dbgs() << "Found one: " << *initUse->getUser()); diff --git a/lib/SILOptimizer/Transforms/CopyForwarding.cpp b/lib/SILOptimizer/Transforms/CopyForwarding.cpp index 6a5c5065ffaa1..2400ae8d3ded5 100644 --- a/lib/SILOptimizer/Transforms/CopyForwarding.cpp +++ b/lib/SILOptimizer/Transforms/CopyForwarding.cpp @@ -194,7 +194,7 @@ class AddressUserVisitor { virtual bool visitNormalUse(SILInstruction *user) = 0; virtual bool visitTake(CopyAddrInst *copy) = 0; virtual bool visitDestroy(DestroyAddrInst *destroy) = 0; - virtual bool visitDebugValue(DebugValueAddrInst *debugValue) = 0; + virtual bool visitDebugValue(DebugValueInst *debugValue) = 0; }; } // namespace @@ -265,12 +265,16 @@ static bool visitAddressUsers(SILValue address, SILInstruction *ignoredUser, case SILInstructionKind::StoreInst: if (!visitor.visitNormalUse(UserInst)) return false; - break; - case SILInstructionKind::DebugValueAddrInst: - if (!visitor.visitDebugValue(cast(UserInst))) + case SILInstructionKind::DebugValueInst: + if (auto *DV = DebugValueInst::hasAddrVal(UserInst)) { + if (!visitor.visitDebugValue(DV)) + return false; + } else { + LLVM_DEBUG(llvm::dbgs() << " Skipping copy: use exposes def" + << *UserInst); return false; - + } break; case SILInstructionKind::DeallocStackInst: break; @@ -385,9 +389,12 @@ class AnalyzeForwardUse Oper = &UserInst->getOperandRef(); return false; } - bool visitDebugValueAddrInst(DebugValueAddrInst *UserInst) { - Oper = &UserInst->getOperandRef(); - return false; + bool visitDebugValueInst(DebugValueInst *UserInst) { + if (UserInst->hasAddrVal()) { + Oper = &UserInst->getOperandRef(); + return false; + } + return true; } bool visitInitEnumDataAddrInst(InitEnumDataAddrInst *UserInst) { llvm_unreachable("illegal reinitialization"); @@ -489,9 +496,12 @@ class AnalyzeBackwardUse } return true; } - bool visitDebugValueAddrInst(DebugValueAddrInst *UserInst) { - Oper = &UserInst->getOperandRef(); - return false; + bool visitDebugValueInst(DebugValueInst *UserInst) { + if (UserInst->hasAddrVal()) { + Oper = &UserInst->getOperandRef(); + return false; + } + return true; } bool visitSILInstruction(SILInstruction *UserInst) { return false; @@ -523,7 +533,7 @@ class CopyForwarding { bool HasForwardedToCopy; SmallPtrSet SrcUserInsts; - SmallPtrSet SrcDebugValueInsts; + SmallPtrSet SrcDebugValueInsts; SmallVector TakePoints; SmallPtrSet StoredValueUserInsts; SmallVector DestroyPoints; @@ -560,7 +570,7 @@ class CopyForwarding { CPF.DestroyPoints.push_back(destroy); return true; } - virtual bool visitDebugValue(DebugValueAddrInst *debugValue) override { + virtual bool visitDebugValue(DebugValueInst *debugValue) override { return CPF.SrcDebugValueInsts.insert(debugValue).second; } }; @@ -614,12 +624,12 @@ class CopyForwarding { bool propagateCopy(CopyAddrInst *CopyInst, bool hoistingDestroy); CopyAddrInst *findCopyIntoDeadTemp( CopyAddrInst *destCopy, - SmallVectorImpl &debugInstsToDelete); + SmallVectorImpl &debugInstsToDelete); bool forwardDeadTempCopy(CopyAddrInst *destCopy); bool forwardPropagateCopy(); bool backwardPropagateCopy(); bool hoistDestroy(SILInstruction *DestroyPoint, SILLocation DestroyLoc, - SmallVectorImpl &debugInstsToDelete); + SmallVectorImpl &debugInstsToDelete); bool isSourceDeadAtCopy(); @@ -646,7 +656,7 @@ class CopyDestUserVisitor : public AddressUserVisitor { virtual bool visitDestroy(DestroyAddrInst *destroy) override { return DestUsers.insert(destroy).second; } - virtual bool visitDebugValue(DebugValueAddrInst *debugValue) override { + virtual bool visitDebugValue(DebugValueInst *debugValue) override { return DestUsers.insert(debugValue).second; } }; @@ -740,7 +750,7 @@ propagateCopy(CopyAddrInst *CopyInst, bool hoistingDestroy) { /// intervening instructions, it avoids the need to analyze projection paths. CopyAddrInst *CopyForwarding::findCopyIntoDeadTemp( CopyAddrInst *destCopy, - SmallVectorImpl &debugInstsToDelete) { + SmallVectorImpl &debugInstsToDelete) { auto tmpVal = destCopy->getSrc(); assert(tmpVal == CurrentDef); assert(isIdentifiedSourceValue(tmpVal)); @@ -757,13 +767,13 @@ CopyAddrInst *CopyForwarding::findCopyIntoDeadTemp( if (SrcUserInsts.count(UserInst)) return nullptr; - // Collect all debug_value_addr instructions between temp to dest copy and - // src to temp copy. On success, these debug_value_addr instructions should - // be deleted. - if (auto *debugUser = dyn_cast(UserInst)) { + // Collect all debug_value w/ address value instructions between temp to + // dest copy and src to temp copy. + // On success, these debug_value instructions should be deleted. + if (isa(UserInst)) { // 'SrcDebugValueInsts' consists of all the debug users of 'temp' - if (SrcDebugValueInsts.count(debugUser)) - debugInstsToDelete.push_back(debugUser); + if (SrcDebugValueInsts.count(UserInst)) + debugInstsToDelete.push_back(UserInst); continue; } @@ -796,7 +806,7 @@ CopyAddrInst *CopyForwarding::findCopyIntoDeadTemp( /// attempts to destroy this uninitialized value. bool CopyForwarding:: forwardDeadTempCopy(CopyAddrInst *destCopy) { - SmallVector debugInstsToDelete; + SmallVector debugInstsToDelete; auto *srcCopy = findCopyIntoDeadTemp(CurrentCopy, debugInstsToDelete); if (!srcCopy) return false; @@ -817,7 +827,7 @@ forwardDeadTempCopy(CopyAddrInst *destCopy) { .createDestroyAddr(srcCopy->getLoc(), srcCopy->getDest()); } - // Delete all dead debug_value_addr instructions + // Delete all dead debug_value instructions for (auto *deadDebugUser : debugInstsToDelete) { deadDebugUser->eraseFromParent(); } @@ -1143,7 +1153,7 @@ bool CopyForwarding::backwardPropagateCopy() { bool seenCopyDestDef = false; // ValueUses records the uses of CopySrc in reverse order. SmallVector ValueUses; - SmallVector DebugValueInstsToDelete; + SmallVector DebugValueInstsToDelete; auto SI = CurrentCopy->getIterator(), SE = CurrentCopy->getParent()->begin(); while (SI != SE) { --SI; @@ -1156,8 +1166,8 @@ bool CopyForwarding::backwardPropagateCopy() { if (UserInst == CopyDestRoot->getDefiningInstruction() || DestUserInsts.count(UserInst) || RootUserInsts.count(UserInst)) { - if (auto *DVAI = dyn_cast(UserInst)) { - DebugValueInstsToDelete.push_back(DVAI); + if (DebugValueInst::hasAddrVal(UserInst)) { + DebugValueInstsToDelete.push_back(UserInst); continue; } LLVM_DEBUG(llvm::dbgs() << " Skipping copy" << *CurrentCopy @@ -1166,8 +1176,8 @@ bool CopyForwarding::backwardPropagateCopy() { } // Early check to avoid scanning unrelated instructions. if (!SrcUserInsts.count(UserInst) - && !(isa(UserInst) - && SrcDebugValueInsts.count(cast(UserInst)))) + && !(isa(UserInst) + && SrcDebugValueInsts.count(UserInst))) continue; AnalyzeBackwardUse AnalyzeUse(CopySrc); @@ -1225,11 +1235,11 @@ bool CopyForwarding::backwardPropagateCopy() { /// /// Return true if a destroy was inserted, forwarded from a copy, or the /// block was marked dead-in. -/// \p debugInstsToDelete will contain the debug_value_addr users of copy src +/// \p debugInstsToDelete will contain the debug_value users of copy src /// that need to be deleted if the hoist is successful bool CopyForwarding::hoistDestroy( SILInstruction *DestroyPoint, SILLocation DestroyLoc, - SmallVectorImpl &debugInstsToDelete) { + SmallVectorImpl &debugInstsToDelete) { if (!EnableDestroyHoisting) return false; @@ -1270,12 +1280,12 @@ bool CopyForwarding::hoistDestroy( << *Inst); return tryToInsertHoistedDestroyAfter(Inst); } - if (auto *debugAddr = dyn_cast(Inst)) { - // Collect debug_value_addr uses of copy src. If the hoist is + if (isa(Inst)) { + // Collect debug_value uses of copy src. If the hoist is // successful, these instructions will have consumed operand and need to // be erased. - if (SrcDebugValueInsts.contains(debugAddr)) { - debugInstsToDelete.push_back(debugAddr); + if (SrcDebugValueInsts.contains(Inst)) { + debugInstsToDelete.push_back(Inst); } } if (!ShouldHoist && isa(Inst)) @@ -1328,7 +1338,7 @@ void CopyForwarding::forwardCopiesOf(SILValue Def, SILFunction *F) { bool HoistedDestroyFound = false; SILLocation HoistedDestroyLoc = F->getLocation(); const SILDebugScope *HoistedDebugScope = nullptr; - SmallVector debugInstsToDelete; + SmallVector debugInstsToDelete; for (auto *Destroy : DestroyPoints) { // If hoistDestroy returns false, it was not worth hoisting. @@ -1344,7 +1354,7 @@ void CopyForwarding::forwardCopiesOf(SILValue Def, SILFunction *F) { // original Destroy. Destroy->eraseFromParent(); assert(HasChanged || !DeadInBlocks.empty() && "HasChanged should be set"); - // Since the hoist was successful, delete all dead debug_value_addr + // Since the hoist was successful, delete all dead debug_value for (auto *deadDebugUser : debugInstsToDelete) { deadDebugUser->eraseFromParent(); } diff --git a/lib/SILOptimizer/Transforms/DeadCodeElimination.cpp b/lib/SILOptimizer/Transforms/DeadCodeElimination.cpp index 20607ba377a4f..0a6a3e4f2553f 100644 --- a/lib/SILOptimizer/Transforms/DeadCodeElimination.cpp +++ b/lib/SILOptimizer/Transforms/DeadCodeElimination.cpp @@ -75,7 +75,7 @@ static bool seemsUseful(SILInstruction *I) { } // Is useful if it's associating with a function argument - if (isa(I) || isa(I)) + if (isa(I)) return isa(I->getOperand(0)); return false; diff --git a/lib/SILOptimizer/Transforms/DeadStoreElimination.cpp b/lib/SILOptimizer/Transforms/DeadStoreElimination.cpp index c8e6bd4d2872a..fca73d20286b8 100644 --- a/lib/SILOptimizer/Transforms/DeadStoreElimination.cpp +++ b/lib/SILOptimizer/Transforms/DeadStoreElimination.cpp @@ -400,9 +400,10 @@ enum class ProcessKind { /// Process instructions. Extract locations from SIL StoreInst. void processStoreInst(SILInstruction *Inst, DSEKind Kind); - /// Process instructions. Extract locations from SIL DebugValueAddrInst. - /// DebugValueAddrInst maybe promoted to DebugValue, when this is done, - /// DebugValueAddrInst is effectively a read on the location. + /// Process instructions. Extract locations from SIL DebugValueInst. + /// DebugValueInst w/ address value maybe promoted to DebugValueInst w/ + /// scalar value when this is done, + /// DebugValueInst is effectively a read on the location. void processDebugValueAddrInst(SILInstruction *I, DSEKind Kind); void processDebugValueAddrInstForGenKillSet(SILInstruction *I); void processDebugValueAddrInstForDSE(SILInstruction *I); @@ -1045,7 +1046,7 @@ void DSEContext::processStoreInst(SILInstruction *I, DSEKind Kind) { void DSEContext::processDebugValueAddrInstForGenKillSet(SILInstruction *I) { BlockState *S = getBlockState(I); - SILValue Mem = cast(I)->getOperand(); + SILValue Mem = cast(I)->getOperand(); for (unsigned i = 0; i < S->LocationNum; ++i) { if (!S->BBMaxStoreSet.test(i)) continue; @@ -1058,7 +1059,7 @@ void DSEContext::processDebugValueAddrInstForGenKillSet(SILInstruction *I) { void DSEContext::processDebugValueAddrInstForDSE(SILInstruction *I) { BlockState *S = getBlockState(I); - SILValue Mem = cast(I)->getOperand(); + SILValue Mem = cast(I)->getOperand(); for (unsigned i = 0; i < S->LocationNum; ++i) { if (!S->isTrackingLocation(S->BBWriteSetMid, i)) continue; @@ -1140,11 +1141,11 @@ void DSEContext::processInstruction(SILInstruction *I, DSEKind Kind) { processLoadInst(I, Kind); } else if (isa(I)) { processStoreInst(I, Kind); - } else if (isa(I)) { + } else if (DebugValueInst::hasAddrVal(I)) { processDebugValueAddrInst(I, Kind); } else if (I->mayReadFromMemory()) { processUnknownReadInst(I, Kind); - } + } // Check whether this instruction will invalidate any other locations. for (auto result : I->getResults()) diff --git a/lib/SILOptimizer/Transforms/DestroyHoisting.cpp b/lib/SILOptimizer/Transforms/DestroyHoisting.cpp index 9ede0f8b1016e..6d0e7c647040c 100644 --- a/lib/SILOptimizer/Transforms/DestroyHoisting.cpp +++ b/lib/SILOptimizer/Transforms/DestroyHoisting.cpp @@ -389,9 +389,9 @@ void DestroyHoisting::getUsedLocationsOfInst(Bits &bits, SILInstruction *I) { case SILInstructionKind::SwitchEnumAddrInst: getUsedLocationsOfOperands(bits, I); break; - case SILInstructionKind::DebugValueAddrInst: + case SILInstructionKind::DebugValueInst: case SILInstructionKind::DestroyAddrInst: - // destroy_addr and debug_value_addr are handled specially. + // destroy_addr and debug_value are handled specially. break; default: break; @@ -446,7 +446,7 @@ void DestroyHoisting::moveDestroys(BitDataflow &dataFlow) { return activeDestroys == dataFlow[P].exitSet; })); - // Delete all destroy_addr and debug_value_addr which are scheduled for + // Delete all destroy_addr and debug_value which are scheduled for // removal. processRemoveList(toRemove); } @@ -481,15 +481,15 @@ void DestroyHoisting::moveDestroysInBlock( if (destroyedLoc >= 0) { activeDestroys.set(destroyedLoc); toRemove.push_back(&I); - } else if (auto *DVA = dyn_cast(&I)) { - // debug_value_addr does not count as real use of a location. If we are - // moving a destroy_addr above a debug_value_addr, just delete that - // debug_value_addr. - auto *dvaLoc = locations.getLocation(DVA->getOperand()); + } else if (auto *DV = DebugValueInst::hasAddrVal(&I)) { + // debug_value w/ address value does not count as real use of a location. + // If we are moving a destroy_addr above a debug_value, just delete that + // debug_value. + auto *dvaLoc = locations.getLocation(DV->getOperand()); if (dvaLoc && locationOverlaps(dvaLoc, activeDestroys)) - toRemove.push_back(DVA); + toRemove.push_back(DV); } else if (I.mayHaveSideEffects()) { - // Delete all destroy_addr and debug_value_addr which are scheduled for + // Delete all destroy_addr and debug_value which are scheduled for // removal. processRemoveList(toRemove); } @@ -505,7 +505,7 @@ void DestroyHoisting::insertDestroys(Bits &toInsert, Bits &activeDestroys, if (toInsert.none()) return; - // The removeList contains destroy_addr (and debug_value_addr) instructions + // The removeList contains destroy_addr (and debug_value) instructions // which we want to delete, but we didn't see any side-effect instructions // since then. There is no value in moving a destroy_addr over side-effect- // free instructions (it could even trigger creating redundant address @@ -522,10 +522,10 @@ void DestroyHoisting::insertDestroys(Bits &toInsert, Bits &activeDestroys, activeDestroys.reset(destroyedLoc); return true; } - if (auto *DVA = dyn_cast(I)) { - // Also keep debug_value_addr instructions, located before a + if (auto *DV = DebugValueInst::hasAddrVal(I)) { + // Also keep debug_value instructions, located before a // destroy_addr which we won't move. - auto *dvaLoc = locations.getLocation(DVA->getOperand()); + auto *dvaLoc = locations.getLocation(DV->getOperand()); if (dvaLoc && dvaLoc->selfAndParents.anyCommon(keepDestroyedLocs)) return true; } diff --git a/lib/SILOptimizer/Transforms/ObjectOutliner.cpp b/lib/SILOptimizer/Transforms/ObjectOutliner.cpp index ac886521ec55c..9f93353ec9c2c 100644 --- a/lib/SILOptimizer/Transforms/ObjectOutliner.cpp +++ b/lib/SILOptimizer/Transforms/ObjectOutliner.cpp @@ -123,7 +123,6 @@ bool ObjectOutliner::isValidUseOfObject(SILInstruction *I, return true; switch (I->getKind()) { - case SILInstructionKind::DebugValueAddrInst: case SILInstructionKind::DebugValueInst: case SILInstructionKind::LoadInst: case SILInstructionKind::DeallocRefInst: diff --git a/lib/SILOptimizer/Transforms/SILMem2Reg.cpp b/lib/SILOptimizer/Transforms/SILMem2Reg.cpp index ed69a84584358..aff1f1a85e650 100644 --- a/lib/SILOptimizer/Transforms/SILMem2Reg.cpp +++ b/lib/SILOptimizer/Transforms/SILMem2Reg.cpp @@ -87,8 +87,8 @@ static void replaceDestroy(DestroyAddrInst *dai, SILValue newValue, deleter.forceDelete(dai); } -/// Promote a DebugValueAddr to a DebugValue of the given value. -static void promoteDebugValueAddr(DebugValueAddrInst *dvai, SILValue value, +/// Promote a DebugValue w/ address value to a DebugValue of non-address value. +static void promoteDebugValueAddr(DebugValueInst *dvai, SILValue value, SILBuilderContext &ctx, InstructionDeleter &deleter) { assert(dvai->getOperand()->getType().isLoadable(*dvai->getFunction()) && @@ -97,15 +97,27 @@ static void promoteDebugValueAddr(DebugValueAddrInst *dvai, SILValue value, // Avoid inserting the same debug_value twice. for (auto *use : value->getUses()) { if (auto *dvi = dyn_cast(use->getUser())) { - if (*dvi->getVarInfo() == *dvai->getVarInfo()) { + // Since we're not comparing di-expression in + // SILDebugVariable::operator==(), it's necessary to distinguish + // debug_value w/ normal values from that with address-type values. + if (!dvi->hasAddrVal() && + *dvi->getVarInfo() == *dvai->getVarInfo()) { deleter.forceDelete(dvai); return; } } } + auto VarInfo = *dvai->getVarInfo(); + // Drop op_deref if dvai is actually a debug_value instruction + if (isa(dvai)) { + auto &DIExpr = VarInfo.DIExpr; + if (DIExpr) + DIExpr.eraseElement(DIExpr.element_begin()); + } + SILBuilderWithScope b(dvai, ctx); - b.createDebugValue(dvai->getLoc(), value, *dvai->getVarInfo()); + b.createDebugValue(dvai->getLoc(), value, std::move(VarInfo)); deleter.forceDelete(dvai); } @@ -418,12 +430,13 @@ StoreInst *StackAllocationPromoter::promoteAllocationInBlock( continue; } - // Replace debug_value_addr with debug_value of the promoted value + // Replace debug_value w/ address value with debug_value of + // the promoted value. // if we have a valid value to use at this point. Otherwise we'll // promote this when we deal with hooking up phis. - if (auto *dvai = dyn_cast(inst)) { - if (dvai->getOperand() == asi && runningVal) - promoteDebugValueAddr(dvai, runningVal, ctx, deleter); + if (auto *dvi = DebugValueInst::hasAddrVal(inst)) { + if (dvi->getOperand() == asi && runningVal) + promoteDebugValueAddr(dvi, runningVal, ctx, deleter); continue; } @@ -623,10 +636,11 @@ void StackAllocationPromoter::fixBranchesAndUses(BlockSetVector &phiBlocks) { // on. SILBasicBlock *userBlock = user->getParent(); - if (auto *dvai = dyn_cast(user)) { - // Replace DebugValueAddr with DebugValue. + if (auto *dvi = DebugValueInst::hasAddrVal(user)) { + // Replace debug_value w/ address-type value with + // a new debug_value w/ promoted value. SILValue def = getLiveInValue(phiBlocks, userBlock); - promoteDebugValueAddr(dvai, def, ctx, deleter); + promoteDebugValueAddr(dvi, def, ctx, deleter); ++NumInstRemoved; continue; } @@ -973,9 +987,9 @@ static bool isCaptured(AllocStackInst *asi, bool &inSingleBlock) { if (si->getDest() == asi) continue; - // Deallocation is also okay, as are DebugValueAddr. We will turn - // the latter into DebugValue. - if (isa(user) || isa(user)) + // Deallocation is also okay, as are DebugValue w/ address value. We will + // promote the latter into normal DebugValue. + if (isa(user) || DebugValueInst::hasAddrVal(user)) continue; // Destroys of loadable types can be rewritten as releases, so @@ -1010,8 +1024,8 @@ bool MemoryToRegisters::isWriteOnlyAllocation(AllocStackInst *asi) { continue; // If we haven't already promoted the AllocStack, we may see - // DebugValueAddr uses. - if (isa(user)) + // DebugValue uses. + if (DebugValueInst::hasAddrVal(user)) continue; if (isDeadAddrProjection(user)) @@ -1068,16 +1082,17 @@ void MemoryToRegisters::removeSingleBlockAllocation(AllocStackInst *asi) { } } - // Replace debug_value_addr with debug_value of the promoted value. - if (auto *dvai = dyn_cast(inst)) { - if (dvai->getOperand() == asi) { + // Replace debug_value w/ address value with debug_value of + // the promoted value. + if (auto *dvi = DebugValueInst::hasAddrVal(inst)) { + if (dvi->getOperand() == asi) { if (runningVal) { - promoteDebugValueAddr(dvai, runningVal, ctx, deleter); + promoteDebugValueAddr(dvi, runningVal, ctx, deleter); } else { - // Drop debug_value_addr of uninitialized void values. + // Drop debug_value of uninitialized void values. assert(asi->getElementType().isVoid() && "Expected initialization of non-void type!"); - deleter.forceDelete(dvai); + deleter.forceDelete(dvi); } } continue; diff --git a/lib/SILOptimizer/Transforms/StringOptimization.cpp b/lib/SILOptimizer/Transforms/StringOptimization.cpp index b610a855b4e26..bfc2fdc8611f5 100644 --- a/lib/SILOptimizer/Transforms/StringOptimization.cpp +++ b/lib/SILOptimizer/Transforms/StringOptimization.cpp @@ -437,10 +437,13 @@ isStringStoreToIdentifyableObject(SILInstruction *inst) { switch (user->getKind()) { // Those instructions do not write to destAddr nor let they destAddr // escape. - case SILInstructionKind::DebugValueAddrInst: case SILInstructionKind::DeallocStackInst: case SILInstructionKind::LoadInst: break; + case SILInstructionKind::DebugValueInst: + if (DebugValueInst::hasAddrVal(user)) + break; + LLVM_FALLTHROUGH; default: if (!mayWriteToIdentifyableObject(user)) { // We don't handle user. It is some instruction which may write to diff --git a/lib/SILOptimizer/Transforms/TempLValueOpt.cpp b/lib/SILOptimizer/Transforms/TempLValueOpt.cpp index 26c41f8940543..59a358dcfb983 100644 --- a/lib/SILOptimizer/Transforms/TempLValueOpt.cpp +++ b/lib/SILOptimizer/Transforms/TempLValueOpt.cpp @@ -273,21 +273,21 @@ void TempLValueOptPass::combineCopyAndDestroy(CopyAddrInst *copyInst) { // Check if the destroy_addr is after the copy_addr and if there are no // memory accesses between them. - SmallVector debugInsts; + SmallVector debugInsts; for (auto iter = std::next(copyInst->getIterator()); iter != block->end(); ++iter) { SILInstruction *inst = &*iter; if (inst == destroy) { copyInst->setIsTakeOfSrc(IsTake); destroy->eraseFromParent(); - // Cleanup all debug_value_addr of the copy src btw the copy and destroy + // Cleanup all debug_value of the copy src btw the copy and destroy for (auto debugInst : debugInsts) { debugInst->eraseFromParent(); } invalidateAnalysis(SILAnalysis::InvalidationKind::Instructions); return; } - if (auto *debugInst = dyn_cast(inst)) { + if(auto *debugInst = DebugValueInst::hasAddrVal(inst)) { if (debugInst->getOperand() == copyInst->getSrc()) debugInsts.push_back(debugInst); } diff --git a/lib/SILOptimizer/Transforms/UnsafeGuaranteedPeephole.cpp b/lib/SILOptimizer/Transforms/UnsafeGuaranteedPeephole.cpp index aa2de64bc4c8b..25a3e25af7d3e 100644 --- a/lib/SILOptimizer/Transforms/UnsafeGuaranteedPeephole.cpp +++ b/lib/SILOptimizer/Transforms/UnsafeGuaranteedPeephole.cpp @@ -72,7 +72,7 @@ static void tryRemoveRetainReleasePairsBetween( if (!CurInst->mayHaveSideEffects()) continue; - if (isa(CurInst) || isa(CurInst)) + if (isa(CurInst)) continue; if (isa(CurInst) || isa(CurInst)) @@ -140,8 +140,7 @@ static bool removeGuaranteedRetainReleasePairs(SILFunction &F, (isa(*NextInstIter) || isa(*NextInstIter) || !NextInstIter->mayHaveSideEffects() || - isa(*NextInstIter) || - isa(*NextInstIter))) + isa(*NextInstIter))) ++NextInstIter; if (&*NextInstIter != CurInst) { LLVM_DEBUG(llvm::dbgs() << "Last retain right before match failed\n"); diff --git a/lib/SILOptimizer/UtilityPasses/SILDebugInfoGenerator.cpp b/lib/SILOptimizer/UtilityPasses/SILDebugInfoGenerator.cpp index 78242b8e2a42c..cb3a4d861903f 100644 --- a/lib/SILOptimizer/UtilityPasses/SILDebugInfoGenerator.cpp +++ b/lib/SILOptimizer/UtilityPasses/SILDebugInfoGenerator.cpp @@ -144,8 +144,8 @@ class SILDebugInfoGenerator : public SILModuleTransform { for (auto iter = BB.begin(), end = BB.end(); iter != end;) { SILInstruction *I = &*iter; ++iter; - if (isa(I) || isa(I)) { - // debug_value and debug_value_addr are not needed anymore. + if (isa(I)) { + // debug_value instructions are not needed anymore. // Also, keeping them might trigger a verifier error. I->eraseFromParent(); continue; diff --git a/lib/SILOptimizer/UtilityPasses/SerializeSILPass.cpp b/lib/SILOptimizer/UtilityPasses/SerializeSILPass.cpp index 1eb2ac4f5f93e..e9a41c5041815 100644 --- a/lib/SILOptimizer/UtilityPasses/SerializeSILPass.cpp +++ b/lib/SILOptimizer/UtilityPasses/SerializeSILPass.cpp @@ -310,7 +310,6 @@ static bool hasOpaqueArchetype(TypeExpansionContext context, case SILInstructionKind::AssignByWrapperInst: case SILInstructionKind::MarkFunctionEscapeInst: case SILInstructionKind::DebugValueInst: - case SILInstructionKind::DebugValueAddrInst: #define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \ case SILInstructionKind::Store##Name##Inst: #include "swift/AST/ReferenceStorage.def" diff --git a/lib/SILOptimizer/UtilityPasses/StripDebugInfo.cpp b/lib/SILOptimizer/UtilityPasses/StripDebugInfo.cpp index f8d45fda8c30b..b5ee98e2c8713 100644 --- a/lib/SILOptimizer/UtilityPasses/StripDebugInfo.cpp +++ b/lib/SILOptimizer/UtilityPasses/StripDebugInfo.cpp @@ -25,8 +25,7 @@ static void stripFunction(SILFunction *F) { SILInstruction *Inst = &*II; ++II; - if (!isa(Inst) && - !isa(Inst)) + if (!isa(Inst)) continue; Inst->eraseFromParent(); diff --git a/lib/SILOptimizer/Utils/ConstExpr.cpp b/lib/SILOptimizer/Utils/ConstExpr.cpp index d76242be0deae..f1af21bf1ed5c 100644 --- a/lib/SILOptimizer/Utils/ConstExpr.cpp +++ b/lib/SILOptimizer/Utils/ConstExpr.cpp @@ -1422,7 +1422,7 @@ ConstExprFunctionState::initializeAddressFromSingleWriter(SILValue addr) { // Ignore markers, loads, and other things that aren't stores to this stack // value. if (isa(user) || isa(user) || - isa(user) || isa(user)) + isa(user) || DebugValueInst::hasAddrVal(user)) continue; // TODO: Allow BeginAccess/EndAccess users. @@ -1737,8 +1737,7 @@ llvm::Optional ConstExprFunctionState::evaluateClosureCreation( llvm::Optional ConstExprFunctionState::evaluateFlowSensitive(SILInstruction *inst) { // These are just markers. - if (isa(inst) || isa(inst) || - isa(inst) || + if (isa(inst) || isa(inst) || // The interpreter doesn't model these memory management instructions, so // skip them. isa(inst) || isa(inst) || diff --git a/lib/SILOptimizer/Utils/Existential.cpp b/lib/SILOptimizer/Utils/Existential.cpp index 7906c793ff657..32e8de0cd63e1 100644 --- a/lib/SILOptimizer/Utils/Existential.cpp +++ b/lib/SILOptimizer/Utils/Existential.cpp @@ -86,7 +86,8 @@ static SILInstruction *getStackInitInst(SILValue allocStackAddr, // Ignore instructions which don't write to the stack location. // Also ignore ASIUser (only kicks in if ASIUser is the original apply). - if (isa(User) || isa(User) || + if (isa(User) || + DebugValueInst::hasAddrVal(User) || isa(User) || isa(User) || isa(User) || isa(User) || User == ASIUser) { diff --git a/lib/SILOptimizer/Utils/GenericCloner.cpp b/lib/SILOptimizer/Utils/GenericCloner.cpp index 57dc9cc1f1743..b625ddf2de2e7 100644 --- a/lib/SILOptimizer/Utils/GenericCloner.cpp +++ b/lib/SILOptimizer/Utils/GenericCloner.cpp @@ -111,17 +111,21 @@ void GenericCloner::populateCloned() { auto *NewArg = ClonedEntryBB->createFunctionArgument( mappedType, OrigArg->getDecl()); - // Try to create a new debug_value from an existing debug_value_addr - // for the argument. We do this before storing to ensure that when we - // are cloning code in ossa the argument has not been consumed by the - // store below. + // Try to create a new debug_value from an existing debug_value w/ + // address value for the argument. We do this before storing to + // ensure that when we are cloning code in ossa the argument has + // not been consumed by the store below. for (Operand *ArgUse : OrigArg->getUses()) { - if (auto *DVAI = dyn_cast(ArgUse->getUser())) { + if (auto *DVI = DebugValueInst::hasAddrVal(ArgUse->getUser())) { auto *oldScope = getBuilder().getCurrentDebugScope(); getBuilder().setCurrentDebugScope( - remapScope(DVAI->getDebugScope())); - getBuilder().createDebugValue(DVAI->getLoc(), NewArg, - *DVAI->getVarInfo()); + remapScope(DVI->getDebugScope())); + auto VarInfo = DVI->getVarInfo(); + assert(VarInfo && VarInfo->DIExpr && + "No DebugVarInfo or no DIExpr operand?"); + // Drop the op_deref + VarInfo->DIExpr.eraseElement(VarInfo->DIExpr.element_begin()); + getBuilder().createDebugValue(DVI->getLoc(), NewArg, *VarInfo); getBuilder().setCurrentDebugScope(oldScope); break; } diff --git a/lib/SILOptimizer/Utils/InstOptUtils.cpp b/lib/SILOptimizer/Utils/InstOptUtils.cpp index baee3deb4115b..e6e861bb64bb6 100644 --- a/lib/SILOptimizer/Utils/InstOptUtils.cpp +++ b/lib/SILOptimizer/Utils/InstOptUtils.cpp @@ -158,7 +158,7 @@ bool swift::isInstructionTriviallyDead(SILInstruction *inst) { if (isa(inst)) return false; - if (isa(inst) || isa(inst)) + if (isa(inst)) return false; // These invalidate enums so "write" memory, but that is not an essential @@ -756,9 +756,14 @@ getConcreteValueOfExistentialBoxAddr(SILValue addr, SILInstruction *ignoreUser) break; } case SILInstructionKind::DeallocStackInst: - case SILInstructionKind::DebugValueAddrInst: case SILInstructionKind::LoadInst: break; + case SILInstructionKind::DebugValueInst: + if (!DebugValueInst::hasAddrVal(stackUser)) { + if (stackUser != ignoreUser) + return SILValue(); + } + break; case SILInstructionKind::StoreInst: { auto *store = cast(stackUser); assert(store->getSrc() != stackLoc && "cannot store an address"); diff --git a/lib/SILOptimizer/Utils/SILInliner.cpp b/lib/SILOptimizer/Utils/SILInliner.cpp index b461593d2c4ee..db61a48e40034 100644 --- a/lib/SILOptimizer/Utils/SILInliner.cpp +++ b/lib/SILOptimizer/Utils/SILInliner.cpp @@ -286,7 +286,6 @@ class SILInlineCloner SILValue borrowFunctionArgument(SILValue callArg, FullApplySite AI); void visitDebugValueInst(DebugValueInst *Inst); - void visitDebugValueAddrInst(DebugValueAddrInst *Inst); void visitHopToExecutorInst(HopToExecutorInst *Inst); void visitTerminator(SILBasicBlock *BB); @@ -613,13 +612,6 @@ void SILInlineCloner::visitDebugValueInst(DebugValueInst *Inst) { return SILCloner::visitDebugValueInst(Inst); } -void SILInlineCloner::visitDebugValueAddrInst(DebugValueAddrInst *Inst) { - // The mandatory inliner drops debug_value_addr instructions when inlining, as - // if it were a "nodebug" function in C. - if (IKind == InlineKind::MandatoryInline) return; - - return SILCloner::visitDebugValueAddrInst(Inst); -} void SILInlineCloner::visitHopToExecutorInst(HopToExecutorInst *Inst) { // Drop hop_to_executor in non async functions. if (!Apply.getFunction()->isAsync()) { @@ -681,7 +673,6 @@ InlineCost swift::instructionInlineCost(SILInstruction &I) { case SILInstructionKind::IntegerLiteralInst: case SILInstructionKind::FloatLiteralInst: case SILInstructionKind::DebugValueInst: - case SILInstructionKind::DebugValueAddrInst: case SILInstructionKind::StringLiteralInst: case SILInstructionKind::FixLifetimeInst: case SILInstructionKind::EndBorrowInst: diff --git a/lib/Serialization/DeserializeSIL.cpp b/lib/Serialization/DeserializeSIL.cpp index c7957932a89d5..234a4e0e2a91f 100644 --- a/lib/Serialization/DeserializeSIL.cpp +++ b/lib/Serialization/DeserializeSIL.cpp @@ -1196,7 +1196,6 @@ bool SILDeserializer::readSILInstruction(SILFunction *Fn, SILInstruction *ResultInst; switch (OpCode) { case SILInstructionKind::DebugValueInst: - case SILInstructionKind::DebugValueAddrInst: llvm_unreachable("not supported"); case SILInstructionKind::AllocBoxInst: diff --git a/lib/Serialization/SerializeSIL.cpp b/lib/Serialization/SerializeSIL.cpp index 8ae47126ba5b8..c0f049ffb21a5 100644 --- a/lib/Serialization/SerializeSIL.cpp +++ b/lib/Serialization/SerializeSIL.cpp @@ -802,12 +802,11 @@ void SILSerializer::writeSILInstruction(const SILInstruction &SI) { } case SILInstructionKind::DebugValueInst: - case SILInstructionKind::DebugValueAddrInst: // Currently we don't serialize debug variable infos, so it doesn't make // sense to write the instruction at all. // TODO: decide if we want to serialize those instructions. return; - + case SILInstructionKind::UnwindInst: case SILInstructionKind::UnreachableInst: { writeNoOperandLayout(&SI); diff --git a/libswift/Sources/SIL/Instruction.swift b/libswift/Sources/SIL/Instruction.swift index 9107748b295fc..fd2979277809a 100644 --- a/libswift/Sources/SIL/Instruction.swift +++ b/libswift/Sources/SIL/Instruction.swift @@ -217,8 +217,6 @@ final public class FixLifetimeInst : Instruction, UnaryInstruction {} final public class DebugValueInst : Instruction, UnaryInstruction {} -final public class DebugValueAddrInst : Instruction, UnaryInstruction {} - final public class UnconditionalCheckedCastAddrInst : Instruction { public override var mayTrap: Bool { true } } diff --git a/libswift/Sources/SIL/Registration.swift b/libswift/Sources/SIL/Registration.swift index 1011106c21d7a..d0a09e4ac117a 100644 --- a/libswift/Sources/SIL/Registration.swift +++ b/libswift/Sources/SIL/Registration.swift @@ -45,7 +45,6 @@ public func registerSILClasses() { register(CondFailInst.self) register(FixLifetimeInst.self) register(DebugValueInst.self) - register(DebugValueAddrInst.self) register(UnconditionalCheckedCastAddrInst.self) register(SetDeallocatingInst.self) register(DeallocRefInst.self) diff --git a/test/DebugInfo/debug_info_expression.sil b/test/DebugInfo/debug_info_expression.sil index 3cd50a2b33b68..c7104f045545a 100644 --- a/test/DebugInfo/debug_info_expression.sil +++ b/test/DebugInfo/debug_info_expression.sil @@ -24,10 +24,10 @@ bb0: // CHECK: llvm.dbg.declare(metadata {{.*}}* %[[SMALL_STRUCT]], metadata ![[SMALL_VAR_DECL_MD:[0-9]+]] %3 = struct_element_addr %2 : $*MyStruct, #MyStruct.x, loc "file.swift":9:17, scope 1 // CHECK: %[[FIELD_X:.*]] = getelementptr {{.*}} %[[MY_STRUCT]] - // CHECK-SIL: debug_value_addr %{{[0-9]+}} : $*Builtin.Int64 - // CHECK-SIL-SAME: (name "my_struct", loc "file.swift":8:9, scope {{[0-9]+}}) - // CHECK-SIL-SAME type $MyStruct, expr op_fragment:#MyStruct.x - debug_value_addr %3 : $*Builtin.Int64, var, (name "my_struct", loc "file.swift":8:9, scope 1), type $MyStruct, expr op_fragment:#MyStruct.x, loc "file.swift":9:17, scope 1 + // CHECK-SIL: debug_value %{{[0-9]+}} : $*Builtin.Int64 + // CHECK-SIL-SAME: (name "my_struct", loc "file.swift":8:9, scope {{[0-9]+}}) + // CHECK-SIL-SAME type $MyStruct, expr op_deref:op_fragment:#MyStruct.x + debug_value %3 : $*Builtin.Int64, var, (name "my_struct", loc "file.swift":8:9, scope 1), type $MyStruct, expr op_deref:op_fragment:#MyStruct.x, loc "file.swift":9:17, scope 1 // CHECK: llvm.dbg.value(metadata {{.*}}* %[[FIELD_X]], metadata ![[VAR_DECL_MD]] // CHECK-SAME: !DIExpression(DW_OP_deref, DW_OP_LLVM_fragment, 0, 64) // CHECK-NOT: ), !dbg ![[VAR_DECL_MD]] @@ -39,7 +39,7 @@ bb0: // DW_OP_LLVM_fragment part. // CHECK: llvm.dbg.value(metadata {{.*}}* %[[FIELD_Z]], metadata ![[SMALL_VAR_DECL_MD]] // CHECK-SAME: !DIExpression(DW_OP_deref) - debug_value_addr %5 : $*Builtin.Int64, var, (name "small_struct", loc "file.swift":10:11, scope 1), type $SmallStruct, expr op_fragment:#SmallStruct.z, loc "file.swift":11:13, scope 1 + debug_value %5 : $*Builtin.Int64, var, (name "small_struct", loc "file.swift":10:11, scope 1), type $SmallStruct, expr op_deref:op_fragment:#SmallStruct.z, loc "file.swift":11:13, scope 1 dealloc_stack %4 : $*SmallStruct dealloc_stack %2 : $*MyStruct diff --git a/test/DebugInfo/debug_value_addr.swift b/test/DebugInfo/debug_value_addr.swift index 896d8aa23301a..1d6ac143fd080 100644 --- a/test/DebugInfo/debug_value_addr.swift +++ b/test/DebugInfo/debug_value_addr.swift @@ -5,7 +5,7 @@ // instructions. // CHECK-SIL: sil hidden @$s16debug_value_addr4testyyxlF -// CHECK-SIL: debug_value_addr %0 : $*T, let, name "t" +// CHECK-SIL: debug_value %0 : $*T, let, name "t", {{.*}}, expr op_deref // CHECK: define {{.*}}$s16debug_value_addr4testyyxlF // CHECK: entry: diff --git a/test/DebugInfo/inlined-generics-basic.swift b/test/DebugInfo/inlined-generics-basic.swift index 886af072df2fd..b1d50a588f7e3 100644 --- a/test/DebugInfo/inlined-generics-basic.swift +++ b/test/DebugInfo/inlined-generics-basic.swift @@ -44,7 +44,7 @@ public class C { // IR-LABEL: define {{.*}} @"$s1A1CC1fyyqd__lF" #sourceLocation(file: "f.swift", line: 1) public func f(_ s: S) { - // SIL: debug_value_addr %0 : $*S, let, name "s", argno 1,{{.*}} scope [[F]] + // SIL: debug_value %0 : $*S, let, name "s", argno 1, expr op_deref, {{.*}} scope [[F]] // SIL: function_ref {{.*}}yes{{.*}} scope [[F1G1]] // SIL: function_ref {{.*}}use{{.*}} scope [[F1G3H]] // IR: dbg.value(metadata %swift.type* %S, metadata ![[MD_1_0:[0-9]+]] diff --git a/test/DebugInfo/verifier_debug_info_expression.sil b/test/DebugInfo/verifier_debug_info_expression.sil index 35f111563be3b..a5ccaf229e472 100644 --- a/test/DebugInfo/verifier_debug_info_expression.sil +++ b/test/DebugInfo/verifier_debug_info_expression.sil @@ -14,7 +14,7 @@ bb0: %2 = alloc_stack $MyStruct, var, name "my_struct", loc "file.swift":8:9, scope 1 %3 = struct_element_addr %2 : $*MyStruct, #MyStruct.x, loc "file.swift":9:17, scope 1 // every op_fragment should be the last di-expression operand - debug_value_addr %3 : $*Builtin.Int64, var, name "my_struct", expr op_fragment:#MyStruct.y:op_fragment:#MyStruct.x + debug_value %3 : $*Builtin.Int64, var, name "my_struct", expr op_deref:op_fragment:#MyStruct.y:op_fragment:#MyStruct.x dealloc_stack %2 : $*MyStruct %r = tuple() return %r : $() diff --git a/test/IRGen/big_types_corner_cases.swift b/test/IRGen/big_types_corner_cases.swift index 9e47d80cfefbe..786eede225e47 100644 --- a/test/IRGen/big_types_corner_cases.swift +++ b/test/IRGen/big_types_corner_cases.swift @@ -168,7 +168,7 @@ class SuperSub : SuperBase { // CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @"$s22big_types_corner_cases10MUseStructV16superclassMirrorAA03BigF0VSgvg"(%T22big_types_corner_cases9BigStructVSg* noalias nocapture sret({{.*}}) %0, %T22big_types_corner_cases10MUseStructV* noalias nocapture swiftself dereferenceable({{.*}}) %1) // CHECK: [[ALLOC:%.*]] = alloca %T22big_types_corner_cases9BigStructVSg // CHECK: [[LOAD:%.*]] = load %swift.refcounted*, %swift.refcounted** %.callInternalLet.data -// CHECK: call swiftcc void %7(%T22big_types_corner_cases9BigStructVSg* noalias nocapture sret({{.*}}) [[ALLOC]], %swift.refcounted* swiftself [[LOAD]]) +// CHECK: call swiftcc void %{{[0-9]+}}(%T22big_types_corner_cases9BigStructVSg* noalias nocapture sret({{.*}}) [[ALLOC]], %swift.refcounted* swiftself [[LOAD]]) // CHECK: ret void public struct MUseStruct { var x = BigStruct() diff --git a/test/IRGen/builtins.swift b/test/IRGen/builtins.swift index cec90dbf12e72..e7e35cb788a54 100644 --- a/test/IRGen/builtins.swift +++ b/test/IRGen/builtins.swift @@ -635,10 +635,10 @@ func acceptsBuiltinNativeObject(_ ref: inout Builtin.NativeObject?) {} // native // CHECK-LABEL: define hidden {{.*}}i1 @"$s8builtins8isUniqueyBi1_BoSgzF"({{%.*}}* nocapture dereferenceable({{.*}}) %0) {{.*}} { // CHECK-NEXT: entry: -// CHECK-NEXT: bitcast [[BUILTIN_NATIVE_OBJECT_TY]]* %0 to %swift.refcounted** -// CHECK-NEXT: load %swift.refcounted*, %swift.refcounted** %1 -// CHECK-NEXT: call i1 @swift_isUniquelyReferenced_native(%swift.refcounted* %2) -// CHECK-NEXT: ret i1 %3 +// CHECK: %[[BITCAST_RC:.+]] = bitcast [[BUILTIN_NATIVE_OBJECT_TY]]* %0 to %swift.refcounted** +// CHECK: %[[LD_RC:.+]] = load %swift.refcounted*, %swift.refcounted** %[[BITCAST_RC]] +// CHECK-NEXT: %[[RET:.+]] = call i1 @swift_isUniquelyReferenced_native(%swift.refcounted* %[[LD_RC]]) +// CHECK-NEXT: ret i1 %[[RET]] func isUnique(_ ref: inout Builtin.NativeObject?) -> Bool { return Builtin.isUnique(&ref) } @@ -646,9 +646,9 @@ func isUnique(_ ref: inout Builtin.NativeObject?) -> Bool { // native nonNull // CHECK-LABEL: define hidden {{.*}}i1 @"$s8builtins8isUniqueyBi1_BozF"(%swift.refcounted** nocapture dereferenceable({{.*}}) %0) {{.*}} { // CHECK-NEXT: entry: -// CHECK-NEXT: load %swift.refcounted*, %swift.refcounted** %0 -// CHECK-NEXT: call i1 @swift_isUniquelyReferenced_nonNull_native(%swift.refcounted* %1) -// CHECK-NEXT: ret i1 %2 +// CHECK: %[[LD_RC:.+]] = load %swift.refcounted*, %swift.refcounted** %0 +// CHECK: %[[RET:.+]] = call i1 @swift_isUniquelyReferenced_nonNull_native(%swift.refcounted* %[[LD_RC]]) +// CHECK-NEXT: ret i1 %[[RET]] func isUnique(_ ref: inout Builtin.NativeObject) -> Bool { return Builtin.isUnique(&ref) } @@ -659,7 +659,7 @@ func acceptsAnyObject(_ ref: inout Builtin.AnyObject?) {} // ObjC // CHECK-LABEL: define hidden {{.*}}i1 @"$s8builtins8isUniqueyBi1_yXlSgzF"({{%.*}}* nocapture dereferenceable({{.*}}) %0) {{.*}} { // CHECK-NEXT: entry: -// CHECK-NEXT: [[ADDR:%.+]] = getelementptr inbounds [[OPTIONAL_ANYOBJECT_TY]], [[OPTIONAL_ANYOBJECT_TY]]* %0, i32 0, i32 0 +// CHECK: [[ADDR:%.+]] = getelementptr inbounds [[OPTIONAL_ANYOBJECT_TY]], [[OPTIONAL_ANYOBJECT_TY]]* %0, i32 0, i32 0 // CHECK-NEXT: [[CASTED:%.+]] = bitcast {{.+}}* [[ADDR]] to [[UNKNOWN_OBJECT:%objc_object|%swift\.refcounted]]** // CHECK-NEXT: [[REF:%.+]] = load [[UNKNOWN_OBJECT]]*, [[UNKNOWN_OBJECT]]** [[CASTED]] // CHECK-objc-NEXT: [[RESULT:%.+]] = call i1 @swift_isUniquelyReferenced{{(NonObjC)?}}([[UNKNOWN_OBJECT]]* [[REF]]) @@ -673,8 +673,8 @@ func isUnique(_ ref: inout Builtin.AnyObject?) -> Bool { // CHECK-LABEL: define hidden {{.*}}i1 @"$s8builtins8isUniqueyBi1_yXlzF" // CHECK-SAME: (%AnyObject* nocapture dereferenceable({{.*}}) %0) {{.*}} { // CHECK-NEXT: entry: -// CHECK-NEXT: [[ADDR:%.+]] = getelementptr inbounds %AnyObject, %AnyObject* %0, i32 0, i32 0 -// CHECK-NEXT: [[REF:%.+]] = load [[UNKNOWN_OBJECT]]*, [[UNKNOWN_OBJECT]]** [[ADDR]] +// CHECK: [[ADDR:%.+]] = getelementptr inbounds %AnyObject, %AnyObject* %0, i32 0, i32 0 +// CHECK: [[REF:%.+]] = load [[UNKNOWN_OBJECT]]*, [[UNKNOWN_OBJECT]]** [[ADDR]] // CHECK-objc-NEXT: [[RESULT:%.+]] = call i1 @swift_isUniquelyReferenced{{(NonObjC)?}}_nonNull([[UNKNOWN_OBJECT]]* [[REF]]) // CHECK-native-NEXT: [[RESULT:%.+]] = call i1 @swift_isUniquelyReferenced_nonNull_native([[UNKNOWN_OBJECT]]* [[REF]]) // CHECK-NEXT: ret i1 [[RESULT]] @@ -685,9 +685,9 @@ func isUnique(_ ref: inout Builtin.AnyObject) -> Bool { // BridgeObject nonNull // CHECK-LABEL: define hidden {{.*}}i1 @"$s8builtins8isUniqueyBi1_BbzF"(%swift.bridge** nocapture dereferenceable({{.*}}) %0) {{.*}} { // CHECK-NEXT: entry: -// CHECK-NEXT: load %swift.bridge*, %swift.bridge** %0 -// CHECK-NEXT: call i1 @swift_isUniquelyReferenced{{(NonObjC)?}}_nonNull_bridgeObject(%swift.bridge* %1) -// CHECK-NEXT: ret i1 %2 +// CHECK: %[[LD:.+]] = load %swift.bridge*, %swift.bridge** %0 +// CHECK: %[[RET:.+]] = call i1 @swift_isUniquelyReferenced{{(NonObjC)?}}_nonNull_bridgeObject(%swift.bridge* %[[LD]]) +// CHECK-NEXT: ret i1 %[[RET]] func isUnique(_ ref: inout Builtin.BridgeObject) -> Bool { return Builtin.isUnique(&ref) } @@ -701,10 +701,10 @@ func assumeTrue(_ x: Builtin.Int1) { // BridgeObject nonNull // CHECK-LABEL: define hidden {{.*}}i1 @"$s8builtins15isUnique_nativeyBi1_BbzF"(%swift.bridge** nocapture dereferenceable({{.*}}) %0) {{.*}} { // CHECK-NEXT: entry: -// CHECK-NEXT: bitcast %swift.bridge** %0 to %swift.refcounted** -// CHECK-NEXT: load %swift.refcounted*, %swift.refcounted** %1 -// CHECK-NEXT: call i1 @swift_isUniquelyReferenced_nonNull_native(%swift.refcounted* %2) -// CHECK-NEXT: ret i1 %3 +// CHECK: %[[BC:.+]] = bitcast %swift.bridge** %0 to %swift.refcounted** +// CHECK: %[[LD:.+]] = load %swift.refcounted*, %swift.refcounted** %[[BC]] +// CHECK-NEXT: %[[RET:.+]] = call i1 @swift_isUniquelyReferenced_nonNull_native(%swift.refcounted* %[[LD]]) +// CHECK-NEXT: ret i1 %[[RET]] func isUnique_native(_ ref: inout Builtin.BridgeObject) -> Bool { return Builtin.isUnique_native(&ref) } diff --git a/test/IRGen/dynamic_self.sil b/test/IRGen/dynamic_self.sil index 27d0e04d7b82a..551be825b98bc 100644 --- a/test/IRGen/dynamic_self.sil +++ b/test/IRGen/dynamic_self.sil @@ -14,7 +14,7 @@ protocol P { // CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @_TF12dynamic_self23testExistentialDispatchFT1pPS_1P__T_ sil @_TF12dynamic_self23testExistentialDispatchFT1pPS_1P__T_ : $@convention(thin) (@in P) -> () { bb0(%0 : $*P): - debug_value_addr %0 : $*P, let, name "p" // id: %1 + debug_value %0 : $*P, let, name "p", expr op_deref // id: %1 %2 = alloc_stack $P // users: %3, %4, %12 copy_addr %0 to [initialization] %2 : $*P // id: %3 // CHECK: call %swift.opaque* diff --git a/test/IRGen/enum_resilience.swift b/test/IRGen/enum_resilience.swift index 7ea8f243f6531..7c27e4021c2ef 100644 --- a/test/IRGen/enum_resilience.swift +++ b/test/IRGen/enum_resilience.swift @@ -165,7 +165,7 @@ public func constructResilientEnumPayload(_ s: Size) -> Medium { // CHECK-NEXT: call void @llvm.lifetime.start.p0i8({{(i32|i64)}} -1, i8* [[ALLOCA]]) // CHECK-NEXT: [[ENUM_STORAGE:%.*]] = bitcast i8* [[ALLOCA]] to %swift.opaque* -// CHECK-NEXT: [[WITNESS_ADDR:%.*]] = getelementptr inbounds i8*, i8** [[VWT]], i32 2 +// CHECK: [[WITNESS_ADDR:%.*]] = getelementptr inbounds i8*, i8** [[VWT]], i32 2 // CHECK-NEXT: [[WITNESS:%.*]] = load i8*, i8** [[WITNESS_ADDR]] // CHECK-NEXT: [[WITNESS_FN:%initializeWithCopy]] = bitcast i8* [[WITNESS]] to %swift.opaque* (%swift.opaque*, %swift.opaque*, %swift.type*)* // CHECK-arm64e-NEXT: ptrtoint i8** [[WITNESS_ADDR]] to i64 diff --git a/test/IRGen/frozen_protocols.swift b/test/IRGen/frozen_protocols.swift index 42b997b9c4b72..e3de260859d3f 100644 --- a/test/IRGen/frozen_protocols.swift +++ b/test/IRGen/frozen_protocols.swift @@ -43,7 +43,7 @@ public struct ConformsToFrozenProtocol : FrozenProtocol { // CHECK: [[ADDR:%.*]] = getelementptr inbounds i8*, i8** %T.OtherFrozenProtocol, i32 1 // CHECK: [[FN:%.*]] = load i8*, i8** [[ADDR]] // CHECK: [[CAST:%.*]] = bitcast i8* [[FN]] to void (%swift.opaque*, %swift.type*, i8**)* -// CHECK: call swiftcc void %3(%swift.opaque* noalias nocapture swiftself %0, %swift.type* %T, i8** %T.OtherFrozenProtocol) +// CHECK: call swiftcc void [[CAST]](%swift.opaque* noalias nocapture swiftself %0, %swift.type* %T, i8** %T.OtherFrozenProtocol) // CHECK: ret void // @_fixed_layout protocols still emit method dispatch thunks though, which diff --git a/test/IRGen/generic_tuples.swift b/test/IRGen/generic_tuples.swift index 647ecfdf0d7bc..9d3a8037b9a32 100644 --- a/test/IRGen/generic_tuples.swift +++ b/test/IRGen/generic_tuples.swift @@ -25,7 +25,7 @@ func dup(_ x: T) -> (T, T) { var x = x; return (x,x) } // CHECK: [[X_TMP:%.*]] = bitcast i8* [[X_ALLOCA]] to %swift.opaque* // Debug info shadow copy. // CHECK-NEXT: store i8* [[X_ALLOCA]] -// CHECK-NEXT: [[WITNESS_ADDR:%.*]] = getelementptr inbounds i8*, i8** [[VWT]], i32 2 +// CHECK: [[WITNESS_ADDR:%.*]] = getelementptr inbounds i8*, i8** [[VWT]], i32 2 // CHECK-NEXT: [[WITNESS:%.*]] = load i8*, i8** [[WITNESS_ADDR]], align 8 // CHECK-NEXT: [[INITIALIZE_WITH_COPY:%.*]] = bitcast i8* [[WITNESS]] to [[OPAQUE]]* ([[OPAQUE]]*, [[OPAQUE]]*, [[TYPE]]*)* // CHECK-NEXT: [[X:%.*]] = call [[OPAQUE]]* [[INITIALIZE_WITH_COPY]]([[OPAQUE]]* noalias [[X_TMP]], [[OPAQUE]]* noalias {{.*}}, [[TYPE]]* %T) diff --git a/test/IRGen/partial_apply_run_generic_method1.sil b/test/IRGen/partial_apply_run_generic_method1.sil index d58a7bd1b1117..3e4d594ea53d6 100644 --- a/test/IRGen/partial_apply_run_generic_method1.sil +++ b/test/IRGen/partial_apply_run_generic_method1.sil @@ -61,7 +61,7 @@ sil hidden [ossa] @generic_function : $@convention(method) (@in_guaranteed T bb0(%0 : $*T, %1 : $*T, %2 : @guaranteed $C): - debug_value_addr %1 : $*T, let, name "t", argno 1 + debug_value %1 : $*T, let, name "t", argno 1 , expr op_deref debug_value %2 : $C, let, name "self", argno 2 copy_addr %1 to [initialization] %0 : $*T %6 = tuple () diff --git a/test/IRGen/protocol_extensions.sil b/test/IRGen/protocol_extensions.sil index 0433471d7a0dd..1315d4dcf32a9 100644 --- a/test/IRGen/protocol_extensions.sil +++ b/test/IRGen/protocol_extensions.sil @@ -16,7 +16,7 @@ extension P1 { // CHECK-LABEL: define hidden swiftcc void @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_ sil hidden @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_ : $@convention(method) (@in Self) -> () { bb0(%0 : $*Self): - debug_value_addr %0 : $*Self, let, name "self" // id: %1 + debug_value %0 : $*Self, let, name "self", expr op_deref // id: %1 %2 = witness_method $Self, #P1.reqP1a : $@convention(witness_method: P1) <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> () // user: %3 %3 = apply %2(%0) : $@convention(witness_method: P1) <τ_0_0 where τ_0_0 : P1> (@in_guaranteed τ_0_0) -> () destroy_addr %0 : $*Self // id: %4 @@ -27,7 +27,7 @@ bb0(%0 : $*Self): // CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @_TFP19protocol_extensions2P16extP1bUS0___fQPS0_FT_T_ sil @_TFP19protocol_extensions2P16extP1bUS0___fQPS0_FT_T_ : $@convention(method) (@in Self) -> () { bb0(%0 : $*Self): - debug_value_addr %0 : $*Self, let, name "self" // id: %1 + debug_value %0 : $*Self, let, name "self", expr op_deref // id: %1 // function_ref protocol_extensions.P1.extP1a (protocol_extensions.P1.Self)() -> () %2 = function_ref @_TFP19protocol_extensions2P16extP1aUS0___fQPS0_FT_T_ : $@convention(method) <τ_0_0 where τ_0_0 : P1> (@in τ_0_0) -> () // user: %5 %3 = alloc_stack $Self // users: %4, %5, %6 diff --git a/test/IRGen/struct_resilience.swift b/test/IRGen/struct_resilience.swift index f9402692d497f..40c4400a255e4 100644 --- a/test/IRGen/struct_resilience.swift +++ b/test/IRGen/struct_resilience.swift @@ -63,7 +63,7 @@ public func functionWithResilientTypesSize(_ s: __owned Size, f: (__owned Size) // CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @"$s17struct_resilience35functionWithResilientTypesRectangleyy010resilient_A00G0VF"(%T16resilient_struct9RectangleV* noalias nocapture %0) public func functionWithResilientTypesRectangle(_ r: Rectangle) { // CHECK: entry: -// CHECK-NEXT: [[TMP:%.*]] = call swiftcc %swift.metadata_response @"$s16resilient_struct9RectangleVMa"([[INT]] 0) +// CHECK: [[TMP:%.*]] = call swiftcc %swift.metadata_response @"$s16resilient_struct9RectangleVMa"([[INT]] 0) // CHECK-NEXT: [[METADATA:%.*]] = extractvalue %swift.metadata_response [[TMP]], 0 // CHECK-NEXT: [[METADATA_ADDR:%.*]] = bitcast %swift.type* [[METADATA]] to i32* // CHECK-NEXT: [[FIELD_OFFSET_PTR:%.*]] = getelementptr inbounds i32, i32* [[METADATA_ADDR]], [[INT]] [[IDX:2|4|6]] @@ -202,7 +202,7 @@ public func resilientAny(s : ResilientWeakRef) { // CHECK: entry: // CHECK: [[ANY:%.*]] = alloca %Any // CHECK: [[META:%.*]] = call swiftcc %swift.metadata_response @"$s16resilient_struct16ResilientWeakRefVMa"([[INT]] 0) -// CHECK: [[META2:%.*]] = extractvalue %swift.metadata_response %3, 0 +// CHECK: [[META2:%.*]] = extractvalue %swift.metadata_response [[META]], 0 // CHECK: [[TYADDR:%.*]] = getelementptr inbounds %Any, %Any* [[ANY]], i32 0, i32 1 // CHECK: store %swift.type* [[META2]], %swift.type** [[TYADDR]] // CHECK: [[BITCAST:%.*]] = bitcast %Any* [[ANY]] to %__opaque_existential_type_0* diff --git a/test/Interop/Cxx/class/type-classification-non-trivial-irgen.swift b/test/Interop/Cxx/class/type-classification-non-trivial-irgen.swift index 5e0c03c94b63c..b7c2af710568c 100644 --- a/test/Interop/Cxx/class/type-classification-non-trivial-irgen.swift +++ b/test/Interop/Cxx/class/type-classification-non-trivial-irgen.swift @@ -73,7 +73,7 @@ public func testStructWithCopyConstructorAndSubobjectCopyConstructorAndValue() // CHECK: [[VAL:%.*]] = getelementptr inbounds %TSo33StructWithCopyConstructorAndValueV, %TSo33StructWithCopyConstructorAndValueV* %0, i32 0, i32 0 // CHECK: [[VAL_VAL:%.*]] = getelementptr inbounds %Ts5Int32V, %Ts5Int32V* [[VAL]], i32 0, i32 0 // CHECK: [[LHS:%.*]] = load i32, i32* [[VAL_VAL]] -// CHECK: [[OUT:%.*]] = icmp eq i32 %1, 42 +// CHECK: [[OUT:%.*]] = icmp eq i32 [[LHS]], 42 // CHECK: ret i1 [[OUT]] public func test(obj: StructWithCopyConstructorAndValue) -> Bool { return obj.value == 42 diff --git a/test/SIL/Distributed/distributed_actor_default_init_sil.swift b/test/SIL/Distributed/distributed_actor_default_init_sil.swift index 92697f6748181..d580cdcf35e15 100644 --- a/test/SIL/Distributed/distributed_actor_default_init_sil.swift +++ b/test/SIL/Distributed/distributed_actor_default_init_sil.swift @@ -12,7 +12,7 @@ distributed actor SimpleEmptyDistributedActor { // CHECK: // %0 "transport" // users: %15, %7, %6, %2 // CHECK: // %1 "self" // users: %5, %12, %4, %16, %3 // CHECK: bb0(%0 : $*ActorTransport, %1 : $SimpleEmptyDistributedActor): -// CHECK: debug_value_addr %0 : $*ActorTransport, let, name "transport", argno 1, implicit // id: %2 +// CHECK: debug_value %0 : $*ActorTransport, let, name "transport", argno 1, implicit, expr op_deref // id: %2 // CHECK: debug_value %1 : $SimpleEmptyDistributedActor, let, name "self", argno 2, implicit // id: %3 // CHECK: %4 = builtin "initializeDefaultActor"(%1 : $SimpleEmptyDistributedActor) : $() diff --git a/test/SIL/Distributed/distributed_actor_user_transport_init_sil.swift b/test/SIL/Distributed/distributed_actor_user_transport_init_sil.swift index 5cb9c95b2b4c5..aa30feb8e3d37 100644 --- a/test/SIL/Distributed/distributed_actor_user_transport_init_sil.swift +++ b/test/SIL/Distributed/distributed_actor_user_transport_init_sil.swift @@ -15,7 +15,7 @@ distributed actor SimpleUserDefinedInitDistributedActor { // CHECK: // %1 "other" // user: %4 // CHECK: // %2 "self" // users: %7, %14, %6, %18, %5 // CHECK: bb0(%0 : $*ActorTransport, %1 : $Int, %2 : $SimpleUserDefinedInitDistributedActor): -// CHECK: debug_value_addr %0 : $*ActorTransport, let, name "transport", argno 1 // id: %3 +// CHECK: debug_value %0 : $*ActorTransport, let, name "transport", argno 1, expr op_deref // id: %3 // CHECK: debug_value %1 : $Int, let, name "other", argno 2 // id: %4 // CHECK: debug_value %2 : $SimpleUserDefinedInitDistributedActor, let, name "self", argno 3, implicit // id: %5 // CHECK: %6 = builtin "initializeDefaultActor"(%2 : $SimpleUserDefinedInitDistributedActor) : $() @@ -48,7 +48,7 @@ distributed actor SimpleUserDefinedInitDistributedActor { // CHECK: // %2 "self" // users: %7, %14, %6, %18, %5 // CHECK: bb0(%0 : $Int, %1 : $*ActorTransport, %2 : $SimpleUserDefinedInitDistributedActor): // CHECK: debug_value %0 : $Int, let, name "other", argno 1 // id: %3 -// CHECK: debug_value_addr %1 : $*ActorTransport, let, name "theTransport", argno 2 // id: %4 +// CHECK: debug_value %1 : $*ActorTransport, let, name "theTransport", argno 2, expr op_deref // id: %4 // CHECK: debug_value %2 : $SimpleUserDefinedInitDistributedActor, let, name "self", argno 3, implicit // id: %5 // CHECK: %6 = builtin "initializeDefaultActor"(%2 : $SimpleUserDefinedInitDistributedActor) : $() diff --git a/test/SIL/Parser/basic.sil b/test/SIL/Parser/basic.sil index 3f9092b90534c..f4a494071ceb5 100644 --- a/test/SIL/Parser/basic.sil +++ b/test/SIL/Parser/basic.sil @@ -1271,7 +1271,7 @@ sil @debug_value : $@convention(thin) (Int, @in P, AnyObject) -> () { bb0(%0 : $Int, %1 : $*P, %2 : $AnyObject): debug_value %0 : $Int // CHECK: debug_value %0 : $Int debug_value [poison] %2 : $AnyObject // CHECK: debug_value [poison] %2 : $AnyObject - debug_value_addr %1 : $*P // CHECK: debug_value_addr %1 : $*P + debug_value %1 : $*P, expr op_deref // CHECK: debug_value %1 : $*P, expr op_deref unreachable } diff --git a/test/SIL/Parser/undef.sil b/test/SIL/Parser/undef.sil index a0d6780369c6e..3545ed9431343 100644 --- a/test/SIL/Parser/undef.sil +++ b/test/SIL/Parser/undef.sil @@ -48,8 +48,8 @@ bb0: // CHECK: debug_value undef : $() debug_value undef : $() - // CHECK: debug_value_addr undef : $*() - debug_value_addr undef : $*() + // CHECK: debug_value undef : $*(), expr op_deref + debug_value undef : $*(), expr op_deref // Accessing memory diff --git a/test/SIL/concurrentclosure_capture_verify_canonical_addressonly.sil b/test/SIL/concurrentclosure_capture_verify_canonical_addressonly.sil index e5bd0631977dc..9f667380ae320 100644 --- a/test/SIL/concurrentclosure_capture_verify_canonical_addressonly.sil +++ b/test/SIL/concurrentclosure_capture_verify_canonical_addressonly.sil @@ -47,7 +47,7 @@ sil @$s37concurrentfunction_capturediagnostics1FCfD : $@convention(method) (@own // This is address only so we shouldn't crash. sil hidden [ossa] @$s37concurrentfunction_capturediagnostics20testCaseAddressOnly21iyx_tAA6MyProtRzlF : $@convention(thin) (@in_guaranteed T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T, let, name "i", argno 1 // id: %1 + debug_value %0 : $*T, let, name "i", argno 1, expr op_deref // id: %1 %2 = alloc_stack $F, var, name "f2" // users: %34, %33, %7 %3 = metatype $@thick F.Type // user: %5 // function_ref F.__allocating_init() diff --git a/test/SIL/concurrentclosure_capture_verify_raw.sil b/test/SIL/concurrentclosure_capture_verify_raw.sil index 9c6b0b0c86c7c..265f335d1c76e 100644 --- a/test/SIL/concurrentclosure_capture_verify_raw.sil +++ b/test/SIL/concurrentclosure_capture_verify_raw.sil @@ -80,7 +80,7 @@ sil @$s37concurrentfunction_capturediagnostics1FCfD : $@convention(method) (@own // This is address only so we shouldn't crash. sil hidden [ossa] @$s37concurrentfunction_capturediagnostics20testCaseAddressOnly21iyx_tAA6MyProtRzlF : $@convention(thin) (@in_guaranteed T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T, let, name "i", argno 1 // id: %1 + debug_value %0 : $*T, let, name "i", argno 1, expr op_deref // id: %1 %2 = alloc_stack $F, var, name "f2" // users: %34, %33, %7 %3 = metatype $@thick F.Type // user: %5 // function_ref F.__allocating_init() diff --git a/test/SILGen/address_only_types.swift b/test/SILGen/address_only_types.swift index c092abe03c889..8aa26c4b727f6 100644 --- a/test/SILGen/address_only_types.swift +++ b/test/SILGen/address_only_types.swift @@ -16,7 +16,7 @@ protocol Unloadable { // CHECK-LABEL: sil hidden [ossa] @$s18address_only_types0a1_B9_argument{{[_0-9a-zA-Z]*}}F func address_only_argument(_ x: Unloadable) { // CHECK: bb0([[XARG:%[0-9]+]] : $*Unloadable): - // CHECK: debug_value_addr [[XARG]] + // CHECK: debug_value [[XARG]] {{.*}} expr op_deref // CHECK-NEXT: tuple // CHECK-NEXT: return } @@ -31,7 +31,7 @@ func address_only_ignored_argument(_: Unloadable) { // CHECK-LABEL: sil hidden [ossa] @$s18address_only_types0a1_B7_return{{[_0-9a-zA-Z]*}}F func address_only_return(_ x: Unloadable, y: Int) -> Unloadable { // CHECK: bb0([[RET:%[0-9]+]] : $*Unloadable, [[XARG:%[0-9]+]] : $*Unloadable, [[YARG:%[0-9]+]] : $Builtin.Int64): - // CHECK-NEXT: debug_value_addr [[XARG]] : $*Unloadable, let, name "x" + // CHECK-NEXT: debug_value [[XARG]] : $*Unloadable, let, name "x", {{.*}} expr op_deref // CHECK-NEXT: debug_value [[YARG]] : $Builtin.Int64, let, name "y" // CHECK-NEXT: copy_addr [[XARG]] to [initialization] [[RET]] // CHECK-NEXT: [[VOID:%[0-9]+]] = tuple () @@ -115,7 +115,7 @@ func address_only_call_1_ignore_return() { // CHECK-LABEL: sil hidden [ossa] @$s18address_only_types0a1_B7_call_2{{[_0-9a-zA-Z]*}}F func address_only_call_2(_ x: Unloadable) { // CHECK: bb0([[XARG:%[0-9]+]] : $*Unloadable): - // CHECK: debug_value_addr [[XARG]] : $*Unloadable + // CHECK: debug_value [[XARG]] : $*Unloadable, {{.*}} expr op_deref some_address_only_function_2(x) // CHECK: [[FUNC:%[0-9]+]] = function_ref @$s18address_only_types05some_a1_B11_function_2{{[_0-9a-zA-Z]*}}F // CHECK: apply [[FUNC]]([[XARG]]) @@ -197,7 +197,7 @@ func address_only_assignment_from_temp_to_property() { // CHECK-LABEL: sil hidden [ossa] @$s18address_only_types0a1_B31_assignment_from_lv_to_property{{[_0-9a-zA-Z]*}}F func address_only_assignment_from_lv_to_property(_ v: Unloadable) { // CHECK: bb0([[VARG:%[0-9]+]] : $*Unloadable): - // CHECK: debug_value_addr [[VARG]] : $*Unloadable + // CHECK: debug_value [[VARG]] : $*Unloadable, {{.*}} expr op_deref // CHECK: [[TEMP:%[0-9]+]] = alloc_stack $Unloadable // CHECK: copy_addr [[VARG]] to [initialization] [[TEMP]] // CHECK: [[SETTER:%[0-9]+]] = function_ref @$s18address_only_types11global_propAA10Unloadable_pvs diff --git a/test/SILGen/addressors.swift b/test/SILGen/addressors.swift index 680d393078513..b06cde98a4ef8 100644 --- a/test/SILGen/addressors.swift +++ b/test/SILGen/addressors.swift @@ -203,7 +203,7 @@ struct D : Subscriptable { // SILGEN: bb0([[VALUE:%.*]] : $Int32, [[I:%.*]] : $Int32, [[SELF:%.*]] : $*D): // SILGEN: debug_value [[VALUE]] : $Int32 // SILGEN: debug_value [[I]] : $Int32 -// SILGEN: debug_value_addr [[SELF]] +// SILGEN: debug_value [[SELF]]{{.*}} expr op_deref // SILGEN: [[ACCESS:%.*]] = begin_access [modify] [unknown] [[SELF]] : $*D // SILGEN: [[T0:%.*]] = function_ref @$s10addressors1DVys5Int32VAEciau{{.*}} // SILGEN: [[PTR:%.*]] = apply [[T0]]([[I]], [[ACCESS]]) diff --git a/test/SILGen/didset_oldvalue_not_accessed_silgen.swift b/test/SILGen/didset_oldvalue_not_accessed_silgen.swift index 380ad23108fd8..5a5e91a5df05a 100644 --- a/test/SILGen/didset_oldvalue_not_accessed_silgen.swift +++ b/test/SILGen/didset_oldvalue_not_accessed_silgen.swift @@ -7,7 +7,7 @@ class Foo { var value: T { // CHECK-LABEL: sil private [ossa] @$s35didset_oldvalue_not_accessed_silgen3FooC5valuexvW : $@convention(method) (@guaranteed Foo) -> () // CHECK: debug_value %0 : $Foo, let, name "self", argno {{[0-9]+}} - // CHECK-NOT: debug_value_addr %0 : $*T, let, name "oldValue", argno {{[0-9]+}} + // CHECK-NOT: debug_value %0 : $*T, let, name "oldValue", argno {{[0-9]+}}, {{.*}} expr op_deref didSet { print("didSet called!") } } @@ -20,7 +20,7 @@ let foo = Foo(value: "Hello") // Foo.value.setter // // CHECK-LABEL: sil hidden [ossa] @$s35didset_oldvalue_not_accessed_silgen3FooC5valuexvs : $@convention(method) (@in T, @guaranteed Foo) -> () -// CHECK: debug_value_addr [[VALUE:%.*]] : $*T, let, name "value", argno {{[0-9+]}} +// CHECK: debug_value [[VALUE:%.*]] : $*T, let, name "value", argno {{[0-9+]}}, {{.*}} expr op_deref // CHECK-NEXT: debug_value [[SELF:%.*]] : $Foo, let, name "self", argno {{[0-9+]}} // CHECK-NEXT: [[ALLOC_STACK:%.*]] = alloc_stack $T // CHECK-NEXT: copy_addr [[VALUE]] to [initialization] [[ALLOC_STACK]] : $*T diff --git a/test/SILGen/expressions.swift b/test/SILGen/expressions.swift index e37e4a85bfba6..5b556e8062259 100644 --- a/test/SILGen/expressions.swift +++ b/test/SILGen/expressions.swift @@ -545,7 +545,7 @@ func dontLoadIgnoredLValueForceUnwrap(_ a: inout NonTrivialStruct?) -> NonTrivia } // CHECK-LABEL: dontLoadIgnoredLValueForceUnwrap // CHECK: bb0(%0 : $*Optional): -// CHECK-NEXT: debug_value_addr %0 +// CHECK-NEXT: debug_value %0{{.*}} expr op_deref // CHECK-NEXT: [[READ:%[0-9]+]] = begin_access [read] [unknown] %0 // CHECK-NEXT: switch_enum_addr [[READ]] : $*Optional, case #Optional.some!enumelt: bb2, case #Optional.none!enumelt: bb1 // CHECK: bb1: @@ -561,7 +561,7 @@ func dontLoadIgnoredLValueDoubleForceUnwrap(_ a: inout NonTrivialStruct??) -> No } // CHECK-LABEL: dontLoadIgnoredLValueDoubleForceUnwrap // CHECK: bb0(%0 : $*Optional>): -// CHECK-NEXT: debug_value_addr %0 +// CHECK-NEXT: debug_value %0{{.*}} expr op_deref // CHECK-NEXT: [[READ:%[0-9]+]] = begin_access [read] [unknown] %0 // CHECK-NEXT: switch_enum_addr [[READ]] : $*Optional>, case #Optional.some!enumelt: bb2, case #Optional.none!enumelt: bb1 // CHECK: bb1: @@ -582,7 +582,7 @@ func loadIgnoredLValueForceUnwrap(_ a: inout NonTrivialStruct) -> NonTrivialStru } // CHECK-LABEL: loadIgnoredLValueForceUnwrap // CHECK: bb0(%0 : $*NonTrivialStruct): -// CHECK-NEXT: debug_value_addr %0 +// CHECK-NEXT: debug_value %0{{.*}} expr op_deref // CHECK-NEXT: [[READ:%[0-9]+]] = begin_access [read] [unknown] %0 // CHECK-NEXT: [[BORROW:%[0-9]+]] = load_borrow [[READ]] // CHECK-NEXT: // function_ref NonTrivialStruct.x.getter @@ -603,7 +603,7 @@ func loadIgnoredLValueThroughForceUnwrap(_ a: inout NonTrivialStruct?) -> NonTri } // CHECK-LABEL: loadIgnoredLValueThroughForceUnwrap // CHECK: bb0(%0 : $*Optional): -// CHECK-NEXT: debug_value_addr %0 +// CHECK-NEXT: debug_value %0{{.*}} expr op_deref // CHECK-NEXT: [[READ:%[0-9]+]] = begin_access [read] [unknown] %0 // CHECK-NEXT: switch_enum_addr [[READ]] : $*Optional, case #Optional.some!enumelt: bb2, case #Optional.none!enumelt: bb1 // CHECK: bb1: @@ -629,7 +629,7 @@ func evaluateIgnoredKeyPathExpr(_ s: inout NonTrivialStruct, _ kp: WritableKeyPa } // CHECK-LABEL: evaluateIgnoredKeyPathExpr // CHECK: bb0(%0 : $*NonTrivialStruct, %1 : @guaranteed $WritableKeyPath): -// CHECK-NEXT: debug_value_addr %0 +// CHECK-NEXT: debug_value %0{{.*}} expr op_deref // CHECK-NEXT: debug_value %1 // CHECK-NEXT: [[KP_TEMP:%[0-9]+]] = copy_value %1 // CHECK-NEXT: [[S_READ:%[0-9]+]] = begin_access [read] [unknown] %0 diff --git a/test/SILGen/generic_tuples.swift b/test/SILGen/generic_tuples.swift index ccc306cebfaa6..76cafffd77381 100644 --- a/test/SILGen/generic_tuples.swift +++ b/test/SILGen/generic_tuples.swift @@ -5,7 +5,7 @@ func dup(_ x: T) -> (T, T) { return (x,x) } // CHECK-LABEL: sil hidden [ossa] @$s14generic_tuples3dup{{[_0-9a-zA-Z]*}}F // CHECK: ([[RESULT_0:%.*]] : $*T, [[RESULT_1:%.*]] : $*T, [[XVAR:%.*]] : $*T): -// CHECK-NEXT: debug_value_addr [[XVAR]] : $*T, let, name "x" +// CHECK-NEXT: debug_value [[XVAR]] : $*T, let, name "x", {{.*}} expr op_deref // CHECK-NEXT: copy_addr [[XVAR]] to [initialization] [[RESULT_0]] // CHECK-NEXT: copy_addr [[XVAR]] to [initialization] [[RESULT_1]] // CHECK-NEXT: [[T0:%.*]] = tuple () diff --git a/test/SILGen/lazy_property_with_observers.swift b/test/SILGen/lazy_property_with_observers.swift index 63ef988e8a401..6a2ce76abc313 100644 --- a/test/SILGen/lazy_property_with_observers.swift +++ b/test/SILGen/lazy_property_with_observers.swift @@ -140,7 +140,7 @@ foo1.bar = 2 // CHECK-LABEL: sil hidden [ossa] @$s28lazy_property_with_observers4Foo1V3barSivs : $@convention(method) (Int, @inout Foo1) -> () { // CHECK: bb0([[VALUE:%.*]] : $Int, [[FOO1:%.*]] : $*Foo1): // CHECK-NEXT: debug_value [[VALUE]] : $Int, let, name "value", argno 1 -// CHECK-NEXT: debug_value_addr [[FOO1]] : $*Foo1, var, name "self", argno 2 +// CHECK-NEXT: debug_value [[FOO1]] : $*Foo1, var, name "self", argno 2, {{.*}} expr op_deref // CHECK-NEXT: [[BEGIN_ACCESS:%.*]] = begin_access [modify] [unknown] %1 : $*Foo1 // CHECK-NEXT: // function_ref Foo1.bar.getter // CHECK-NEXT: [[GETTER:%.*]] = function_ref @$s28lazy_property_with_observers4Foo1V3barSivg : $@convention(method) (@inout Foo1) -> Int diff --git a/test/SILGen/let_decls.swift b/test/SILGen/let_decls.swift index 398c7a9a90503..3095da62df102 100644 --- a/test/SILGen/let_decls.swift +++ b/test/SILGen/let_decls.swift @@ -254,7 +254,7 @@ func test_weird_property(_ v : WeirdPropertyTest, i : Int) -> Int { // CHECK-LABEL: sil hidden [ossa] @{{.*}}generic_identity // CHECK: bb0(%0 : $*T, %1 : $*T): -// CHECK-NEXT: debug_value_addr %1 : $*T +// CHECK-NEXT: debug_value %1 : $*T, {{.*}} expr op_deref // CHECK-NEXT: copy_addr %1 to [initialization] %0 : $*T // CHECK-NOT: destroy_addr %1 // CHECK: } // end sil function '{{.*}}generic_identity{{.*}}' @@ -286,7 +286,7 @@ protocol SimpleProtocol { // CHECK-LABEL: sil hidden [ossa] @{{.*}}testLetProtocolBases // CHECK: bb0(%0 : $*SimpleProtocol): func testLetProtocolBases(_ p : SimpleProtocol) { - // CHECK-NEXT: debug_value_addr + // CHECK-NEXT: debug_value {{.*}} expr op_deref // CHECK-NEXT: open_existential_addr // CHECK-NEXT: witness_method // CHECK-NEXT: apply @@ -305,7 +305,7 @@ func testLetProtocolBases(_ p : SimpleProtocol) { // CHECK-LABEL: sil hidden [ossa] @{{.*}}testLetArchetypeBases // CHECK: bb0(%0 : $*T): func testLetArchetypeBases(_ p : T) { - // CHECK-NEXT: debug_value_addr + // CHECK-NEXT: debug_value {{.*}} expr op_deref // CHECK-NEXT: witness_method $T // CHECK-NEXT: apply p.doSomethingGreat() @@ -321,7 +321,7 @@ func testLetArchetypeBases(_ p : T) { // CHECK-LABEL: sil hidden [ossa] @{{.*}}testDebugValue // CHECK: bb0(%0 : $Int, %1 : $*SimpleProtocol): // CHECK-NEXT: debug_value %0 : $Int, let, name "a" -// CHECK-NEXT: debug_value_addr %1 : $*SimpleProtocol, let, name "b" +// CHECK-NEXT: debug_value %1 : $*SimpleProtocol, let, name "b", {{.*}} expr op_deref func testDebugValue(_ a : Int, b : SimpleProtocol) -> Int { // CHECK-NEXT: debug_value %0 : $Int, let, name "x" @@ -439,7 +439,7 @@ struct GenericStruct { } // CHECK-LABEL: sil hidden [ossa] @{{.*}}GenericStructV4getA{{.*}} : $@convention(method) (@in_guaranteed GenericStruct) -> @out T // CHECK: bb0(%0 : $*T, %1 : $*GenericStruct): - // CHECK-NEXT: debug_value_addr %1 : $*GenericStruct, let, name "self" + // CHECK-NEXT: debug_value %1 : $*GenericStruct, let, name "self", {{.*}} expr op_deref // CHECK-NEXT: %3 = struct_element_addr %1 : $*GenericStruct, #GenericStruct.a // CHECK-NEXT: copy_addr %3 to [initialization] %0 : $*T // CHECK-NEXT: %5 = tuple () @@ -451,7 +451,7 @@ struct GenericStruct { // CHECK-LABEL: sil hidden [ossa] @{{.*}}GenericStructV4getB{{.*}} : $@convention(method) (@in_guaranteed GenericStruct) -> Int // CHECK: bb0([[SELF_ADDR:%.*]] : $*GenericStruct): - // CHECK-NEXT: debug_value_addr [[SELF_ADDR]] : $*GenericStruct, let, name "self" + // CHECK-NEXT: debug_value [[SELF_ADDR]] : $*GenericStruct, let, name "self", {{.*}} expr op_deref // CHECK-NEXT: [[PROJ_ADDR:%.*]] = struct_element_addr [[SELF_ADDR]] : $*GenericStruct, #GenericStruct.b // CHECK-NEXT: [[PROJ_VAL:%.*]] = load [trivial] [[PROJ_ADDR]] : $*Int // CHECK-NOT: destroy_addr [[SELF]] : $*GenericStruct diff --git a/test/SILGen/objc_bridging_any.swift b/test/SILGen/objc_bridging_any.swift index f65af5357fd1c..c0e4601b4fb92 100644 --- a/test/SILGen/objc_bridging_any.swift +++ b/test/SILGen/objc_bridging_any.swift @@ -30,14 +30,14 @@ func passingToId(receiver: NSIdLover, // CHECK: debug_value [[OBJECT:%.*]] : $AnyObject // CHECK: debug_value [[CLASS_GENERIC:%.*]] : $T // CHECK: debug_value [[CLASS_EXISTENTIAL:%.*]] : $CP - // CHECK: debug_value_addr [[GENERIC:%.*]] : $*U - // CHECK: debug_value_addr [[EXISTENTIAL:%.*]] : $*P + // CHECK: debug_value [[GENERIC:%.*]] : $*U, {{.*}} expr op_deref + // CHECK: debug_value [[EXISTENTIAL:%.*]] : $*P, {{.*}} expr op_deref // CHECK: debug_value [[ERROR:%.*]] : $Error - // CHECK: debug_value_addr [[ANY:%.*]] : $*Any + // CHECK: debug_value [[ANY:%.*]] : $*Any, {{.*}} expr op_deref // CHECK: debug_value [[KNOWN_UNBRIDGED:%.*]] : $KnownUnbridged // CHECK: debug_value [[OPT_STRING:%.*]] : $Optional // CHECK: debug_value [[OPT_NSSTRING:%.*]] : $Optional - // CHECK: debug_value_addr [[OPT_ANY:%.*]] : $*Optional + // CHECK: debug_value [[OPT_ANY:%.*]] : $*Optional, {{.*}} expr op_deref // CHECK: [[STRING_COPY:%.*]] = copy_value [[STRING]] // CHECK: [[BRIDGE_STRING:%.*]] = function_ref @$sSS10FoundationE19_bridgeToObjectiveCSo8NSStringCyF diff --git a/test/SILGen/observers.swift b/test/SILGen/observers.swift index 6b6c6d4503fa1..8c47381327adf 100644 --- a/test/SILGen/observers.swift +++ b/test/SILGen/observers.swift @@ -30,7 +30,7 @@ public struct DidSetWillSetTests { willSet(newA) { // CHECK: bb0(%0 : $Int, %1 : $*DidSetWillSetTests): // CHECK-NEXT: debug_value %0 - // CHECK-NEXT: debug_value_addr %1 : $*DidSetWillSetTests + // CHECK-NEXT: debug_value %1 : $*DidSetWillSetTests, {{.*}} expr op_deref takeInt(a) @@ -64,7 +64,7 @@ public struct DidSetWillSetTests { // CHECK-LABEL: sil private [ossa] @$s9observers010DidSetWillC5TestsV1a{{[_0-9a-zA-Z]*}}vW didSet { // CHECK: bb0(%0 : $*DidSetWillSetTests): - // CHECK-NEXT: debug_value_addr %0 : $*DidSetWillSetTests + // CHECK-NEXT: debug_value %0 : $*DidSetWillSetTests, {{.*}} expr op_deref takeInt(a) @@ -102,7 +102,7 @@ public struct DidSetWillSetTests { // CHECK-LABEL: sil [ossa] @$s9observers010DidSetWillC5TestsV1aSivs : $@convention(method) (Int, @inout DidSetWillSetTests) -> () { // CHECK: bb0([[NEWVALUE:%.*]] : $Int, %1 : $*DidSetWillSetTests): // CHECK-NEXT: debug_value [[NEWVALUE]] : $Int, let, name "value", argno 1 - // CHECK-NEXT: debug_value_addr %1 + // CHECK-NEXT: debug_value %1{{.*}} expr op_deref // CHECK-NEXT: [[MODIFY_ONE:%.*]] = begin_access [modify] [unknown] %1 : $*DidSetWillSetTests // CHECK-NEXT: // function_ref observers.DidSetWillSetTests.a.willset : Swift.Int @@ -313,7 +313,7 @@ func propertyWithDidSetTakingOldValue() { // CHECK: bb0([[ARG1:%.*]] : $Int, [[ARG2:%.*]] : @guaranteed ${ var Int }): // CHECK-NEXT: debug_value [[ARG1]] : $Int, let, name "value", argno 1 // CHECK-NEXT: [[ARG2_PB:%.*]] = project_box [[ARG2]] -// CHECK-NEXT: debug_value_addr [[ARG2_PB]] : $*Int, var, name "p", argno 2 +// CHECK-NEXT: debug_value [[ARG2_PB]] : $*Int, var, name "p", argno 2, expr op_deref // CHECK-NEXT: [[READ:%.*]] = begin_access [read] [unknown] [[ARG2_PB]] // CHECK-NEXT: [[ARG2_PB_VAL:%.*]] = load [trivial] [[READ]] : $*Int // CHECK-NEXT: end_access [[READ]] diff --git a/test/SILGen/optional-cast.swift b/test/SILGen/optional-cast.swift index 98de702d5f672..692abe5130ef0 100644 --- a/test/SILGen/optional-cast.swift +++ b/test/SILGen/optional-cast.swift @@ -174,7 +174,7 @@ func opt_to_opt_reference(_ x : C!) -> C? { return x } // CHECK-LABEL: sil hidden [ossa] @$s4main07opt_to_B12_addressOnly{{[_0-9a-zA-Z]*}}F // CHECK: bb0(%0 : $*Optional, %1 : $*Optional): -// CHECK-NEXT: debug_value_addr %1 : $*Optional, let, name "x" +// CHECK-NEXT: debug_value %1 : $*Optional, let, name "x", {{.*}} expr op_deref // CHECK-NEXT: copy_addr %1 to [initialization] %0 // CHECK-NOT: destroy_addr %1 func opt_to_opt_addressOnly(_ x : T!) -> T? { return x } diff --git a/test/SILGen/property_wrapper_coroutine.swift b/test/SILGen/property_wrapper_coroutine.swift index 0dd8f7cd479eb..05ad982af6f70 100644 --- a/test/SILGen/property_wrapper_coroutine.swift +++ b/test/SILGen/property_wrapper_coroutine.swift @@ -36,7 +36,7 @@ _ = state1.someValues // CHECK-LABEL: sil hidden [ossa] @$s26property_wrapper_coroutine5StateV6valuesSaySSGvM : $@yield_once @convention(method) (@inout State) -> @yields @inout Array { // CHECK: bb0([[STATE:%.*]] : $*State): -// CHECK: debug_value_addr [[STATE]] : $*State, var, name "self", argno {{.*}} +// CHECK: debug_value [[STATE]] : $*State, var, name "self", argno {{.*}}, {{.*}} expr op_deref // CHECK: [[BEGIN_ACCESS:%.*]] = begin_access [modify] [unknown] [[STATE]] : $*State // CHECK: [[BACKING_ADDR:%.*]] = struct_element_addr [[BEGIN_ACCESS]] : $*State, #State._values // CHECK: [[VALUE_ADDR:%.*]] = struct_element_addr [[BACKING_ADDR]] : $*TestWrapper>, #TestWrapper.wrappedValue diff --git a/test/SILGen/switch_multiple_entry_address_only.swift b/test/SILGen/switch_multiple_entry_address_only.swift index 507986eb13e0a..7718086965fc3 100644 --- a/test/SILGen/switch_multiple_entry_address_only.swift +++ b/test/SILGen/switch_multiple_entry_address_only.swift @@ -91,7 +91,7 @@ func multipleLabelsVar(e: E) { // CHECK-NEXT: br bb3 // CHECK: bb3: - // CHECK-NEXT: debug_value_addr [[X_PHI]] : $*Any, var, name "x" + // CHECK-NEXT: debug_value [[X_PHI]] : $*Any, var, name "x" // CHECK-NEXT: [[ANY_BOX:%.*]] = alloc_box ${ var Any }, var, name "x" // CHECK-NEXT: [[BOX_PAYLOAD:%.*]] = project_box [[ANY_BOX]] : ${ var Any }, 0 // CHECK-NEXT: copy_addr [take] [[X_PHI]] to [initialization] [[BOX_PAYLOAD]] diff --git a/test/SILGen/unmanaged.swift b/test/SILGen/unmanaged.swift index 9cc6016a7b5f2..4b98735303ec7 100644 --- a/test/SILGen/unmanaged.swift +++ b/test/SILGen/unmanaged.swift @@ -35,7 +35,7 @@ func get(holder holder: inout Holder) -> C { } // CHECK-LABEL:sil hidden @$s9unmanaged3get6holderAA1CCAA6HolderVz_tF : $@convention(thin) (@inout Holder) -> @owned C // CHECK: bb0([[ADDR:%.*]] : $*Holder): -// CHECK-NEXT: debug_value_addr %0 : $*Holder, var, name "holder", argno 1 +// CHECK-NEXT: debug_value %0 : $*Holder, var, name "holder", argno 1, expr op_deref // CHECK-NEXT: [[READ:%.*]] = begin_access [read] [static] [[ADDR]] : $*Holder // CHECK-NEXT: [[T0:%.*]] = struct_element_addr [[READ]] : $*Holder, #Holder.value // CHECK-NEXT: [[T1:%.*]] = load [[T0]] : $*@sil_unmanaged C diff --git a/test/SILGen/unmanaged_ownership.swift b/test/SILGen/unmanaged_ownership.swift index ee69cfeaeff56..f415ae2903713 100644 --- a/test/SILGen/unmanaged_ownership.swift +++ b/test/SILGen/unmanaged_ownership.swift @@ -46,7 +46,7 @@ func get(holder holder: inout Holder) -> C { } // CHECK-LABEL: sil hidden [ossa] @$ss3get6holders1CCs6HolderVz_tF : $@convention(thin) (@inout Holder) -> @owned C { // CHECK: bb0([[ADDR:%.*]] : $*Holder): -// CHECK-NEXT: debug_value_addr %0 : $*Holder, var, name "holder", argno 1 +// CHECK-NEXT: debug_value %0 : $*Holder, var, name "holder", argno 1, expr op_deref // CHECK-NEXT: [[READ:%.*]] = begin_access [read] [unknown] [[ADDR]] : $*Holder // CHECK-NEXT: [[T0:%.*]] = struct_element_addr [[READ]] : $*Holder, #Holder.value // CHECK-NEXT: [[T1:%.*]] = load [trivial] [[T0]] : $*@sil_unmanaged C diff --git a/test/SILGen/weak.swift b/test/SILGen/weak.swift index 94aad290d526e..3bbf4929dccbf 100644 --- a/test/SILGen/weak.swift +++ b/test/SILGen/weak.swift @@ -55,7 +55,7 @@ func test0(c c: C) { // CHECK-LABEL: sil private [ossa] @$s4weak19testClosureOverWeakyyFSiycfU_ : $@convention(thin) (@guaranteed { var @sil_weak Optional }) -> Int { // CHECK: bb0(%0 : @guaranteed ${ var @sil_weak Optional }): // CHECK-NEXT: %1 = project_box %0 -// CHECK-NEXT: debug_value_addr %1 : $*@sil_weak Optional, var, name "bC", argno 1 +// CHECK-NEXT: debug_value %1 : $*@sil_weak Optional, var, name "bC", argno 1, expr op_deref // CHECK-NEXT: [[READ:%.*]] = begin_access [read] [unknown] %1 // CHECK-NEXT: [[VAL:%.*]] = load_weak [[READ]] : $*@sil_weak Optional // CHECK-NEXT: end_access [[READ]] diff --git a/test/SILOptimizer/access_enforcement_opts.sil b/test/SILOptimizer/access_enforcement_opts.sil index 5f644b6a3411d..77589d4cb6873 100644 --- a/test/SILOptimizer/access_enforcement_opts.sil +++ b/test/SILOptimizer/access_enforcement_opts.sil @@ -564,7 +564,7 @@ sil private @$s17enforce_with_opts24testInoutWriteEscapeReadyyFyycfU_ : $@conven // %0 bb0(%0 : ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = begin_access [read] [dynamic] %1 : $*Int64 %4 = load %3 : $*Int64 end_access %3 : $*Int64 @@ -641,7 +641,7 @@ sil private @$s17enforce_with_opts020testInoutWriteEscapeF0yyFyycfU_ : $@convent // %0 bb0(%0 : ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = integer_literal $Builtin.Int64, 42 %4 = struct $Int64 (%3 : $Builtin.Int64) %5 = begin_access [modify] [dynamic] %1 : $*Int64 @@ -696,7 +696,7 @@ sil private @$s23enforce_with_opts_nob2s021testInoutReadNoescapeG0yyFyycfU_ : $@ // %0 bb0(%0 : ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = begin_access [read] [dynamic] %1 : $*Int64 %4 = load %3 : $*Int64 end_access %3 : $*Int64 @@ -716,7 +716,7 @@ sil private @$s23enforce_with_opts_nob2s021testInoutReadNoescapeG0yyFyyXEfU0_ : // %0 // %1 bb0(%0 : $*Int64, %1 : $@callee_guaranteed () -> ()): - debug_value_addr %0 : $*Int64, var, name "x", argno 1 + debug_value %0 : $*Int64, var, name "x", argno 1, expr op_deref debug_value %1 : $@callee_guaranteed () -> (), let, name "c", argno 2 %4 = begin_access [read] [dynamic] %0 : $*Int64 %5 = tuple () @@ -772,7 +772,7 @@ sil private @$s23enforce_with_opts_nob2s26testInoutReadNoescapeWriteyyFyycfU_ : // %0 bb0(%0 : ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = integer_literal $Builtin.Int64, 7 %4 = struct $Int64 (%3 : $Builtin.Int64) %5 = begin_access [modify] [dynamic] %1 : $*Int64 @@ -788,7 +788,7 @@ bb0(%0 : ${ var Int64 }): // CHECK-LABEL: } // end sil function '$s23enforce_with_opts_nob2s26testInoutReadNoescapeWriteyyFyyXEfU0_' sil private @$s23enforce_with_opts_nob2s26testInoutReadNoescapeWriteyyFyyXEfU0_ : $@convention(thin) (@inout_aliasable Int64, @guaranteed @callee_guaranteed () -> ()) -> () { bb0(%0 : $*Int64, %1 : $@callee_guaranteed () -> ()): - debug_value_addr %0 : $*Int64, var, name "x", argno 1 + debug_value %0 : $*Int64, var, name "x", argno 1, expr op_deref debug_value %1 : $@callee_guaranteed () -> (), let, name "c", argno 2 %4 = begin_access [read] [dynamic] %0 : $*Int64 %5 = tuple () @@ -844,7 +844,7 @@ sil private @$s23enforce_with_opts_nob2s33testInoutWriteNoescapeReadClosureyyFyy // %0 bb0(%0 : ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = begin_access [read] [dynamic] %1 : $*Int64 %4 = load %3 : $*Int64 end_access %3 : $*Int64 @@ -864,7 +864,7 @@ sil private @$s23enforce_with_opts_nob2s33testInoutWriteNoescapeReadClosureyyFyy // %0 // %1 bb0(%0 : $*Int64, %1 : $@callee_guaranteed () -> ()): - debug_value_addr %0 : $*Int64, var, name "x", argno 1 + debug_value %0 : $*Int64, var, name "x", argno 1, expr op_deref debug_value %1 : $@callee_guaranteed () -> (), let, name "c", argno 2 %4 = begin_access [modify] [dynamic] %0 : $*Int64 %5 = tuple () @@ -918,7 +918,7 @@ sil private @$s23enforce_with_opts_nob2s022testInoutWriteNoescapeG7ClosureyyFyyc // %0 bb0(%0 : ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = integer_literal $Builtin.Int64, 7 %4 = struct $Int64 (%3 : $Builtin.Int64) %5 = begin_access [modify] [dynamic] %1 : $*Int64 @@ -934,7 +934,7 @@ bb0(%0 : ${ var Int64 }): // CHECK-LABEL: } // end sil function '$s23enforce_with_opts_nob2s022testInoutWriteNoescapeG7ClosureyyFyyXEfU0_' sil private @$s23enforce_with_opts_nob2s022testInoutWriteNoescapeG7ClosureyyFyyXEfU0_ : $@convention(thin) (@inout_aliasable Int64, @guaranteed @callee_guaranteed () -> ()) -> () { bb0(%0 : $*Int64, %1 : $@callee_guaranteed () -> ()): - debug_value_addr %0 : $*Int64, var, name "x", argno 1 + debug_value %0 : $*Int64, var, name "x", argno 1, expr op_deref debug_value %1 : $@callee_guaranteed () -> (), let, name "c", argno 2 %4 = begin_access [modify] [dynamic] %0 : $*Int64 %5 = tuple () diff --git a/test/SILOptimizer/access_enforcement_opts_ossa.sil b/test/SILOptimizer/access_enforcement_opts_ossa.sil index f41bf770d7c6e..dd2ec4798463b 100644 --- a/test/SILOptimizer/access_enforcement_opts_ossa.sil +++ b/test/SILOptimizer/access_enforcement_opts_ossa.sil @@ -569,7 +569,7 @@ sil private [ossa] @$s17enforce_with_opts24testInoutWriteEscapeReadyyFyycfU_ : $ // %0 bb0(%0 : @guaranteed ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = begin_access [read] [dynamic] %1 : $*Int64 %4 = load [trivial] %3 : $*Int64 end_access %3 : $*Int64 @@ -646,7 +646,7 @@ sil private [ossa] @$s17enforce_with_opts020testInoutWriteEscapeF0yyFyycfU_ : $@ // %0 bb0(%0 : @guaranteed ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = integer_literal $Builtin.Int64, 42 %4 = struct $Int64 (%3 : $Builtin.Int64) %5 = begin_access [modify] [dynamic] %1 : $*Int64 @@ -701,7 +701,7 @@ sil private [ossa] @$s23enforce_with_opts_nob2s021testInoutReadNoescapeG0yyFyycf // %0 bb0(%0 : @guaranteed ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = begin_access [read] [dynamic] %1 : $*Int64 %4 = load [trivial] %3 : $*Int64 end_access %3 : $*Int64 @@ -721,7 +721,7 @@ sil private [ossa] @$s23enforce_with_opts_nob2s021testInoutReadNoescapeG0yyFyyXE // %0 // %1 bb0(%0 : $*Int64, %1 : @guaranteed $@callee_guaranteed () -> ()): - debug_value_addr %0 : $*Int64, var, name "x", argno 1 + debug_value %0 : $*Int64, var, name "x", argno 1, expr op_deref debug_value %1 : $@callee_guaranteed () -> (), let, name "c", argno 2 %4 = begin_access [read] [dynamic] %0 : $*Int64 %5 = tuple () @@ -777,7 +777,7 @@ sil private [ossa] @$s23enforce_with_opts_nob2s26testInoutReadNoescapeWriteyyFyy // %0 bb0(%0 : @guaranteed ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = integer_literal $Builtin.Int64, 7 %4 = struct $Int64 (%3 : $Builtin.Int64) %5 = begin_access [modify] [dynamic] %1 : $*Int64 @@ -793,7 +793,7 @@ bb0(%0 : @guaranteed ${ var Int64 }): // CHECK-LABEL: } // end sil function '$s23enforce_with_opts_nob2s26testInoutReadNoescapeWriteyyFyyXEfU0_' sil private [ossa] @$s23enforce_with_opts_nob2s26testInoutReadNoescapeWriteyyFyyXEfU0_ : $@convention(thin) (@inout_aliasable Int64, @guaranteed @callee_guaranteed () -> ()) -> () { bb0(%0 : $*Int64, %1 : @guaranteed $@callee_guaranteed () -> ()): - debug_value_addr %0 : $*Int64, var, name "x", argno 1 + debug_value %0 : $*Int64, var, name "x", argno 1, expr op_deref debug_value %1 : $@callee_guaranteed () -> (), let, name "c", argno 2 %4 = begin_access [read] [dynamic] %0 : $*Int64 %5 = tuple () @@ -849,7 +849,7 @@ sil private [ossa] @$s23enforce_with_opts_nob2s33testInoutWriteNoescapeReadClosu // %0 bb0(%0 : @guaranteed ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = begin_access [read] [dynamic] %1 : $*Int64 %4 = load [trivial] %3 : $*Int64 end_access %3 : $*Int64 @@ -869,7 +869,7 @@ sil private [ossa] @$s23enforce_with_opts_nob2s33testInoutWriteNoescapeReadClosu // %0 // %1 bb0(%0 : $*Int64, %1 : @guaranteed $@callee_guaranteed () -> ()): - debug_value_addr %0 : $*Int64, var, name "x", argno 1 + debug_value %0 : $*Int64, var, name "x", argno 1, expr op_deref debug_value %1 : $@callee_guaranteed () -> (), let, name "c", argno 2 %4 = begin_access [modify] [dynamic] %0 : $*Int64 %5 = tuple () @@ -923,7 +923,7 @@ sil private [ossa] @$s23enforce_with_opts_nob2s022testInoutWriteNoescapeG7Closur // %0 bb0(%0 : @guaranteed ${ var Int64 }): %1 = project_box %0 : ${ var Int64 }, 0 - debug_value_addr %1 : $*Int64, var, name "x", argno 1 + debug_value %1 : $*Int64, var, name "x", argno 1, expr op_deref %3 = integer_literal $Builtin.Int64, 7 %4 = struct $Int64 (%3 : $Builtin.Int64) %5 = begin_access [modify] [dynamic] %1 : $*Int64 @@ -939,7 +939,7 @@ bb0(%0 : @guaranteed ${ var Int64 }): // CHECK-LABEL: } // end sil function '$s23enforce_with_opts_nob2s022testInoutWriteNoescapeG7ClosureyyFyyXEfU0_' sil private [ossa] @$s23enforce_with_opts_nob2s022testInoutWriteNoescapeG7ClosureyyFyyXEfU0_ : $@convention(thin) (@inout_aliasable Int64, @guaranteed @callee_guaranteed () -> ()) -> () { bb0(%0 : $*Int64, %1 : @guaranteed $@callee_guaranteed () -> ()): - debug_value_addr %0 : $*Int64, var, name "x", argno 1 + debug_value %0 : $*Int64, var, name "x", argno 1, expr op_deref debug_value %1 : $@callee_guaranteed () -> (), let, name "c", argno 2 %4 = begin_access [modify] [dynamic] %0 : $*Int64 %5 = tuple () diff --git a/test/SILOptimizer/accesspath_uses_ossa.sil b/test/SILOptimizer/accesspath_uses_ossa.sil index 38526f7d43613..8cf24b69b3a54 100644 --- a/test/SILOptimizer/accesspath_uses_ossa.sil +++ b/test/SILOptimizer/accesspath_uses_ossa.sil @@ -416,13 +416,13 @@ enum IntTEnum { // CHECK: Storage: Argument %0 = argument of bb0 : $*IntTEnum // CHECK: Path: () // CHECK: Exact Uses { -// CHECK-NEXT: debug_value_addr %0 : $*IntTEnum, let, name "self", argno 1 +// CHECK-NEXT: debug_value %0 : $*IntTEnum, let, name "self", argno 1, expr op_deref // CHECK-NEXT: Path: () // CHECK-NEXT: copy_addr %0 to [initialization] %2 : $*IntTEnum // CHECK-NEXT: Path: () // CHECK-NEXT: } // CHECK: Overlapping Uses { -// CHECK-NEXT: debug_value_addr %0 : $*IntTEnum, let, name "self", argno 1 +// CHECK-NEXT: debug_value %0 : $*IntTEnum, let, name "self", argno 1, expr op_deref // CHECK-NEXT: Path: () // CHECK-NEXT: copy_addr %0 to [initialization] %2 : $*IntTEnum // CHECK-NEXT: Path: () @@ -566,7 +566,7 @@ enum IntTEnum { // CHECK: } sil hidden [ossa] @testEnumUses : $@convention(method) (@in_guaranteed IntTEnum) -> Int { bb0(%0 : $*IntTEnum): - debug_value_addr %0 : $*IntTEnum, let, name "self", argno 1 + debug_value %0 : $*IntTEnum, let, name "self", argno 1, expr op_deref %2 = alloc_stack $IntTEnum copy_addr %0 to [initialization] %2 : $*IntTEnum switch_enum_addr %2 : $*IntTEnum, case #IntTEnum.int!enumelt: bb1, case #IntTEnum.other!enumelt: bb2 diff --git a/test/SILOptimizer/address_lowering.sil b/test/SILOptimizer/address_lowering.sil index e63619d1a7171..c4338e72b28eb 100644 --- a/test/SILOptimizer/address_lowering.sil +++ b/test/SILOptimizer/address_lowering.sil @@ -154,9 +154,9 @@ bb0(%0 : $T): // CHECK: %[[PREV1:.*]] = alloc_stack $T // CHECK: %[[ARG2:.*]] = alloc_stack $T // CHECK: %[[PREV2:.*]] = alloc_stack $T -// CHECK: debug_value_addr %0 : $*T, var, name "t", argno 1 -// CHECK: debug_value_addr %1 : $*T, var, name "u", argno 2 -// CHECK: debug_value_addr %2 : $*T +// CHECK: debug_value %0 : $*T, var, name "t", argno 1, expr op_deref +// CHECK: debug_value %1 : $*T, var, name "u", argno 2, expr op_deref +// CHECK: debug_value %2 : $*T, {{.*}} expr op_deref // CHECK: copy_addr %2 to [initialization] %[[ARG1]] : $*T // CHECK: copy_addr [take] %0 to [initialization] %[[PREV1]] : $*T // CHECK: copy_addr [take] %[[ARG1]] to [initialization] %0 : $*T @@ -175,8 +175,8 @@ bb0(%0 : $T): // CHECK-LABEL: } // end sil function 'f050_storeinout' sil @f050_storeinout : $@convention(thin) (@inout T, @inout T, @in T) -> () { bb0(%0 : $*T, %1 : $*T, %2 : $T): - debug_value_addr %0 : $*T, var, name "t", argno 1 - debug_value_addr %1 : $*T, var, name "u", argno 2 + debug_value %0 : $*T, var, name "t", argno 1, expr op_deref + debug_value %1 : $*T, var, name "u", argno 2, expr op_deref debug_value %2 : $T, let, name "x", argno 3 %6 = copy_value %2 : $T %7 = load %0 : $*T diff --git a/test/SILOptimizer/address_projection.sil b/test/SILOptimizer/address_projection.sil index 5cd6b25db11f0..9cd4240929a52 100644 --- a/test/SILOptimizer/address_projection.sil +++ b/test/SILOptimizer/address_projection.sil @@ -145,9 +145,9 @@ bb0(%0 : $T): // CHECK: bb0(%0 : $*T, %1 : $*T, %2 : $*T): // CHECK: %[[PREV1:.*]] = alloc_stack $T // CHECK: %[[PREV2:.*]] = alloc_stack $T -// CHECK: debug_value_addr %0 : $*T, var, name "t", argno 1 -// CHECK: debug_value_addr %1 : $*T, var, name "u", argno 2 -// CHECK: debug_value_addr %2 : $*T +// CHECK: debug_value %0 : $*T, var, name "t", argno 1, expr op_deref +// CHECK: debug_value %1 : $*T, var, name "u", argno 2, expr op_deref +// CHECK: debug_value %2 : $*T, {{.*}} expr op_deref // CHECK: copy_addr [take] %0 to [initialization] %[[PREV1]] : $*T // CHECK: copy_addr %2 to [initialization] %0 : $*T // CHECK: destroy_addr %[[PREV1]] : $*T @@ -162,8 +162,8 @@ bb0(%0 : $T): // CHECK-LABEL: } // end sil function 'f050_storeinout' sil @f050_storeinout : $@convention(thin) (@inout T, @inout T, @in T) -> () { bb0(%0 : $*T, %1 : $*T, %2 : $T): - debug_value_addr %0 : $*T, var, name "t", argno 1 - debug_value_addr %1 : $*T, var, name "u", argno 2 + debug_value %0 : $*T, var, name "t", argno 1, expr op_deref + debug_value %1 : $*T, var, name "u", argno 2, expr op_deref debug_value %2 : $T, let, name "x", argno 3 %6 = copy_value %2 : $T %7 = load %0 : $*T diff --git a/test/SILOptimizer/allocbox_to_stack.sil b/test/SILOptimizer/allocbox_to_stack.sil index 0f4fae6441386..9e8cb50a95831 100644 --- a/test/SILOptimizer/allocbox_to_stack.sil +++ b/test/SILOptimizer/allocbox_to_stack.sil @@ -502,8 +502,8 @@ bb0(%0 : $@callee_guaranteed () -> @out U): sil @callWithAutoclosure : $@convention(thin) (@in T) -> () { // CHECK: bb0 bb0(%0 : $*T): - // CHECK: debug_value_addr - debug_value_addr %0 : $*T + // CHECK: debug_value {{.*}} expr op_deref + debug_value %0 : $*T, expr op_deref // CHECK: function_ref @mightApply %2 = function_ref @mightApply : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned @callee_owned () -> @out τ_0_0) -> () %3 = function_ref @closure_to_specialize : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 @@ -530,8 +530,8 @@ bb0(%0 : $*T): sil @callWithAutoclosure_2 : $@convention(thin) (@in T) -> () { // CHECK: bb0 bb0(%0 : $*T): - // CHECK: debug_value_addr - debug_value_addr %0 : $*T + // CHECK: debug_value {{.*}} expr op_deref + debug_value %0 : $*T, expr op_deref // CHECK: function_ref @mightApply %2 = function_ref @mightApply : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned @callee_owned () -> @out τ_0_0) -> () %3 = function_ref @closure_to_specialize : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 @@ -618,7 +618,7 @@ sil shared @specialized : $@convention(method) (Int, @in S) -> Bool { // CHECK: bb0 bb0(%0 : $Int, %1 : $*S): debug_value %0 : $Int - debug_value_addr %1 : $*S + debug_value %1 : $*S, expr op_deref %4 = function_ref @outer : $@convention(thin) (@owned @callee_owned () -> Bool) -> Bool %5 = function_ref @closure1 : $@convention(thin) (Int, @owned <τ_0_0 where τ_0_0 : Count> { var S<τ_0_0> } ) -> Bool %6 = alloc_box $<τ_0_0 where τ_0_0 : Count> { var S<τ_0_0> } @@ -636,7 +636,7 @@ sil @unspecialized : $@convention(method) (Int, @in S) -> // CHECK: bb0 bb0(%0 : $Int, %1 : $*S): debug_value %0 : $Int - debug_value_addr %1 : $*S + debug_value %1 : $*S, expr op_deref %4 = function_ref @outer : $@convention(thin) (@owned @callee_owned () -> Bool) -> Bool %5 = function_ref @closure1 : $@convention(thin) <τ_0_0 where τ_0_0 : Count> (Int, @owned <τ_0_0 : Count> { var S<τ_0_0> } <τ_0_0>) -> Bool %6 = alloc_box $<τ_0_0 where τ_0_0 : Count> { var S<τ_0_0> } @@ -735,7 +735,7 @@ bb0(%0 : $<τ_0_0> { var τ_0_0 } ): sil hidden [noinline] @consume : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref destroy_addr %0 : $*T %3 = tuple () return %3 : $() diff --git a/test/SILOptimizer/allocbox_to_stack_ownership.sil b/test/SILOptimizer/allocbox_to_stack_ownership.sil index c32afdda6cac2..e3e5be4835dc8 100644 --- a/test/SILOptimizer/allocbox_to_stack_ownership.sil +++ b/test/SILOptimizer/allocbox_to_stack_ownership.sil @@ -501,8 +501,8 @@ bb0(%0 : @guaranteed $@callee_guaranteed () -> @out U): sil [ossa] @callWithAutoclosure : $@convention(thin) (@in T) -> () { // CHECK: bb0 bb0(%0 : $*T): - // CHECK: debug_value_addr - debug_value_addr %0 : $*T + // CHECK: debug_value {{.*}} expr op_deref + debug_value %0 : $*T, expr op_deref // CHECK: function_ref @mightApply %2 = function_ref @mightApply : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned @callee_owned () -> @out τ_0_0) -> () %3 = function_ref @closure_to_specialize : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 @@ -528,8 +528,8 @@ bb0(%0 : $*T): sil [ossa] @callWithAutoclosure_2 : $@convention(thin) (@in T) -> () { // CHECK: bb0 bb0(%0 : $*T): - // CHECK: debug_value_addr - debug_value_addr %0 : $*T + // CHECK: debug_value {{.*}} expr op_deref + debug_value %0 : $*T, expr op_deref // CHECK: function_ref @mightApply %2 = function_ref @mightApply : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned @callee_owned () -> @out τ_0_0) -> () %3 = function_ref @closure_to_specialize : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 @@ -616,7 +616,7 @@ sil shared [ossa] @specialized : $@convention(method) (Int, @in S) -> Bool { // CHECK: bb0 bb0(%0 : $Int, %1 : $*S): debug_value %0 : $Int - debug_value_addr %1 : $*S + debug_value %1 : $*S, expr op_deref %4 = function_ref @outer : $@convention(thin) (@owned @callee_owned () -> Bool) -> Bool %5 = function_ref @closure1 : $@convention(thin) (Int, @owned <τ_0_0 where τ_0_0 : Count> { var S<τ_0_0> } ) -> Bool %6 = alloc_box $<τ_0_0 where τ_0_0 : Count> { var S<τ_0_0> } @@ -634,7 +634,7 @@ sil [ossa] @unspecialized : $@convention(method) (Int, @in S // CHECK: bb0 bb0(%0 : $Int, %1 : $*S): debug_value %0 : $Int - debug_value_addr %1 : $*S + debug_value %1 : $*S, expr op_deref %4 = function_ref @outer : $@convention(thin) (@owned @callee_owned () -> Bool) -> Bool %5 = function_ref @closure1 : $@convention(thin) <τ_0_0 where τ_0_0 : Count> (Int, @owned <τ_0_0 : Count> { var S<τ_0_0> } <τ_0_0>) -> Bool %6 = alloc_box $<τ_0_0 where τ_0_0 : Count> { var S<τ_0_0> } @@ -738,7 +738,7 @@ bb0(%0 : @owned $<τ_0_0> { var τ_0_0 } ): sil hidden [noinline] @consume : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref destroy_addr %0 : $*T %3 = tuple () return %3 : $() diff --git a/test/SILOptimizer/basic-callee-printer.sil b/test/SILOptimizer/basic-callee-printer.sil index d4afd330fabcf..57e979ecd171b 100644 --- a/test/SILOptimizer/basic-callee-printer.sil +++ b/test/SILOptimizer/basic-callee-printer.sil @@ -438,7 +438,7 @@ bb0(%0 : $*private_proto_private_class): // CHECK: private_proto_1_private_class_witness sil private @call_through_private_proto_1 : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %2 = witness_method $T, #private_proto_1.theMethod : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> () %3 = apply %2(%0) : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> () destroy_addr %0 : $*T @@ -482,7 +482,7 @@ bb0(%0 : $*private_proto_internal_class): // CHECK: private_proto_2_internal_class_witness sil private @call_through_private_proto_2 : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %2 = witness_method $T, #private_proto_2.theMethod : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> () %3 = apply %2(%0) : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> () destroy_addr %0 : $*T @@ -524,7 +524,7 @@ bb0(%0 : $*private_proto_public_class): // CHECK: private_proto_3_public_class_witness sil private @call_through_private_proto_3 : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %2 = witness_method $T, #private_proto_3.theMethod : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> () %3 = apply %2(%0) : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> () destroy_addr %0 : $*T @@ -566,7 +566,7 @@ bb0(%0 : $*private_proto_public_class_private_method): // CHECK: private_proto_4_public_class_private_method_witness sil private @call_through_private_proto_4 : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %2 = witness_method $T, #private_proto_4.theMethod : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> () %3 = apply %2(%0) : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> () destroy_addr %0 : $*T diff --git a/test/SILOptimizer/copy_propagation_opaque.sil b/test/SILOptimizer/copy_propagation_opaque.sil index 6a3008f83d5b7..972a782c1c7d1 100644 --- a/test/SILOptimizer/copy_propagation_opaque.sil +++ b/test/SILOptimizer/copy_propagation_opaque.sil @@ -139,7 +139,7 @@ bb3(%11 : @owned $T): // // The non-consuming use now uses the original value. // CHECK-DEBUG-NEXT: debug_value %0 : $T -// CHECK-NEXT: debug_value_addr %1 : $*T +// CHECK-NEXT: debug_value %1 : $*T, expr op_deref // // The original destroy is deleted with optimizations enabled. // CHECK-DEBUG-NEXT: destroy_value %0 : $T @@ -152,7 +152,7 @@ bb0(%arg : @owned $T, %addr : $*T): debug_value %copy : $T store %copy to [assign] %addr : $*T debug_value %arg : $T - debug_value_addr %addr : $*T + debug_value %addr : $*T, expr op_deref destroy_value %arg : $T %v = tuple () return %v : $() diff --git a/test/SILOptimizer/copyforward_ossa.sil b/test/SILOptimizer/copyforward_ossa.sil index cb3b0d3308f6a..7c4670266e3be 100644 --- a/test/SILOptimizer/copyforward_ossa.sil +++ b/test/SILOptimizer/copyforward_ossa.sil @@ -45,7 +45,7 @@ bb2: // Preds: bb0 bb3: // Preds: bb1 bb2 copy_addr [take] %2 to [initialization] %0 : $*T // id: %17 %18 = tuple () // user: %20 - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref dealloc_stack %2 : $*T // id: %19 return %18 : $() // id: %20 } @@ -56,13 +56,13 @@ bb3: // Preds: bb1 bb2 // CHECK-LABEL: } // end sil function 'forward_init' sil hidden [ossa] @forward_init : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %l1 = alloc_stack $T copy_addr %0 to [initialization] %l1 : $*T %f1 = function_ref @f_in : $@convention(thin) <τ_0_0> (@in τ_0_0) -> () %c1 = apply %f1(%l1) : $@convention(thin) <τ_0_0> (@in τ_0_0) -> () dealloc_stack %l1 : $*T - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref destroy_addr %0 : $*T %r1 = tuple () return %r1 : $() @@ -74,13 +74,13 @@ bb0(%0 : $*T): // CHECK-LABEL: } // end sil function 'forward_noinit' sil hidden [ossa] @forward_noinit : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %l1 = alloc_stack $T %f1 = function_ref @f_out : $@convention(thin) <τ_0_0> () -> @out τ_0_0 %c1 = apply %f1(%l1) : $@convention(thin) <τ_0_0> () -> @out τ_0_0 copy_addr %0 to %l1 : $*T - debug_value_addr %l1 : $*T - debug_value_addr %0 : $*T + debug_value %l1 : $*T, expr op_deref + debug_value %0 : $*T, expr op_deref %f2 = function_ref @f_in : $@convention(thin) <τ_0_0> (@in τ_0_0) -> () %c2 = apply %f2(%l1) : $@convention(thin) <τ_0_0> (@in τ_0_0) -> () dealloc_stack %l1 : $*T @@ -95,7 +95,7 @@ bb0(%0 : $*T): // CHECK-LABEL: } // end sil function 'forward_takeinit' sil hidden [ossa] @forward_takeinit : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %l1 = alloc_stack $T copy_addr [take] %0 to [initialization] %l1 : $*T %f1 = function_ref @f_in : $@convention(thin) <τ_0_0> (@in τ_0_0) -> () @@ -111,7 +111,7 @@ bb0(%0 : $*T): // CHECK-LABEL: } // end sil function 'forward_takenoinit' sil hidden [ossa] @forward_takenoinit : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %l1 = alloc_stack $T %f1 = function_ref @f_out : $@convention(thin) <τ_0_0> () -> @out τ_0_0 %c1 = apply %f1(%l1) : $@convention(thin) <τ_0_0> () -> @out τ_0_0 @@ -132,10 +132,10 @@ bb0(%0 : $*T): %l1 = alloc_stack $T %f1 = function_ref @f_out : $@convention(thin) <τ_0_0> () -> @out τ_0_0 %c1 = apply %f1(%l1) : $@convention(thin) <τ_0_0> () -> @out τ_0_0 - debug_value_addr %l1 : $*T + debug_value %l1 : $*T, expr op_deref copy_addr %l1 to [initialization] %0 : $*T - debug_value_addr %0 : $*T - debug_value_addr %l1 : $*T + debug_value %0 : $*T, expr op_deref + debug_value %l1 : $*T, expr op_deref destroy_addr %l1 : $*T dealloc_stack %l1 : $*T %t = tuple () @@ -169,9 +169,9 @@ bb0(%0 : $*T): %l1 = alloc_stack $T %f1 = function_ref @f_out : $@convention(thin) <τ_0_0> () -> @out τ_0_0 %c1 = apply %f1(%l1) : $@convention(thin) <τ_0_0> () -> @out τ_0_0 - debug_value_addr %l1 : $*T + debug_value %l1 : $*T, expr op_deref copy_addr [take] %l1 to [initialization] %0 : $*T - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref dealloc_stack %l1 : $*T %t = tuple () return %t : $() @@ -536,7 +536,7 @@ public struct S { // CHECK-LABEL: sil [ossa] @deadtemp : // CHECK: %[[G:.*]] = struct_element_addr %0 : $*S, #S.g // CHECK-NOT: copy_addr -// CHECK-NOT: debug_value_addr +// CHECK-NOT: debug_value {{.*}} expr op_deref // CHECK: %[[F:.*]] = struct_element_addr %0 : $*S, #S.f // CHECK: copy_addr %[[G]] to %[[F]] : $*T // CHECK-LABEL: } // end sil function 'deadtemp' @@ -545,7 +545,7 @@ bb0(%0 : $*S): %1 = struct_element_addr %0 : $*S, #S.g %2 = alloc_stack $T copy_addr %1 to [initialization] %2 : $*T - debug_value_addr %2 : $*T + debug_value %2 : $*T, expr op_deref %4 = struct_element_addr %0 : $*S, #S.f copy_addr [take] %2 to %4 : $*T dealloc_stack %2 : $*T diff --git a/test/SILOptimizer/cowarray_opt.sil b/test/SILOptimizer/cowarray_opt.sil index 77873a8536090..eca05d73474eb 100644 --- a/test/SILOptimizer/cowarray_opt.sil +++ b/test/SILOptimizer/cowarray_opt.sil @@ -70,7 +70,7 @@ sil @unknown : $@convention(thin) () -> () // CHECK: } // end sil function 'simple_hoist' sil @simple_hoist : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): - debug_value_addr %0 : $*MyArray + debug_value %0 : $*MyArray, expr op_deref %2 = load %0 : $*MyArray br bb1 @@ -224,7 +224,7 @@ bb2: // CHECK: bb3: sil @dont_hoist_if_executed_conditionally : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> MyArray { bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): - debug_value_addr %0 : $*MyArray + debug_value %0 : $*MyArray, expr op_deref %2 = load %0 : $*MyArray br bb1(%2 : $MyArray) diff --git a/test/SILOptimizer/cowarray_opt_ossa.sil b/test/SILOptimizer/cowarray_opt_ossa.sil index 024d56a8a43ce..7dcba769fe6b7 100644 --- a/test/SILOptimizer/cowarray_opt_ossa.sil +++ b/test/SILOptimizer/cowarray_opt_ossa.sil @@ -70,7 +70,7 @@ sil [ossa] @unknown : $@convention(thin) () -> () // CHECK: } // end sil function 'simple_hoist' sil [ossa] @simple_hoist : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> () { bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): - debug_value_addr %0 : $*MyArray + debug_value %0 : $*MyArray, expr op_deref %2 = load [copy] %0 : $*MyArray br bb1 @@ -283,7 +283,7 @@ bb2: // CHECK-LABEL: } // end sil function 'dont_hoist_if_executed_conditionally' sil [ossa] @dont_hoist_if_executed_conditionally : $@convention(thin) (@inout MyArray, @inout Builtin.Int1) -> @owned MyArray { bb0(%0 : $*MyArray, %1 : $*Builtin.Int1): - debug_value_addr %0 : $*MyArray + debug_value %0 : $*MyArray, expr op_deref %2 = load [copy] %0 : $*MyArray br bb1(%2 : $MyArray) diff --git a/test/SILOptimizer/cse.sil b/test/SILOptimizer/cse.sil index afa0be95da856..758a4242643ce 100644 --- a/test/SILOptimizer/cse.sil +++ b/test/SILOptimizer/cse.sil @@ -1125,7 +1125,7 @@ protocol Pingable { func ping() } // CHECK: return sil hidden @CSE_Existential_Simple : $@convention(thin) (@in Pingable) -> () { bb0(%0 : $*Pingable): - debug_value_addr %0 : $*Pingable // let x // id: %1 + debug_value %0 : $*Pingable, expr op_deref // let x // id: %1 %2 = open_existential_addr immutable_access %0 : $*Pingable to $*@opened("1E467EB8-D5C5-11E5-8C0E-A82066121073") Pingable // users: %3, %4 %3 = witness_method $@opened("1E467EB8-D5C5-11E5-8C0E-A82066121073") Pingable, #Pingable.ping, %2 : $*@opened("1E467EB8-D5C5-11E5-8C0E-A82066121073") Pingable : $@convention(witness_method: Pingable) <τ_0_0 where τ_0_0 : Pingable> (@in_guaranteed τ_0_0) -> () // user: %4 %4 = apply %3<@opened("1E467EB8-D5C5-11E5-8C0E-A82066121073") Pingable>(%2) : $@convention(witness_method: Pingable) <τ_0_0 where τ_0_0 : Pingable> (@in_guaranteed τ_0_0) -> () @@ -1140,7 +1140,7 @@ bb0(%0 : $*Pingable): // CHECK-LABEL: CSE_Existential_Calls_With_Control_Flow sil hidden @CSE_Existential_Calls_With_Control_Flow : $@convention(thin) (@in Pingable, Int) -> () { bb0(%0 : $*Pingable, %1 : $Int): - debug_value_addr %0 : $*Pingable // let x // id: %2 + debug_value %0 : $*Pingable, expr op_deref // let x // id: %2 debug_value %1 : $Int // let y // id: %3 %4 = open_existential_addr immutable_access %0 : $*Pingable to $*@opened("75F1B81A-D6CB-11E5-9470-A82066121073") Pingable // users: %5, %6 %5 = witness_method $@opened("75F1B81A-D6CB-11E5-9470-A82066121073") Pingable, #Pingable.ping, %4 : $*@opened("75F1B81A-D6CB-11E5-9470-A82066121073") Pingable : $@convention(witness_method: Pingable) <τ_0_0 where τ_0_0 : Pingable> (@in_guaranteed τ_0_0) -> () // user: %6 diff --git a/test/SILOptimizer/cse_ossa.sil b/test/SILOptimizer/cse_ossa.sil index cca5d7ee2458e..44d8fd21da2c6 100644 --- a/test/SILOptimizer/cse_ossa.sil +++ b/test/SILOptimizer/cse_ossa.sil @@ -1027,7 +1027,7 @@ protocol Pingable { func ping() } // CHECK-LABEL: } // end sil function 'CSE_Existential_Simple' sil hidden [ossa] @CSE_Existential_Simple : $@convention(thin) (@in Pingable) -> () { bb0(%0 : $*Pingable): - debug_value_addr %0 : $*Pingable // let x + debug_value %0 : $*Pingable, expr op_deref // let x %2 = open_existential_addr immutable_access %0 : $*Pingable to $*@opened("1E467EB8-D5C5-11E5-8C0E-A82066121073") Pingable %3 = witness_method $@opened("1E467EB8-D5C5-11E5-8C0E-A82066121073") Pingable, #Pingable.ping, %2 : $*@opened("1E467EB8-D5C5-11E5-8C0E-A82066121073") Pingable : $@convention(witness_method: Pingable) <τ_0_0 where τ_0_0 : Pingable> (@in_guaranteed τ_0_0) -> () %4 = apply %3<@opened("1E467EB8-D5C5-11E5-8C0E-A82066121073") Pingable>(%2) : $@convention(witness_method: Pingable) <τ_0_0 where τ_0_0 : Pingable> (@in_guaranteed τ_0_0) -> () @@ -1042,7 +1042,7 @@ bb0(%0 : $*Pingable): // CHECK-LABEL: sil hidden [ossa] @CSE_Existential_Calls_With_Control_Flow : sil hidden [ossa] @CSE_Existential_Calls_With_Control_Flow : $@convention(thin) (@in Pingable, Int) -> () { bb0(%0 : $*Pingable, %1 : $Int): - debug_value_addr %0 : $*Pingable // let x + debug_value %0 : $*Pingable, expr op_deref // let x debug_value %1 : $Int // let y %4 = open_existential_addr immutable_access %0 : $*Pingable to $*@opened("75F1B81A-D6CB-11E5-9470-A82066121073") Pingable %5 = witness_method $@opened("75F1B81A-D6CB-11E5-9470-A82066121073") Pingable, #Pingable.ping, %4 : $*@opened("75F1B81A-D6CB-11E5-9470-A82066121073") Pingable : $@convention(witness_method: Pingable) <τ_0_0 where τ_0_0 : Pingable> (@in_guaranteed τ_0_0) -> () diff --git a/test/SILOptimizer/dead_store_elim.sil b/test/SILOptimizer/dead_store_elim.sil index d04204b7c87fd..bc118afa5c7e2 100644 --- a/test/SILOptimizer/dead_store_elim.sil +++ b/test/SILOptimizer/dead_store_elim.sil @@ -366,21 +366,20 @@ bb2: return %9999 : $() } -// We cannot remove the local store as the debug_value_addr could -// be turned to a debug_value and thus act as a read on the memory -// location.. +// We cannot remove the local store as the debug_value w/ address value +// could be promoted and thus act as a read on the memory location.. // // CHECK-LABEL: blocking_debug_value_addr_on_dead_store // CHECK: bb0 // CHECK: {{ store}} -// CHECK: debug_value_addr +// CHECK: debug_value %{{.*}} : $*Int sil hidden @blocking_debug_value_addr_on_dead_store : $@convention(thin) () -> () { bb0: %0 = alloc_stack $Int, var, name "a" %1 = integer_literal $Builtin.Int64, 1 %2 = struct $Int (%1 : $Builtin.Int64) store %2 to %0 : $*Int - debug_value_addr %0 : $*Int + debug_value %0 : $*Int %4 = tuple () dealloc_stack %0 : $*Int return %4 : $() diff --git a/test/SILOptimizer/definite_init_closures.sil b/test/SILOptimizer/definite_init_closures.sil index 15edae024a091..18c566d219966 100644 --- a/test/SILOptimizer/definite_init_closures.sil +++ b/test/SILOptimizer/definite_init_closures.sil @@ -45,7 +45,7 @@ bb0(%0 : $Bool): sil private [transparent] [ossa] @implicit_closure_struct : $@convention(thin) (@inout_aliasable SimpleStruct) -> (Bool, @error Error) { bb0(%0 : $*SimpleStruct): - debug_value_addr %0 : $*SimpleStruct, var, name "self", argno 2 + debug_value %0 : $*SimpleStruct, var, name "self", argno 2, expr op_deref %3 = begin_access [read] [static] %0 : $*SimpleStruct %4 = struct_element_addr %3 : $*SimpleStruct, #SimpleStruct.x %5 = load [trivial] %4 : $*Bool diff --git a/test/SILOptimizer/destroy_hoisting.sil b/test/SILOptimizer/destroy_hoisting.sil index 082604afac588..212586871c174 100644 --- a/test/SILOptimizer/destroy_hoisting.sil +++ b/test/SILOptimizer/destroy_hoisting.sil @@ -301,7 +301,7 @@ bb5: // CHECK: } // end sil function 'test_debug_value' sil [ossa] @test_debug_value : $@convention(method) (@inout S2, @owned X, @owned S, @inout E) -> () { bb0(%0 : $*S2, %1 : @owned $X, %2 : @owned $S, %3 : $*E): - debug_value_addr %0 : $*S2, var, name "self", argno 1 + debug_value %0 : $*S2, var, name "self", argno 1, expr op_deref br bb1 bb1: diff --git a/test/SILOptimizer/existential_transform.swift b/test/SILOptimizer/existential_transform.swift index 51ae264f77b83..c84496282a7d3 100644 --- a/test/SILOptimizer/existential_transform.swift +++ b/test/SILOptimizer/existential_transform.swift @@ -196,7 +196,7 @@ internal class KK : PP { // CHECK-LABEL: sil hidden [noinline] @$s21existential_transform13wrap_inout_cp1aSiAA2PP_pz_tF : $@convention(thin) (@inout PP) -> Int { // CHECK: bb0(%0 : $*PP): -// CHECK: debug_value_addr +// CHECK: debug_value {{.*}} expr op_deref // CHECK: load // CHECK: [[O1:%.*]] = open_existential_ref // CHECK: witness_method $@opened("{{.*}}") PP, #PP.foo : (Self) -> () -> Int, %3 : $@opened("{{.*}}PP : $@convention(witness_method: PP) <τ_0_0 where τ_0_0 : PP> (@guaranteed τ_0_0) -> Int @@ -350,9 +350,9 @@ struct MyStruct : Foo { // CHECK: alloc_stack // CHECK: init_existential_addr // CHECK: copy_addr -// CHECK: debug_value_addr +// CHECK: debug_value {{.*}} expr op_deref // CHECK: open_existential_addr -// CHECK: witness_method +// CHECK: witness_method // CHECK: apply // CHECK: dealloc_stack // CHECK: return @@ -382,7 +382,7 @@ class RC: RP { // CHECK: copy_addr // CHECK: debug_value // CHECK: debug_value -// CHECK: debug_value_addr +// CHECK: debug_value {{.*}} expr op_deref // CHECK: struct_extract // CHECK: struct_extract // CHECK: integer_literal diff --git a/test/SILOptimizer/existential_transform_extras.sil b/test/SILOptimizer/existential_transform_extras.sil index 2309e9aafec1d..68b8d77af661a 100644 --- a/test/SILOptimizer/existential_transform_extras.sil +++ b/test/SILOptimizer/existential_transform_extras.sil @@ -60,7 +60,7 @@ bb0: // CHECK-LABEL: sil public_external [serialized] @$s7dealloc20wrap_foo_ncp_another1aSiAA1P_pz_tF : $@convention(thin) (@inout P) -> Int32 { // CHECK: bb0(%0 : $*P): -// CHECK: debug_value_addr +// CHECK: debug_value {{.*}} expr op_deref // CHECK: alloc_stack // CHECK: copy_addr // CHECK: open_existential_addr @@ -72,7 +72,7 @@ bb0: // CHECK-LABEL: } // end sil function '$s7dealloc20wrap_foo_ncp_another1aSiAA1P_pz_tF' sil public_external [serialized] @$s7dealloc20wrap_foo_ncp_another1aSiAA1P_pz_tF : $@convention(thin) (@inout P) -> Int32 { bb0(%0 : $*P): - debug_value_addr %0 : $*P, var, name "a", argno 1 + debug_value %0 : $*P, var, name "a", argno 1, expr op_deref %2 = alloc_stack $P copy_addr %0 to [initialization] %2 : $*P %4 = open_existential_addr immutable_access %2 : $*P to $*@opened("EE9F89E4-ECF4-11E8-8DDF-D0817AD4059B") P @@ -94,7 +94,7 @@ sil_global hidden [let] @$global_var : $P // CHECK-LABEL: sil hidden [noinline] @$helper : $@convention(thin) (@in P) -> Int32 { // CHECK: bb0(%0 : $*P): -// CHECK: debug_value_addr +// CHECK: debug_value {{.*}} expr op_deref // CHECK: alloc_stack // CHECK: copy_addr // CHECK: destroy_addr @@ -106,7 +106,7 @@ sil_global hidden [let] @$global_var : $P // CHECK-LABEL: } // end sil function '$helper' sil hidden [noinline] @$helper : $@convention(thin) (@in P) -> Int32 { bb0(%0 : $*P): - debug_value_addr %0 : $*P, var, name "a", argno 1 + debug_value %0 : $*P, var, name "a", argno 1, expr op_deref %4 = alloc_stack $P copy_addr %0 to [initialization] %4 : $*P destroy_addr %0 : $*P @@ -169,8 +169,8 @@ bb3: // CHECK-LABEL: } // end sil function '$s7dealloc12wrap_foo_ncp1a1bSiAA1P_pz_AaE_pztFTf4ee_n' sil hidden [noinline] @$s7dealloc12wrap_foo_ncp1a1bSiAA1P_pz_AaE_pztF : $@convention(thin) (@in P, @in P) -> Int32 { bb0(%0 : $*P, %1 : $*P): - debug_value_addr %0 : $*P, var, name "a", argno 1 - debug_value_addr %1 : $*P, var, name "b", argno 2 + debug_value %0 : $*P, var, name "a", argno 1, expr op_deref + debug_value %1 : $*P, var, name "b", argno 2, expr op_deref %4 = alloc_stack $P copy_addr %0 to [initialization] %4 : $*P destroy_addr %0 : $*P diff --git a/test/SILOptimizer/existential_transform_extras_ossa.sil b/test/SILOptimizer/existential_transform_extras_ossa.sil index b1e0d03230119..d773ffa0c90f4 100644 --- a/test/SILOptimizer/existential_transform_extras_ossa.sil +++ b/test/SILOptimizer/existential_transform_extras_ossa.sil @@ -80,7 +80,7 @@ bb0: // CHECK-LABEL: sil public_external [serialized] [ossa] @$s7dealloc20wrap_foo_ncp_another1aSiAA1P_pz_tF : $@convention(thin) (@inout P) -> Int32 { // CHECK: bb0(%0 : $*P): -// CHECK: debug_value_addr +// CHECK: debug_value {{.*}} expr op_deref // CHECK: alloc_stack // CHECK: copy_addr // CHECK: open_existential_addr @@ -92,7 +92,7 @@ bb0: // CHECK-LABEL: } // end sil function '$s7dealloc20wrap_foo_ncp_another1aSiAA1P_pz_tF' sil public_external [ossa] [serialized] @$s7dealloc20wrap_foo_ncp_another1aSiAA1P_pz_tF : $@convention(thin) (@inout P) -> Int32 { bb0(%0 : $*P): - debug_value_addr %0 : $*P, var, name "a", argno 1 + debug_value %0 : $*P, var, name "a", argno 1, expr op_deref %2 = alloc_stack $P copy_addr %0 to [initialization] %2 : $*P %4 = open_existential_addr immutable_access %2 : $*P to $*@opened("EE9F89E4-ECF4-11E8-8DDF-D0817AD4059B") P @@ -114,7 +114,7 @@ sil_global hidden [let] @$global_var : $P // CHECK-LABEL: sil hidden [noinline] [ossa] @$helper : $@convention(thin) (@in P) -> Int32 { // CHECK: bb0(%0 : $*P): -// CHECK: debug_value_addr +// CHECK: debug_value {{.*}} expr op_deref // CHECK: alloc_stack // CHECK: copy_addr // CHECK: destroy_addr @@ -126,7 +126,7 @@ sil_global hidden [let] @$global_var : $P // CHECK-LABEL: } // end sil function '$helper' sil hidden [ossa] [noinline] @$helper : $@convention(thin) (@in P) -> Int32 { bb0(%0 : $*P): - debug_value_addr %0 : $*P, var, name "a", argno 1 + debug_value %0 : $*P, var, name "a", argno 1, expr op_deref %4 = alloc_stack $P copy_addr %0 to [initialization] %4 : $*P destroy_addr %0 : $*P @@ -190,8 +190,8 @@ bb3: // CHECK-LABEL: } // end sil function '$s7dealloc12wrap_foo_ncp1a1bSiAA1P_pz_AaE_pztFTf4ee_n' sil hidden [ossa] [noinline] @$s7dealloc12wrap_foo_ncp1a1bSiAA1P_pz_AaE_pztF : $@convention(thin) (@in P, @in P) -> Int32 { bb0(%0 : $*P, %1 : $*P): - debug_value_addr %0 : $*P, var, name "a", argno 1 - debug_value_addr %1 : $*P, var, name "b", argno 2 + debug_value %0 : $*P, var, name "a", argno 1, expr op_deref + debug_value %1 : $*P, var, name "b", argno 2, expr op_deref %4 = alloc_stack $P copy_addr %0 to [initialization] %4 : $*P destroy_addr %0 : $*P diff --git a/test/SILOptimizer/existential_transform_soletype.swift b/test/SILOptimizer/existential_transform_soletype.swift index 37af5f774754f..a477d58285163 100644 --- a/test/SILOptimizer/existential_transform_soletype.swift +++ b/test/SILOptimizer/existential_transform_soletype.swift @@ -19,7 +19,7 @@ internal class SCC: SPP { // CHECK-LABEL: sil hidden [noinline] @$s30existential_transform_soletype4opt11bs5Int32VAA3SPP_p_tF : $@convention(thin) (@in_guaranteed SPP) -> Int32 { // CHECK: bb0(%0 : $*SPP): -// CHECK: debug_value_addr +// CHECK: debug_value {{.*}} expr op_deref // CHECK: function_ref @$s30existential_transform_soletype4opt21bs5Int32VAA3SPP_p_tFTf4e_n : $@convention(thin) <τ_0_0 where τ_0_0 : SPP> (@in_guaranteed τ_0_0) -> Int32 // user: %4 // CHECK: open_existential_addr // CHECK: apply @@ -31,9 +31,9 @@ internal class SCC: SPP { // CHECK: alloc_stack // CHECK: init_existential_addr // CHECK: copy_addr -// CHECK: debug_value_addr +// CHECK: debug_value {{.*}} expr op_deref // CHECK: open_existential_addr -// CHECK: witness_method +// CHECK: witness_method // CHECK: apply // CHECK: dealloc_stack // CHECK: return diff --git a/test/SILOptimizer/function_order.sil b/test/SILOptimizer/function_order.sil index b441f8c23ba15..3704c960de06d 100644 --- a/test/SILOptimizer/function_order.sil +++ b/test/SILOptimizer/function_order.sil @@ -365,7 +365,7 @@ bb0(%0 : $*private_proto_private_class): sil private @call_through_private_proto_1 : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %2 = witness_method $T, #private_proto_1.theMethod : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> () %3 = apply %2(%0) : $@convention(witness_method: private_proto_1) <τ_0_0 where τ_0_0 : private_proto_1> (@in_guaranteed τ_0_0) -> () destroy_addr %0 : $*T @@ -393,7 +393,7 @@ bb0(%0 : $*private_proto_internal_class): sil private @call_through_private_proto_2 : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %2 = witness_method $T, #private_proto_2.theMethod : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> () %3 = apply %2(%0) : $@convention(witness_method: private_proto_2) <τ_0_0 where τ_0_0 : private_proto_2> (@in_guaranteed τ_0_0) -> () destroy_addr %0 : $*T @@ -423,7 +423,7 @@ bb0(%0 : $*private_proto_public_class): sil private @call_through_private_proto_3 : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %2 = witness_method $T, #private_proto_3.theMethod : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> () %3 = apply %2(%0) : $@convention(witness_method: private_proto_3) <τ_0_0 where τ_0_0 : private_proto_3> (@in_guaranteed τ_0_0) -> () destroy_addr %0 : $*T @@ -451,7 +451,7 @@ bb0(%0 : $*private_proto_public_class_private_method): sil private @call_through_private_proto_4 : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref %2 = witness_method $T, #private_proto_4.theMethod : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> () %3 = apply %2(%0) : $@convention(witness_method: private_proto_4) <τ_0_0 where τ_0_0 : private_proto_4> (@in_guaranteed τ_0_0) -> () destroy_addr %0 : $*T diff --git a/test/SILOptimizer/mandatory_inlining.sil b/test/SILOptimizer/mandatory_inlining.sil index 98ed930c6ceea..d65de2b346300 100644 --- a/test/SILOptimizer/mandatory_inlining.sil +++ b/test/SILOptimizer/mandatory_inlining.sil @@ -770,8 +770,8 @@ bb0(%0 : $C): // CHECK-LABEL: sil [transparent] @inner : $@convention(thin) (@in T1, @in T2) -> @out T2 { sil [transparent] @inner : $@convention(thin) (@in T1, @in T2) -> @out T2 { bb0(%0 : $*T2, %1 : $*T1, %2 : $*T2): - debug_value_addr %1 : $*T1 - debug_value_addr %2 : $*T2 + debug_value %1 : $*T1, expr op_deref + debug_value %2 : $*T2, expr op_deref copy_addr [take] %2 to [initialization] %0 : $*T2 destroy_addr %1 : $*T1 %7 = tuple () @@ -784,7 +784,7 @@ bb0(%0 : $*T2, %1 : $*T1, %2 : $*T2): sil [transparent] @middle : $@convention(thin) (Int, @in T) -> @out T { bb0(%0 : $*T, %1 : $Int, %2 : $*T): debug_value %1 : $Int - debug_value_addr %2 : $*T + debug_value %2 : $*T, expr op_deref // CHECK-NOT: [[REF:%[a-zA-Z0-9]+]] = function_ref @inner %5 = function_ref @inner : $@convention(thin) <τ_0_0, τ_0_1> (@in τ_0_0, @in τ_0_1) -> @out τ_0_1 %6 = alloc_stack $Int @@ -851,7 +851,7 @@ bb0(%0 : $Foo): // CHECK-LABEL: sil [transparent] @identity sil [transparent] @identity : $@convention(thin) (@in T) -> @out T { bb0(%0 : $*T, %1 : $*T): - debug_value_addr %1 : $*T + debug_value %1 : $*T, expr op_deref copy_addr [take] %1 to [initialization] %0 : $*T %4 = tuple () // CHECK: return @@ -861,7 +861,7 @@ bb0(%0 : $*T, %1 : $*T): // CHECK-LABEL: sil @applyIdentity sil @applyIdentity : $@convention(thin) (@in T) -> @out T { bb0(%0 : $*T, %1 : $*T): - debug_value_addr %1 : $*T + debug_value %1 : $*T, expr op_deref %3 = function_ref @identity : $@convention(thin) <τ_0_0> (@in τ_0_0) -> @out τ_0_0 %4 = alloc_stack $T copy_addr %1 to [initialization] %4 : $*T @@ -877,7 +877,7 @@ bb0(%0 : $*T, %1 : $*T): // CHECK-LABEL: sil [transparent] @partial sil [transparent] @partial : $@convention(thin) (@in T, @owned @callee_owned (@in T) -> @out U) -> @out U { bb0(%0 : $*U, %1 : $*T, %2 : $@callee_owned (@in T) -> @out U): - debug_value_addr %1 : $*T + debug_value %1 : $*T, expr op_deref debug_value %2 : $@callee_owned (@in T) -> @out U strong_retain %2 : $@callee_owned (@in T) -> @out U %6 = alloc_stack $T diff --git a/test/SILOptimizer/mandatory_inlining_ownership2.sil b/test/SILOptimizer/mandatory_inlining_ownership2.sil index 2d7db97d2c394..707d6455a7d49 100644 --- a/test/SILOptimizer/mandatory_inlining_ownership2.sil +++ b/test/SILOptimizer/mandatory_inlining_ownership2.sil @@ -779,8 +779,8 @@ bb0(%0 : @owned $C): // CHECK-LABEL: sil [transparent] [ossa] @inner : $@convention(thin) (@in T1, @in T2) -> @out T2 { sil [transparent] [ossa] @inner : $@convention(thin) (@in T1, @in T2) -> @out T2 { bb0(%0 : $*T2, %1 : $*T1, %2 : $*T2): - debug_value_addr %1 : $*T1 - debug_value_addr %2 : $*T2 + debug_value %1 : $*T1, expr op_deref + debug_value %2 : $*T2, expr op_deref copy_addr [take] %2 to [initialization] %0 : $*T2 destroy_addr %1 : $*T1 %7 = tuple () @@ -793,7 +793,7 @@ bb0(%0 : $*T2, %1 : $*T1, %2 : $*T2): sil [transparent] [ossa] @middle : $@convention(thin) (Int, @in T) -> @out T { bb0(%0 : $*T, %1 : $Int, %2 : $*T): debug_value %1 : $Int - debug_value_addr %2 : $*T + debug_value %2 : $*T, expr op_deref // CHECK-NOT: [[REF:%[a-zA-Z0-9]+]] = function_ref @inner %5 = function_ref @inner : $@convention(thin) <τ_0_0, τ_0_1> (@in τ_0_0, @in τ_0_1) -> @out τ_0_1 %6 = alloc_stack $Int @@ -866,7 +866,7 @@ bb0(%0 : @owned $Foo): // CHECK-LABEL: sil [transparent] [ossa] @identity sil [transparent] [ossa] @identity : $@convention(thin) (@in T) -> @out T { bb0(%0 : $*T, %1 : $*T): - debug_value_addr %1 : $*T + debug_value %1 : $*T, expr op_deref copy_addr [take] %1 to [initialization] %0 : $*T %4 = tuple () // CHECK: return @@ -876,7 +876,7 @@ bb0(%0 : $*T, %1 : $*T): // CHECK-LABEL: sil [ossa] @applyIdentity sil [ossa] @applyIdentity : $@convention(thin) (@in T) -> @out T { bb0(%0 : $*T, %1 : $*T): - debug_value_addr %1 : $*T + debug_value %1 : $*T, expr op_deref %3 = function_ref @identity : $@convention(thin) <τ_0_0> (@in τ_0_0) -> @out τ_0_0 %4 = alloc_stack $T copy_addr %1 to [initialization] %4 : $*T @@ -896,7 +896,7 @@ bb0(%0 : $*T, %1 : $*T): // CHECK: } // end sil function 'partial' sil [transparent] [ossa] @partial : $@convention(thin) (@in T, @owned @callee_owned (@in T) -> @out U) -> @out U { bb0(%0 : $*U, %1 : $*T, %2 : @owned $@callee_owned (@in T) -> @out U): - debug_value_addr %1 : $*T + debug_value %1 : $*T, expr op_deref debug_value %2 : $@callee_owned (@in T) -> @out U %2copy = copy_value %2 : $@callee_owned (@in T) -> @out U %6 = alloc_stack $T diff --git a/test/SILOptimizer/mem-behavior-cache-bug.sil b/test/SILOptimizer/mem-behavior-cache-bug.sil index b9dba86a6b881..47e50022e449b 100644 --- a/test/SILOptimizer/mem-behavior-cache-bug.sil +++ b/test/SILOptimizer/mem-behavior-cache-bug.sil @@ -30,7 +30,7 @@ sil [ossa] @callee : $@convention(method) (@in_guaranteed Complex, Bool, @thin Complex.Type) -> @out Complex { bb0(%0 : $*Complex, %1 : $*Complex, %2 : $Bool, %3 : $@thin Complex.Type): - debug_value_addr %1 : $*Complex, let, name "z", argno 1 + debug_value %1 : $*Complex, let, name "z", argno 1, expr op_deref debug_value %2 : $Bool, let, name "b", argno 2 debug_value %3 : $@thin Complex.Type, let, name "self", argno 3 %7 = alloc_stack $RealType, let, name "θ" diff --git a/test/SILOptimizer/mem2reg.sil b/test/SILOptimizer/mem2reg.sil index 3452e3c42bfe2..5d9c62b2c0d2f 100644 --- a/test/SILOptimizer/mem2reg.sil +++ b/test/SILOptimizer/mem2reg.sil @@ -178,16 +178,16 @@ bb0(%0 : $*()): return %3 : $() } -// CHECK-LABEL: sil @mem2reg_debug_value_addr +// CHECK-LABEL: sil @mem2reg_debug_value // CHECK-NOT: alloc_stack -// CHECK-NOT: debug_value_addr +// CHECK-NOT: debug_value {{.*}} expr op_deref // CHECK: debug_value %0 // CHECK: return -sil @mem2reg_debug_value_addr : $@convention(thin) (Int) -> Int { +sil @mem2reg_debug_value : $@convention(thin) (Int) -> Int { bb0(%0 : $Int): %1 = alloc_stack $Int store %0 to %1 : $*Int - debug_value_addr %1 : $*Int + debug_value %1 : $*Int, expr op_deref %2 = load %1 : $*Int dealloc_stack %1 : $*Int return %2 : $Int @@ -327,8 +327,8 @@ sil @no_real_uses : $@convention(thin) () -> () { bb0: // CHECK-NOT: alloc_stack %0 = alloc_stack $Builtin.Int32 - // CHECK-NOT: debug_value_addr - debug_value_addr %0 : $*Builtin.Int32, let, name "x", argno 1 + // CHECK-NOT: debug_value {{.*}} expr op_deref + debug_value %0 : $*Builtin.Int32, let, name "x", argno 1, expr op_deref // CHECK-NOT: dealloc_stack dealloc_stack %0 : $*Builtin.Int32 // CHECK: [[VAL:%.*]] = tuple () diff --git a/test/SILOptimizer/mem2reg_ossa.sil b/test/SILOptimizer/mem2reg_ossa.sil index 9ccfc15d70f91..66166e783df72 100644 --- a/test/SILOptimizer/mem2reg_ossa.sil +++ b/test/SILOptimizer/mem2reg_ossa.sil @@ -178,16 +178,16 @@ bb0(%0 : $*()): return %3 : $() } -// CHECK-LABEL: sil [ossa] @mem2reg_debug_value_addr : +// CHECK-LABEL: sil [ossa] @mem2reg_debug_value : // CHECK-NOT: alloc_stack -// CHECK-NOT: debug_value_addr +// CHECK-NOT: debug_value {{.*}} expr op_deref // CHECK: debug_value %0 -// CHECK-LABEL: } // end sil function 'mem2reg_debug_value_addr' -sil [ossa] @mem2reg_debug_value_addr : $@convention(thin) (Int) -> Int { +// CHECK-LABEL: } // end sil function 'mem2reg_debug_value' +sil [ossa] @mem2reg_debug_value : $@convention(thin) (Int) -> Int { bb0(%0 : $Int): %1 = alloc_stack $Int store %0 to [trivial] %1 : $*Int - debug_value_addr %1 : $*Int + debug_value %1 : $*Int, expr op_deref %2 = load [trivial] %1 : $*Int dealloc_stack %1 : $*Int return %2 : $Int @@ -327,8 +327,8 @@ sil [ossa] @no_real_uses : $@convention(thin) () -> () { bb0: // CHECK-NOT: alloc_stack %0 = alloc_stack [dynamic_lifetime] $Builtin.Int32 - // CHECK-NOT: debug_value_addr - debug_value_addr %0 : $*Builtin.Int32, let, name "x", argno 1 + // CHECK-NOT: debug_value {{.*}} expr op_deref + debug_value %0 : $*Builtin.Int32, let, name "x", argno 1, expr op_deref // CHECK-NOT: dealloc_stack dealloc_stack %0 : $*Builtin.Int32 %1 = tuple () diff --git a/test/SILOptimizer/mem2reg_ossa_nontrivial.sil b/test/SILOptimizer/mem2reg_ossa_nontrivial.sil index fd3023a8d382d..3db25869b706d 100644 --- a/test/SILOptimizer/mem2reg_ossa_nontrivial.sil +++ b/test/SILOptimizer/mem2reg_ossa_nontrivial.sil @@ -51,7 +51,7 @@ sil [ossa] @take_nontrivialstruct : $@convention(thin) (@owned NonTrivialStruct) sil [noinline] [ossa] @blackhole : $@convention(thin) (@in_guaranteed T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T, let, name "t", argno 1 + debug_value %0 : $*T, let, name "t", argno 1, expr op_deref %2 = tuple () return %2 : $() } @@ -562,16 +562,16 @@ bb3: return %res : $() } -// CHECK-LABEL: sil [ossa] @mem2reg_debug_value_addr : +// CHECK-LABEL: sil [ossa] @mem2reg_debug_value : // CHECK-NOT: alloc_stack -// CHECK-NOT: debug_value_addr +// CHECK-NOT: debug_value {{.*}} expr op_deref // CHECK: debug_value %0 -// CHECK-LABEL: } // end sil function 'mem2reg_debug_value_addr' -sil [ossa] @mem2reg_debug_value_addr : $@convention(thin) (@owned Klass) -> @owned Klass { +// CHECK-LABEL: } // end sil function 'mem2reg_debug_value' +sil [ossa] @mem2reg_debug_value : $@convention(thin) (@owned Klass) -> @owned Klass { bb0(%0 : @owned $Klass): %1 = alloc_stack $Klass store %0 to [init] %1 : $*Klass - debug_value_addr %1 : $*Klass + debug_value %1 : $*Klass, expr op_deref %2 = load [take] %1 : $*Klass dealloc_stack %1 : $*Klass return %2 : $Klass @@ -682,8 +682,8 @@ bb0: %0 = alloc_stack $Klass %local = alloc_ref $Klass store %local to [init] %0 : $*Klass - // CHECK-NOT: debug_value_addr - debug_value_addr %0 : $*Klass + // CHECK-NOT: debug_value {{.*}} expr op_deref + debug_value %0 : $*Klass, expr op_deref destroy_addr %0 : $*Klass // CHECK-NOT: dealloc_stack dealloc_stack %0 : $*Klass @@ -717,7 +717,7 @@ bb0(%0 : @owned $Klass): debug_value %0 : $Klass %2 = alloc_stack $Klass store %0 to [init] %2 : $*Klass - debug_value_addr %2 : $*Klass + debug_value %2 : $*Klass, expr op_deref %5 = load [take] %2 : $*Klass destroy_value %5 : $Klass dealloc_stack %2 : $*Klass diff --git a/test/SILOptimizer/mem2reg_resilient.sil b/test/SILOptimizer/mem2reg_resilient.sil index 6df88cc0b7b4d..faf44aefab174 100644 --- a/test/SILOptimizer/mem2reg_resilient.sil +++ b/test/SILOptimizer/mem2reg_resilient.sil @@ -8,7 +8,7 @@ public struct ResilientStruct { var x: AnyObject } -// CHECK-LABEL: sil @mem2reg_debug_value_addr : +// CHECK-LABEL: sil @mem2reg_debug_value : // CHECK: bb0(%0 : $*ResilientStruct): // CHECK-NEXT: %1 = load %0 // CHECK-NEXT: retain_value %1 @@ -16,14 +16,14 @@ public struct ResilientStruct { // CHECK-NEXT: release_value %1 // CHECK-NEXT: tuple () // CHECK-NEXT: return {{%.*}} : $() -// CHECK: } // end sil function 'mem2reg_debug_value_addr' -sil @mem2reg_debug_value_addr : $@convention(thin) (@in_guaranteed ResilientStruct) -> () { +// CHECK: } // end sil function 'mem2reg_debug_value' +sil @mem2reg_debug_value : $@convention(thin) (@in_guaranteed ResilientStruct) -> () { bb0(%0 : $*ResilientStruct): %1 = alloc_stack $ResilientStruct %2 = load %0 : $*ResilientStruct retain_value %2 : $ResilientStruct store %2 to %1 : $*ResilientStruct - debug_value_addr %1 : $*ResilientStruct + debug_value %1 : $*ResilientStruct, expr op_deref %3 = load %1 : $*ResilientStruct destroy_addr %1 : $*ResilientStruct dealloc_stack %1 : $*ResilientStruct diff --git a/test/SILOptimizer/mem2reg_resilient_ossa.sil b/test/SILOptimizer/mem2reg_resilient_ossa.sil index 25ee0ef094308..02f8910b19625 100644 --- a/test/SILOptimizer/mem2reg_resilient_ossa.sil +++ b/test/SILOptimizer/mem2reg_resilient_ossa.sil @@ -8,18 +8,18 @@ public struct ResilientStruct { var x: AnyObject } -// CHECK-LABEL: sil [ossa] @mem2reg_debug_value_addr : +// CHECK-LABEL: sil [ossa] @mem2reg_debug_value : // CHECK: bb0(%0 : $*ResilientStruct): // CHECK-NEXT: %1 = load [copy] %0 : $*ResilientStruct // CHECK-NEXT: debug_value %1 : $ResilientStruct // CHECK-NEXT: destroy_value %1 : $ResilientStruct -// CHECK-LABEL: } // end sil function 'mem2reg_debug_value_addr' -sil [ossa] @mem2reg_debug_value_addr : $@convention(thin) (@in_guaranteed ResilientStruct) -> () { +// CHECK-LABEL: } // end sil function 'mem2reg_debug_value' +sil [ossa] @mem2reg_debug_value : $@convention(thin) (@in_guaranteed ResilientStruct) -> () { bb0(%0 : $*ResilientStruct): %1 = alloc_stack $ResilientStruct %2 = load [copy] %0 : $*ResilientStruct store %2 to [init] %1 : $*ResilientStruct - debug_value_addr %1 : $*ResilientStruct + debug_value %1 : $*ResilientStruct, expr op_deref %3 = load [take] %1 : $*ResilientStruct destroy_value %3 : $ResilientStruct dealloc_stack %1 : $*ResilientStruct diff --git a/test/SILOptimizer/mem2reg_unreachable.sil b/test/SILOptimizer/mem2reg_unreachable.sil index b179411f4d6b4..569eaa0d78913 100644 --- a/test/SILOptimizer/mem2reg_unreachable.sil +++ b/test/SILOptimizer/mem2reg_unreachable.sil @@ -47,7 +47,7 @@ bb0: unreachable bb1: - debug_value_addr %0 : $*S, let, name "newvalue", argno 1 + debug_value %0 : $*S, let, name "newvalue", argno 1, expr op_deref br bb2 bb2: diff --git a/test/SILOptimizer/mem2reg_unreachable_ossa.sil b/test/SILOptimizer/mem2reg_unreachable_ossa.sil index c6cda0dcd2553..4f2fb67ac8308 100644 --- a/test/SILOptimizer/mem2reg_unreachable_ossa.sil +++ b/test/SILOptimizer/mem2reg_unreachable_ossa.sil @@ -57,7 +57,7 @@ bb0: unreachable bb1: - debug_value_addr %0 : $*S, let, name "newvalue", argno 1 + debug_value %0 : $*S, let, name "newvalue", argno 1, expr op_deref br bb2 bb2: diff --git a/test/SILOptimizer/predictable_memaccess_opts.sil b/test/SILOptimizer/predictable_memaccess_opts.sil index d97d0b98fb34f..f24387b883acd 100644 --- a/test/SILOptimizer/predictable_memaccess_opts.sil +++ b/test/SILOptimizer/predictable_memaccess_opts.sil @@ -1968,9 +1968,9 @@ bb0(%0 : $MyInt, %1 : @guaranteed $Foo, %2 : @guaranteed $Baz): %8 = alloc_stack $Baz %9 = copy_value %2 : $Baz store %9 to [init] %8 : $*Baz - debug_value_addr %3 : $*MyInt, var, name "x", argno 1 - debug_value_addr %5 : $*Foo, var, name "y", argno 2 - debug_value_addr %8 : $*Baz, var, name "z", argno 3 + debug_value %3 : $*MyInt, var, name "x", argno 1, expr op_deref + debug_value %5 : $*Foo, var, name "y", argno 2, expr op_deref + debug_value %8 : $*Baz, var, name "z", argno 3, expr op_deref %14 = load [trivial] %3 : $*MyInt %15 = load [copy] %5 : $*Foo diff --git a/test/SILOptimizer/predictable_memopt_ownership.sil b/test/SILOptimizer/predictable_memopt_ownership.sil index 08acda8180db6..2281dd746ab4c 100644 --- a/test/SILOptimizer/predictable_memopt_ownership.sil +++ b/test/SILOptimizer/predictable_memopt_ownership.sil @@ -1367,9 +1367,9 @@ bb0(%0 : $MyInt, %1 : @guaranteed $Foo, %2 : @guaranteed $Baz): %8 = alloc_stack $Baz %9 = copy_value %2 : $Baz store %9 to [init] %8 : $*Baz - debug_value_addr %3 : $*MyInt, var, name "x", argno 1 - debug_value_addr %5 : $*Foo, var, name "y", argno 2 - debug_value_addr %8 : $*Baz, var, name "z", argno 3 + debug_value %3 : $*MyInt, var, name "x", argno 1, expr op_deref + debug_value %5 : $*Foo, var, name "y", argno 2, expr op_deref + debug_value %8 : $*Baz, var, name "z", argno 3, expr op_deref %14 = load [trivial] %3 : $*MyInt %15 = load [copy] %5 : $*Foo diff --git a/test/SILOptimizer/sil_combiner_concrete_prop_all_args.sil b/test/SILOptimizer/sil_combiner_concrete_prop_all_args.sil index 6bc15f3740aa9..805c69b2fbf66 100644 --- a/test/SILOptimizer/sil_combiner_concrete_prop_all_args.sil +++ b/test/SILOptimizer/sil_combiner_concrete_prop_all_args.sil @@ -381,7 +381,7 @@ bb0(%0 : $KK): sil hidden [noinline] @$s21existential_transform13wrap_inout_cp1as5Int32VAA2PP_pz_tF : $@convention(thin) (@inout PP) -> Int32 { bb0(%0 : $*PP): - debug_value_addr %0 : $*PP, var, name "a", argno 1 + debug_value %0 : $*PP, var, name "a", argno 1, expr op_deref %2 = load %0 : $*PP %3 = open_existential_ref %2 : $PP to $@opened("CC969B02-AC7C-11E8-B742-D0817AD4059B") PP %4 = witness_method $@opened("CC969B02-AC7C-11E8-B742-D0817AD4059B") PP, #PP.foo : (Self) -> () -> Int32, %3 : $@opened("CC969B02-AC7C-11E8-B742-D0817AD4059B") PP : $@convention(witness_method: PP) <τ_0_0 where τ_0_0 : PP> (@guaranteed τ_0_0) -> Int32 diff --git a/test/SILOptimizer/simplify_cfg_address_phi.sil b/test/SILOptimizer/simplify_cfg_address_phi.sil index a6ac46ac17ee9..6b0d094fe5649 100644 --- a/test/SILOptimizer/simplify_cfg_address_phi.sil +++ b/test/SILOptimizer/simplify_cfg_address_phi.sil @@ -135,7 +135,7 @@ bb5: return %val : $Builtin.Int32 } -// Test that debug_value_addr is not unnecessarilly lost during address projection sinking. +// Test that debug_value is not unnecessarilly lost during address projection sinking. public class CC { let r : R init(_ _r: R) { r = _r } @@ -144,10 +144,10 @@ public class CC { sil @useAny : $@convention(thin) (@in_guaranteed V) -> () // CHECK-LABEL: sil @testDebugValue : $@convention(method) (@in_guaranteed S, @guaranteed CC, Bool) -> () { -// CHECK: debug_value_addr %0 : $*S, let, name "u" +// CHECK: debug_value %0 : $*S, let, name "u", expr op_deref // CHECK: apply %{{.*}}(%0) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () // CHECK: [[FIELD:%.*]] = ref_element_addr %1 : $CC, #CC.r -// CHECK: debug_value_addr [[FIELD]] : $*R, let, name "u" +// CHECK: debug_value [[FIELD]] : $*R, let, name "u", expr op_deref // CHECK: apply %{{.*}}([[FIELD]]) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () // CHECK-LABEL: } // end sil function 'testDebugValue' sil @testDebugValue : $@convention(method) (@in_guaranteed S, @guaranteed CC, Bool) -> () { @@ -156,18 +156,18 @@ bb0(%0 : $*S, %1 : $CC, %2 : $Bool): cond_br %bool, bb1, bb2 bb1: - debug_value_addr %0 : $*S, let, name "u" + debug_value %0 : $*S, let, name "u", expr op_deref %f1 = function_ref @useAny : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () %call1 = apply %f1(%0) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () br bb2 bb2: %field = ref_element_addr %1 : $CC, #CC.r - debug_value_addr %field : $*R, let, name "t" + debug_value %field : $*R, let, name "t", expr op_deref cond_br %bool, bb3, bb4 bb3: - debug_value_addr %field : $*R, let, name "u" + debug_value %field : $*R, let, name "u", expr op_deref %f2 = function_ref @useAny : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () %call2 = apply %f2(%field) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () br bb4 diff --git a/test/SILOptimizer/simplify_cfg_simple_jumpthread.sil b/test/SILOptimizer/simplify_cfg_simple_jumpthread.sil index 5a59d3fe3fb1f..3ad12eaa3cc7f 100644 --- a/test/SILOptimizer/simplify_cfg_simple_jumpthread.sil +++ b/test/SILOptimizer/simplify_cfg_simple_jumpthread.sil @@ -22,7 +22,7 @@ sil @getC : $@convention(thin) () -> C protocol P {} -// Test that debug_value_addr is not unnecessarilly lost during address projection sinking. +// Test that debug_value is not unnecessarilly lost during address projection sinking. public class CC { let r : R init(_ _r: R) { r = _r } @@ -89,10 +89,10 @@ bb5: } // CHECK-LABEL: sil @testDebugValue : $@convention(method) (@in_guaranteed S, @guaranteed CC, Bool) -> () { -// CHECK: debug_value_addr %0 : $*S, let, name "u" +// CHECK: debug_value %0 : $*S, let, name "u", expr op_deref // CHECK: apply %{{.*}}(%0) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () // CHECK: [[FIELD:%.*]] = ref_element_addr %1 : $CC, #CC.r -// CHECK: debug_value_addr [[FIELD]] : $*R, let, name "u" +// CHECK: debug_value [[FIELD]] : $*R, let, name "u", expr op_deref // CHECK: apply %{{.*}}([[FIELD]]) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () // CHECK-LABEL: } // end sil function 'testDebugValue' sil @testDebugValue : $@convention(method) (@in_guaranteed S, @guaranteed CC, Bool) -> () { @@ -101,18 +101,18 @@ bb0(%0 : $*S, %1 : $CC, %2 : $Bool): cond_br %bool, bb1, bb2 bb1: - debug_value_addr %0 : $*S, let, name "u" + debug_value %0 : $*S, let, name "u", expr op_deref %f1 = function_ref @useAny : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () %call1 = apply %f1(%0) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () br bb2 bb2: %field = ref_element_addr %1 : $CC, #CC.r - debug_value_addr %field : $*R, let, name "t" + debug_value %field : $*R, let, name "t", expr op_deref cond_br %bool, bb3, bb4 bb3: - debug_value_addr %field : $*R, let, name "u" + debug_value %field : $*R, let, name "u", expr op_deref %f2 = function_ref @useAny : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () %call2 = apply %f2(%field) : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> () br bb4 diff --git a/test/SILOptimizer/specialize.sil b/test/SILOptimizer/specialize.sil index c4a1a051cc7c5..7880e2e09fb05 100644 --- a/test/SILOptimizer/specialize.sil +++ b/test/SILOptimizer/specialize.sil @@ -73,7 +73,7 @@ bb0: sil [noinline] @XXX_init : $@convention(thin) (@in T, @thin XXX.Type) -> @out XXX { bb0(%0 : $*XXX, %1 : $*T, %2 : $@thin XXX.Type): %3 = alloc_stack $XXX, var, name "sf" // users: %7, %11, %13 - debug_value_addr %1 : $*T, let, name "t" // id: %4 + debug_value %1 : $*T, let, name "t", expr op_deref // id: %4 %5 = alloc_stack $T // users: %6, %8, %9 copy_addr %1 to [initialization] %5 : $*T // id: %6 %7 = struct_element_addr %3 : $*XXX, #XXX.m_t // user: %8 @@ -89,7 +89,7 @@ bb0(%0 : $*XXX, %1 : $*T, %2 : $@thin XXX.Type): // specialize.XXX.foo (@inout specialize.XXX)(t : A) -> Swift.Int32 sil [noinline] @XXX_foo : $@convention(method) (@in T, @inout XXX) -> Int32 { bb0(%0 : $*T, %1 : $*XXX): - debug_value_addr %0 : $*T, let, name "t" // id: %2 + debug_value %0 : $*T, let, name "t", expr op_deref // id: %2 %3 = alloc_stack $T // users: %4, %6, %7 copy_addr %0 to [initialization] %3 : $*T // id: %4 %5 = struct_element_addr %1 : $*XXX, #XXX.m_t // user: %6 @@ -190,7 +190,7 @@ bb0(%0 : $*T, %1 : $@callee_owned () -> @out T): // specialize.getGenericClosure (t : A) -> () -> A sil @getGenericClosure : $@convention(thin) (@in T) -> @owned @callee_owned () -> @out T { bb0(%0 : $*T): - debug_value_addr %0 : $*T, let, name "t" // id: %1 + debug_value %0 : $*T, let, name "t", expr op_deref // id: %1 // function_ref specialize.(getGenericClosure (t : A) -> () -> A).(tmp #1) (())A %2 = function_ref @getGenericClosure_closure : $@convention(thin) <τ_0_0> (@owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 // user: %5 %3 = alloc_box $<τ_0_0> { var τ_0_0 } // users: %4, %5, %5 @@ -334,7 +334,7 @@ bb0(%0 : $*C): // test4.boo (A) -> (Swift.Int32, B) -> Swift.Int32 sil hidden [noinline] @boo : $@convention(thin) (@in U) -> @owned @callee_owned (Int32, @in T) -> Int32 { bb0(%0 : $*U): - debug_value_addr %0 : $*U, let, name "y" // id: %1 + debug_value %0 : $*U, let, name "y", expr op_deref // id: %1 // function_ref test4.(boo (A) -> (Swift.Int32, B) -> Swift.Int32).(closure #1) %2 = function_ref @boo_closure : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : P> (Int32, @in τ_0_1, @owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> Int32 // user: %5 %3 = alloc_box $<τ_0_0> { var τ_0_0 } // users: %4, %5, %5 @@ -350,7 +350,7 @@ sil shared [noinline] @boo_closure : $@convention(thin) (Int3 bb0(%0 : $Int32, %1 : $*T, %2 : $<τ_0_0> { var τ_0_0 } ): %3 = project_box %2 : $<τ_0_0> { var τ_0_0 } , 0 debug_value %0 : $Int32, let, name "x" // id: %4 - debug_value_addr %1 : $*T, let, name "z" // id: %5 + debug_value %1 : $*T, let, name "z", expr op_deref // id: %5 %6 = witness_method $U, #P.get : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> Int32 // user: %7 %7 = apply %6(%3) : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> Int32 // user: %8 %8 = struct_extract %7 : $Int32, #Int32._value // user: %11 @@ -383,8 +383,8 @@ bb0(%0 : $Int32, %1 : $Int32): // test4.foo (A, B) -> (Swift.Int32, Swift.Float) -> Swift.Int32 sil hidden [noinline] @foo : $@convention(thin) (@in T, @in U) -> @owned @callee_owned (Int32, Float) -> Int32 { bb0(%0 : $*T, %1 : $*U): - debug_value_addr %0 : $*T, let, name "x" // id: %2 - debug_value_addr %1 : $*U, let, name "y" // id: %3 + debug_value %0 : $*T, let, name "x", expr op_deref // id: %2 + debug_value %1 : $*U, let, name "y", expr op_deref // id: %3 // function_ref test4.boo (A) -> (Swift.Int32, B) -> Swift.Int32 %4 = function_ref @boo : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : P> (@in τ_0_0) -> @owned @callee_owned (Int32, @in τ_0_1) -> Int32 // user: %7 %5 = alloc_stack $U // users: %6, %7, %10 @@ -412,7 +412,7 @@ bb0(%0 : $Int32, %1 : $Float, %2 : $@callee_owned (Int32, @in Float) -> Int32): // test4.gen1 (A) -> (Swift.Int32) -> Swift.Int32 sil hidden [noinline] @gen1 : $@convention(thin) (@in T) -> @owned @callee_owned (Int32) -> Int32 { bb0(%0 : $*T): - debug_value_addr %0 : $*T, let, name "x" // id: %1 + debug_value %0 : $*T, let, name "x", expr op_deref // id: %1 // function_ref test4.(gen1 (A) -> (Swift.Int32) -> Swift.Int32).(closure #1) %2 = function_ref @gen1_closure : $@convention(thin) <τ_0_0 where τ_0_0 : P> (Int32, @owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> Int32 // user: %5 %3 = alloc_box $<τ_0_0> { var τ_0_0 } // users: %4, %5, %5 diff --git a/test/SILOptimizer/specialize_opaque_result_types2.sil b/test/SILOptimizer/specialize_opaque_result_types2.sil index d304e6b3410b9..4ee89011af349 100644 --- a/test/SILOptimizer/specialize_opaque_result_types2.sil +++ b/test/SILOptimizer/specialize_opaque_result_types2.sil @@ -25,7 +25,7 @@ sil @getGenericClosure_closure : $@convention(thin) (@owned <τ_0_0> { var sil [noinline] @getGenericClosure : $@convention(thin) (@in T) -> @owned @callee_owned () -> @out T { bb0(%0 : $*T): - debug_value_addr %0 : $*T, let, name "t" // id: %1 + debug_value %0 : $*T, let, name "t", expr op_deref // id: %1 %2 = function_ref @getGenericClosure_closure : $@convention(thin) <τ_0_0> (@owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 // user: %5 %3 = alloc_box $<τ_0_0> { var τ_0_0 } // users: %4, %5, %5 %3a = project_box %3 : $<τ_0_0> { var τ_0_0 } , 0 diff --git a/test/SILOptimizer/specialize_ossa.sil b/test/SILOptimizer/specialize_ossa.sil index fd08111f54602..a0faab80e48e9 100644 --- a/test/SILOptimizer/specialize_ossa.sil +++ b/test/SILOptimizer/specialize_ossa.sil @@ -58,7 +58,7 @@ struct XXX { sil [ossa] [noinline] @XXX_init : $@convention(thin) (@in T, @thin XXX.Type) -> @out XXX { bb0(%0 : $*XXX, %1 : $*T, %2 : $@thin XXX.Type): %3 = alloc_stack $XXX, var, name "sf" // users: %7, %11, %13 - debug_value_addr %1 : $*T, let, name "t" // id: %4 + debug_value %1 : $*T, let, name "t", expr op_deref // id: %4 %5 = alloc_stack $T // users: %6, %8, %9 copy_addr %1 to [initialization] %5 : $*T // id: %6 %7 = struct_element_addr %3 : $*XXX, #XXX.m_t // user: %8 @@ -74,7 +74,7 @@ bb0(%0 : $*XXX, %1 : $*T, %2 : $@thin XXX.Type): // specialize.XXX.foo (@inout specialize.XXX)(t : A) -> Swift.Int32 sil [ossa] [noinline] @XXX_foo : $@convention(method) (@in T, @inout XXX) -> Int32 { bb0(%0 : $*T, %1 : $*XXX): - debug_value_addr %0 : $*T, let, name "t" // id: %2 + debug_value %0 : $*T, let, name "t", expr op_deref // id: %2 %3 = alloc_stack $T // users: %4, %6, %7 copy_addr %0 to [initialization] %3 : $*T // id: %4 %5 = struct_element_addr %1 : $*XXX, #XXX.m_t // user: %6 @@ -89,7 +89,7 @@ bb0(%0 : $*T, %1 : $*XXX): sil [ossa] [noinline] @XXX_init_guaranteed : $@convention(thin) (@in_guaranteed T, @thin XXX.Type) -> @out XXX { bb0(%0 : $*XXX, %1 : $*T, %2 : $@thin XXX.Type): %3 = alloc_stack $XXX, var, name "sf" // users: %7, %11, %13 - debug_value_addr %1 : $*T, let, name "t" // id: %4 + debug_value %1 : $*T, let, name "t", expr op_deref // id: %4 %5 = alloc_stack $T // users: %6, %8, %9 copy_addr %1 to [initialization] %5 : $*T // id: %6 %7 = struct_element_addr %3 : $*XXX, #XXX.m_t // user: %8 @@ -104,7 +104,7 @@ bb0(%0 : $*XXX, %1 : $*T, %2 : $@thin XXX.Type): // specialize.XXX.foo (@inout specialize.XXX)(t : A) -> Swift.Int32 sil [ossa] [noinline] @XXX_foo_guaranteed : $@convention(method) (@in_guaranteed T, @inout XXX) -> Int32 { bb0(%0 : $*T, %1 : $*XXX): - debug_value_addr %0 : $*T, let, name "t" // id: %2 + debug_value %0 : $*T, let, name "t", expr op_deref // id: %2 %3 = alloc_stack $T // users: %4, %6, %7 copy_addr %0 to [initialization] %3 : $*T // id: %4 %5 = struct_element_addr %1 : $*XXX, #XXX.m_t // user: %6 @@ -251,7 +251,7 @@ bb0(%0 : $*T, %1 : @owned $@callee_owned () -> @out T): // specialize.getGenericClosure (t : A) -> () -> A sil [ossa] @getGenericClosure : $@convention(thin) (@in T) -> @owned @callee_owned () -> @out T { bb0(%0 : $*T): - debug_value_addr %0 : $*T, let, name "t" // id: %1 + debug_value %0 : $*T, let, name "t", expr op_deref // id: %1 // function_ref specialize.(getGenericClosure (t : A) -> () -> A).(tmp #1) (())A %2 = function_ref @getGenericClosure_closure : $@convention(thin) <τ_0_0> (@owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> @out τ_0_0 // user: %5 %3 = alloc_box $<τ_0_0> { var τ_0_0 } @@ -384,7 +384,7 @@ bb0(%0 : $*C): // test4.boo (A) -> (Swift.Int32, B) -> Swift.Int32 sil hidden [ossa] [noinline] @boo : $@convention(thin) (@in U) -> @owned @callee_owned (Int32, @in T) -> Int32 { bb0(%0 : $*U): - debug_value_addr %0 : $*U, let, name "y" // id: %1 + debug_value %0 : $*U, let, name "y", expr op_deref // id: %1 // function_ref test4.(boo (A) -> (Swift.Int32, B) -> Swift.Int32).(closure #1) %2 = function_ref @boo_closure : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : P> (Int32, @in τ_0_1, @owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> Int32 // user: %5 %3 = alloc_box $<τ_0_0> { var τ_0_0 } // users: %4, %5, %5 @@ -400,7 +400,7 @@ sil shared [ossa] [noinline] @boo_closure : $@convention(thin) { var τ_0_0 } ): %3 = project_box %2 : $<τ_0_0> { var τ_0_0 } , 0 debug_value %0 : $Int32, let, name "x" // id: %4 - debug_value_addr %1 : $*T, let, name "z" // id: %5 + debug_value %1 : $*T, let, name "z", expr op_deref // id: %5 %6 = witness_method $U, #P.get : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> Int32 // user: %7 %7 = apply %6(%3) : $@convention(witness_method: P) <τ_0_0 where τ_0_0 : P> (@in_guaranteed τ_0_0) -> Int32 // user: %8 %8 = struct_extract %7 : $Int32, #Int32._value // user: %11 @@ -433,8 +433,8 @@ bb0(%0 : $Int32, %1 : $Int32): // test4.foo (A, B) -> (Swift.Int32, Swift.Float) -> Swift.Int32 sil hidden [ossa] [noinline] @foo : $@convention(thin) (@in T, @in U) -> @owned @callee_owned (Int32, Float) -> Int32 { bb0(%0 : $*T, %1 : $*U): - debug_value_addr %0 : $*T, let, name "x" // id: %2 - debug_value_addr %1 : $*U, let, name "y" // id: %3 + debug_value %0 : $*T, let, name "x", expr op_deref // id: %2 + debug_value %1 : $*U, let, name "y", expr op_deref // id: %3 // function_ref test4.boo (A) -> (Swift.Int32, B) -> Swift.Int32 %4 = function_ref @boo : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : P> (@in τ_0_0) -> @owned @callee_owned (Int32, @in τ_0_1) -> Int32 // user: %7 %5 = alloc_stack $U // users: %6, %7, %10 @@ -462,7 +462,7 @@ bb0(%0 : $Int32, %1 : $Float, %2 : @owned $@callee_owned (Int32, @in Float) -> I // test4.gen1 (A) -> (Swift.Int32) -> Swift.Int32 sil hidden [ossa] [noinline] @gen1 : $@convention(thin) (@in T) -> @owned @callee_owned (Int32) -> Int32 { bb0(%0 : $*T): - debug_value_addr %0 : $*T, let, name "x" // id: %1 + debug_value %0 : $*T, let, name "x", expr op_deref // id: %1 // function_ref test4.(gen1 (A) -> (Swift.Int32) -> Swift.Int32).(closure #1) %2 = function_ref @gen1_closure : $@convention(thin) <τ_0_0 where τ_0_0 : P> (Int32, @owned <τ_0_0> { var τ_0_0 } <τ_0_0>) -> Int32 // user: %5 %3 = alloc_box $<τ_0_0> { var τ_0_0 } // users: %4, %5, %5 diff --git a/test/SILOptimizer/specialize_recursive_generics.sil b/test/SILOptimizer/specialize_recursive_generics.sil index 1e3ba41bfa3e6..c45e6dae134f6 100644 --- a/test/SILOptimizer/specialize_recursive_generics.sil +++ b/test/SILOptimizer/specialize_recursive_generics.sil @@ -14,7 +14,7 @@ import Swift // CHECK: return sil [noinline] @_TF29specialize_recursive_generics18recursive_genericsU__FQ_T_ : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T, let, name "t" // id: %1 + debug_value %0 : $*T, let, name "t", expr op_deref // id: %1 // function_ref specialize_recursive_generics.recursive_generics (A) -> () %2 = function_ref @_TF29specialize_recursive_generics18recursive_genericsU__FQ_T_ : $@convention(thin) <τ_0_0> (@in τ_0_0) -> () // user: %5 %3 = alloc_stack $T // users: %4, %5, %6 @@ -39,8 +39,8 @@ bb0(%0 : $*T): sil [noinline] @_TF29specialize_recursive_generics47recursive_generics_with_different_substitutionsU___FTQ_Q0__T_ : $@convention(thin) (@in T, @in U) -> () { bb0(%0 : $*T, %1 : $*U): - debug_value_addr %0 : $*T, let, name "t" // id: %2 - debug_value_addr %1 : $*U, let, name "u" // id: %3 + debug_value %0 : $*T, let, name "t", expr op_deref // id: %2 + debug_value %1 : $*U, let, name "u", expr op_deref // id: %3 // function_ref specialize_recursive_generics.recursive_generics_with_different_substitutions (A, B) -> () %4 = function_ref @_TF29specialize_recursive_generics47recursive_generics_with_different_substitutionsU___FTQ_Q0__T_ : $@convention(thin) <τ_0_0, τ_0_1> (@in τ_0_0, @in τ_0_1) -> () // user: %9 %5 = alloc_stack $U // users: %6, %9, %11 diff --git a/test/SILOptimizer/specialize_recursive_generics_ossa.sil b/test/SILOptimizer/specialize_recursive_generics_ossa.sil index e14d3b676fb7a..3d8b74f8f194c 100644 --- a/test/SILOptimizer/specialize_recursive_generics_ossa.sil +++ b/test/SILOptimizer/specialize_recursive_generics_ossa.sil @@ -14,7 +14,7 @@ import Swift // CHECK: return sil [noinline] [ossa] @_TF29specialize_recursive_generics18recursive_genericsU__FQ_T_ : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): - debug_value_addr %0 : $*T, let, name "t" // id: %1 + debug_value %0 : $*T, let, name "t", expr op_deref // id: %1 // function_ref specialize_recursive_generics.recursive_generics (A) -> () %2 = function_ref @_TF29specialize_recursive_generics18recursive_genericsU__FQ_T_ : $@convention(thin) <τ_0_0> (@in τ_0_0) -> () // user: %5 %3 = alloc_stack $T // users: %4, %5, %6 @@ -39,8 +39,8 @@ bb0(%0 : $*T): sil [noinline] [ossa] @_TF29specialize_recursive_generics47recursive_generics_with_different_substitutionsU___FTQ_Q0__T_ : $@convention(thin) (@in T, @in U) -> () { bb0(%0 : $*T, %1 : $*U): - debug_value_addr %0 : $*T, let, name "t" // id: %2 - debug_value_addr %1 : $*U, let, name "u" // id: %3 + debug_value %0 : $*T, let, name "t", expr op_deref // id: %2 + debug_value %1 : $*U, let, name "u", expr op_deref // id: %3 // function_ref specialize_recursive_generics.recursive_generics_with_different_substitutions (A, B) -> () %4 = function_ref @_TF29specialize_recursive_generics47recursive_generics_with_different_substitutionsU___FTQ_Q0__T_ : $@convention(thin) <τ_0_0, τ_0_1> (@in τ_0_0, @in τ_0_1) -> () // user: %9 %5 = alloc_stack $U // users: %6, %9, %11 diff --git a/test/SILOptimizer/sr-5068.sil b/test/SILOptimizer/sr-5068.sil index 82fd0acb66c71..36981e82749b4 100644 --- a/test/SILOptimizer/sr-5068.sil +++ b/test/SILOptimizer/sr-5068.sil @@ -100,7 +100,7 @@ bb3: // Preds: bb1 %70 = alloc_stack $ReadonlyExternalFramework // users: %106, %99, %73, %107, %71 copy_addr %0 to [initialization] %70 : $*ReadonlyExternalFramework // id: %71 destroy_addr %0 : $*ReadonlyExternalFramework // id: %72 - debug_value_addr %70 : $*ReadonlyExternalFramework, let, name "ExternalFramework", argno 1 // id: %73 + debug_value %70 : $*ReadonlyExternalFramework, let, name "ExternalFramework", argno 1, expr op_deref // id: %73 %75 = integer_literal $Builtin.Word, 1 // user: %78 %76 = integer_literal $Builtin.Int64, 1 // user: %77 %77 = struct $Int (%76 : $Builtin.Int64) // user: %81 diff --git a/test/SILOptimizer/strip_debug_info.sil b/test/SILOptimizer/strip_debug_info.sil index 351d37f79669e..22371c1a8e6f7 100644 --- a/test/SILOptimizer/strip_debug_info.sil +++ b/test/SILOptimizer/strip_debug_info.sil @@ -11,7 +11,7 @@ import Builtin // CHECK-NEXT: return sil @test : $@convention(thin) (@inout T, Builtin.Int64) -> () { bb0(%0 : $*T, %1 : $Builtin.Int64): - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref debug_value %1 : $Builtin.Int64 %2 = tuple () return %2 : $() diff --git a/test/SILOptimizer/templvalueopt_ossa.sil b/test/SILOptimizer/templvalueopt_ossa.sil index e8c7c56c817f4..3f4ef3f48bb2c 100644 --- a/test/SILOptimizer/templvalueopt_ossa.sil +++ b/test/SILOptimizer/templvalueopt_ossa.sil @@ -285,14 +285,14 @@ bb0(%0 :@owned $Child): // CHECK-LABEL: sil [ossa] @cleanup_debuginsts : // CHECK: copy_addr [take] -// CHECK-NOT: debug_value_addr +// CHECK-NOT: debug_value {{.*}} expr op_deref // CHECK-LABEL: } // end sil function 'cleanup_debuginsts' sil [ossa] @cleanup_debuginsts : $@convention(thin) (@in T) -> () { bb0(%0 : $*T): %2 = alloc_stack $T - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref copy_addr %0 to [initialization] %2 : $*T - debug_value_addr %0 : $*T + debug_value %0 : $*T, expr op_deref destroy_addr %0 : $*T destroy_addr %2 : $*T dealloc_stack %2 : $*T