@@ -237,24 +237,26 @@ bool hasNonTrivialNonDebugTransitiveUsers(
237
237
// / operators to access functionality from the underlying instruction when
238
238
// / needed.
239
239
struct DebugVarCarryingInst {
240
- enum class Kind {
240
+ enum class Kind : uint8_t {
241
241
Invalid = 0 ,
242
242
DebugValue,
243
243
AllocStack,
244
244
AllocBox,
245
245
};
246
246
247
- Kind kind;
248
247
SILInstruction *inst;
248
+ Kind kind;
249
+ uintptr_t spareBits : (sizeof (uintptr_t ) - sizeof (Kind)) * 8 ;
249
250
250
- DebugVarCarryingInst () : kind(Kind::Invalid), inst( nullptr ) {}
251
+ DebugVarCarryingInst () : inst( nullptr ), kind(Kind::Invalid), spareBits( 0 ) {}
251
252
DebugVarCarryingInst (DebugValueInst *dvi)
252
- : kind(Kind::DebugValue), inst(dvi ) {}
253
+ : inst(dvi), kind(Kind::DebugValue), spareBits( 0 ) {}
253
254
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 ) {}
256
258
DebugVarCarryingInst (SILInstruction *newInst)
257
- : kind(Kind::Invalid), inst( nullptr ) {
259
+ : inst( nullptr ), kind(Kind::Invalid), spareBits( 0 ) {
258
260
switch (newInst->getKind ()) {
259
261
default :
260
262
return ;
@@ -280,6 +282,15 @@ struct DebugVarCarryingInst {
280
282
// / '->'. This keeps the wrapper light weight.
281
283
SILInstruction *operator ->() const { return inst; }
282
284
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
+
283
294
// / Add support for this struct in `if` statement.
284
295
explicit operator bool () const { return bool (kind); }
285
296
@@ -351,7 +362,8 @@ struct DebugVarCarryingInst {
351
362
case Kind::AllocStack:
352
363
return cast<AllocStackInst>(inst)->getWasMoved ();
353
364
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 ;
355
367
}
356
368
}
357
369
0 commit comments