@@ -305,12 +305,8 @@ ArrayRef<FrameIndexExpr> DbgVariable::getFrameIndexExprs() const {
305
305
return FrameIndexExprs;
306
306
}
307
307
308
- void DbgVariable::addMMIEntry (const DbgVariable &V) {
309
- assert (V.getVariable () == getVariable () && " conflicting variable" );
310
- assert (V.getInlinedAt () == getInlinedAt () && " conflicting inlined-at location" );
311
-
308
+ void DbgVariable::addMMIEntry (const DIExpression *Expr, int FI) {
312
309
auto &FrameIndexExprs = get<MMILoc>().FrameIndexExprs ;
313
- auto &VFrameIndexExprs = V.get <MMILoc>().FrameIndexExprs ;
314
310
315
311
// FIXME: This logic should not be necessary anymore, as we now have proper
316
312
// deduplication. However, without it, we currently run into the assertion
@@ -322,12 +318,10 @@ void DbgVariable::addMMIEntry(const DbgVariable &V) {
322
318
return ;
323
319
}
324
320
325
- for (const auto &FIE : VFrameIndexExprs)
326
- // Ignore duplicate entries.
327
- if (llvm::none_of (FrameIndexExprs, [&](const FrameIndexExpr &Other) {
328
- return FIE.FI == Other.FI && FIE.Expr == Other.Expr ;
329
- }))
330
- FrameIndexExprs.push_back (FIE);
321
+ if (llvm::none_of (FrameIndexExprs, [&](const FrameIndexExpr &Other) {
322
+ return FI == Other.FI && Expr == Other.Expr ;
323
+ }))
324
+ FrameIndexExprs.push_back ({FI, Expr});
331
325
332
326
assert ((FrameIndexExprs.size () == 1 ||
333
327
llvm::all_of (FrameIndexExprs,
@@ -1574,6 +1568,15 @@ void DwarfDebug::collectVariableInfoFromMFTable(
1574
1568
}
1575
1569
1576
1570
ensureAbstractEntityIsCreatedIfScoped (TheCU, Var.first , Scope->getScopeNode ());
1571
+
1572
+ if (DbgVariable *DbgVar = MFVars.lookup (Var)) {
1573
+ if (DbgVar->hasFrameIndexExprs ())
1574
+ DbgVar->addMMIEntry (VI.Expr , VI.getStackSlot ());
1575
+ else
1576
+ DbgVar->addEntryValueExpr (VI.getEntryValueRegister (), *VI.Expr );
1577
+ continue ;
1578
+ }
1579
+
1577
1580
auto RegVar = std::make_unique<DbgVariable>(
1578
1581
cast<DILocalVariable>(Var.first ), Var.second );
1579
1582
if (VI.inStackSlot ())
@@ -1582,16 +1585,9 @@ void DwarfDebug::collectVariableInfoFromMFTable(
1582
1585
RegVar->initializeEntryValue (VI.getEntryValueRegister (), *VI.Expr );
1583
1586
LLVM_DEBUG (dbgs () << " Created DbgVariable for " << VI.Var ->getName ()
1584
1587
<< " \n " );
1585
-
1586
- if (DbgVariable *DbgVar = MFVars.lookup (Var)) {
1587
- if (DbgVar->hasFrameIndexExprs ())
1588
- DbgVar->addMMIEntry (*RegVar);
1589
- else
1590
- DbgVar->addEntryValueExpr (VI.getEntryValueRegister (), *VI.Expr );
1591
- } else if (InfoHolder.addScopeVariable (Scope, RegVar.get ())) {
1592
- MFVars.insert ({Var, RegVar.get ()});
1593
- ConcreteEntities.push_back (std::move (RegVar));
1594
- }
1588
+ InfoHolder.addScopeVariable (Scope, RegVar.get ());
1589
+ MFVars.insert ({Var, RegVar.get ()});
1590
+ ConcreteEntities.push_back (std::move (RegVar));
1595
1591
}
1596
1592
}
1597
1593
0 commit comments