@@ -320,15 +320,6 @@ static DebugVariable getAggregateVariable(DbgVariableRecord *DVR) {
320
320
DVR->getDebugLoc ().getInlinedAt ());
321
321
}
322
322
323
- DbgVariableRecord *UnwrapDbgInstPtr (DbgInstPtr P, DbgVariableRecord *Unused) {
324
- (void )Unused;
325
- return static_cast <DbgVariableRecord *>(cast<DbgRecord *>(P));
326
- }
327
- DbgAssignIntrinsic *UnwrapDbgInstPtr (DbgInstPtr P, DbgAssignIntrinsic *Unused) {
328
- (void )Unused;
329
- return static_cast <DbgAssignIntrinsic *>(cast<Instruction *>(P));
330
- }
331
-
332
323
// / Find linked dbg.assign and generate a new one with the correct
333
324
// / FragmentInfo. Link Inst to the new dbg.assign. If Value is nullptr the
334
325
// / value component is copied from the old dbg.assign to the new.
@@ -348,10 +339,9 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool IsSplit,
348
339
uint64_t SliceSizeInBits, Instruction *OldInst,
349
340
Instruction *Inst, Value *Dest, Value *Value,
350
341
const DataLayout &DL) {
351
- auto MarkerRange = at::getAssignmentMarkers (OldInst);
352
342
auto DVRAssignMarkerRange = at::getDVRAssignmentMarkers (OldInst);
353
343
// Nothing to do if OldInst has no linked dbg.assign intrinsics.
354
- if (MarkerRange. empty () && DVRAssignMarkerRange.empty ())
344
+ if (DVRAssignMarkerRange.empty ())
355
345
return ;
356
346
357
347
LLVM_DEBUG (dbgs () << " migrateDebugInfo\n " );
@@ -435,11 +425,10 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool IsSplit,
435
425
}
436
426
437
427
::Value *NewValue = Value ? Value : DbgAssign->getValue ();
438
- auto *NewAssign = UnwrapDbgInstPtr (
428
+ DbgVariableRecord *NewAssign = cast<DbgVariableRecord>(cast<DbgRecord *> (
439
429
DIB.insertDbgAssign (Inst, NewValue, DbgAssign->getVariable (), Expr,
440
430
Dest, DIExpression::get (Expr->getContext (), {}),
441
- DbgAssign->getDebugLoc ()),
442
- DbgAssign);
431
+ DbgAssign->getDebugLoc ())));
443
432
444
433
// If we've updated the value but the original dbg.assign has an arglist
445
434
// then kill it now - we can't use the requested new value.
@@ -3232,8 +3221,7 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
3232
3221
// In theory we should call migrateDebugInfo here. However, we do not
3233
3222
// emit dbg.assign intrinsics for mem intrinsics storing through non-
3234
3223
// constant geps, or storing a variable number of bytes.
3235
- assert (at::getAssignmentMarkers (&II).empty () &&
3236
- at::getDVRAssignmentMarkers (&II).empty () &&
3224
+ assert (at::getDVRAssignmentMarkers (&II).empty () &&
3237
3225
" AT: Unexpected link to non-const GEP" );
3238
3226
deleteIfTriviallyDead (OldPtr);
3239
3227
return false ;
@@ -3382,13 +3370,11 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
3382
3370
Value *AdjustedPtr = getNewAllocaSlicePtr (IRB, OldPtr->getType ());
3383
3371
if (IsDest) {
3384
3372
// Update the address component of linked dbg.assigns.
3385
- auto UpdateAssignAddress = [&]( auto *DbgAssign) {
3373
+ for (DbgVariableRecord *DbgAssign : at::getDVRAssignmentMarkers (&II) ) {
3386
3374
if (llvm::is_contained (DbgAssign->location_ops (), II.getDest ()) ||
3387
3375
DbgAssign->getAddress () == II.getDest ())
3388
3376
DbgAssign->replaceVariableLocationOp (II.getDest (), AdjustedPtr);
3389
- };
3390
- for_each (at::getAssignmentMarkers (&II), UpdateAssignAddress);
3391
- for_each (at::getDVRAssignmentMarkers (&II), UpdateAssignAddress);
3377
+ }
3392
3378
II.setDest (AdjustedPtr);
3393
3379
II.setDestAlignment (SliceAlign);
3394
3380
} else {
@@ -3986,8 +3972,7 @@ class AggLoadStoreRewriter : public InstVisitor<AggLoadStoreRewriter, bool> {
3986
3972
Store->getPointerOperand (), Store->getValueOperand (),
3987
3973
DL);
3988
3974
} else {
3989
- assert (at::getAssignmentMarkers (Store).empty () &&
3990
- at::getDVRAssignmentMarkers (Store).empty () &&
3975
+ assert (at::getDVRAssignmentMarkers (Store).empty () &&
3991
3976
" AT: unexpected debug.assign linked to store through "
3992
3977
" unbounded GEP" );
3993
3978
}
0 commit comments