@@ -237,24 +237,26 @@ bool hasNonTrivialNonDebugTransitiveUsers(
237237// / operators to access functionality from the underlying instruction when
238238// / needed.
239239struct DebugVarCarryingInst {
240- enum class Kind {
240+ enum class Kind : uint8_t {
241241 Invalid = 0 ,
242242 DebugValue,
243243 AllocStack,
244244 AllocBox,
245245 };
246246
247- Kind kind;
248247 SILInstruction *inst;
248+ Kind kind;
249+ uintptr_t spareBits : (sizeof (uintptr_t ) - sizeof (Kind)) * 8 ;
249250
250- DebugVarCarryingInst () : kind(Kind::Invalid), inst( nullptr ) {}
251+ DebugVarCarryingInst () : inst( nullptr ), kind(Kind::Invalid), spareBits( 0 ) {}
251252 DebugVarCarryingInst (DebugValueInst *dvi)
252- : kind(Kind::DebugValue), inst(dvi ) {}
253+ : inst(dvi), kind(Kind::DebugValue), spareBits( 0 ) {}
253254 DebugVarCarryingInst (AllocStackInst *asi)
254- : kind(Kind::AllocStack), inst(asi) {}
255- DebugVarCarryingInst (AllocBoxInst *abi) : kind(Kind::AllocBox), inst(abi) {}
255+ : inst(asi), kind(Kind::AllocStack), spareBits(0 ) {}
256+ DebugVarCarryingInst (AllocBoxInst *abi)
257+ : inst(abi), kind(Kind::AllocBox), spareBits(0 ) {}
256258 DebugVarCarryingInst (SILInstruction *newInst)
257- : kind(Kind::Invalid), inst( nullptr ) {
259+ : inst( nullptr ), kind(Kind::Invalid), spareBits( 0 ) {
258260 switch (newInst->getKind ()) {
259261 default :
260262 return ;
@@ -280,6 +282,15 @@ struct DebugVarCarryingInst {
280282 // / '->'. This keeps the wrapper light weight.
281283 SILInstruction *operator ->() const { return inst; }
282284
285+ bool operator ==(const DebugVarCarryingInst &other) const {
286+ return kind == other.kind && inst == other.inst &&
287+ spareBits == other.spareBits ;
288+ }
289+
290+ bool operator !=(const DebugVarCarryingInst &other) const {
291+ return !(*this == other);
292+ }
293+
283294 // / Add support for this struct in `if` statement.
284295 explicit operator bool () const { return bool (kind); }
285296
@@ -351,7 +362,8 @@ struct DebugVarCarryingInst {
351362 case Kind::AllocStack:
352363 return cast<AllocStackInst>(inst)->getWasMoved ();
353364 case Kind::AllocBox:
354- llvm_unreachable (" Not implemented" );
365+ // We do not support moving alloc box today, so we always return false.
366+ return false ;
355367 }
356368 }
357369
0 commit comments