@@ -320,8 +320,7 @@ class IRGenSILFunction :
320
320
// / Keeps track of the mapping of source variables to -O0 shadow copy allocas.
321
321
llvm::SmallDenseMap<StackSlotKey, Address, 8 > ShadowStackSlots;
322
322
llvm::SmallDenseMap<Decl *, SmallString<4 >, 8 > AnonymousVariables;
323
- llvm::SmallVector<std::pair<DominancePoint, llvm::Instruction *>, 8 >
324
- ValueVariables;
323
+ llvm::SmallDenseMap<llvm::Instruction *, DominancePoint, 8 > ValueVariables;
325
324
unsigned NumAnonVars = 0 ;
326
325
unsigned NumCondFails = 0 ;
327
326
@@ -562,9 +561,9 @@ class IRGenSILFunction :
562
561
void emitDebugVariableRangeExtension (const SILBasicBlock *CurBB) {
563
562
if (IGM.IRGen .Opts .Optimize )
564
563
return ;
565
- for (auto &Variable : reversed ( ValueVariables) ) {
566
- auto VarDominancePoint = Variable.first ;
567
- llvm::Value *Storage = Variable.second ;
564
+ for (auto &Variable : ValueVariables) {
565
+ auto VarDominancePoint = Variable.second ;
566
+ llvm::Value *Storage = Variable.first ;
568
567
if (getActiveDominancePoint () == VarDominancePoint ||
569
568
isActiveDominancePointDominatedBy (VarDominancePoint)) {
570
569
llvm::Type *ArgTys;
@@ -595,13 +594,14 @@ class IRGenSILFunction :
595
594
// that this shouldn't be necessary. LiveDebugValues should be doing
596
595
// this but can't in general because it currently only tracks register
597
596
// locations.
598
- auto It = llvm::BasicBlock::iterator (Variable.second );
599
- auto *BB = Variable.second ->getParent ();
597
+ llvm::Instruction *Value = Variable.first ;
598
+ auto It = llvm::BasicBlock::iterator (Value);
599
+ auto *BB = Value->getParent ();
600
600
auto *CurBB = Builder.GetInsertBlock ();
601
601
if (BB != CurBB)
602
602
for (auto I = std::next (It), E = BB->end (); I != E; ++I) {
603
603
auto *DVI = dyn_cast<llvm::DbgValueInst>(I);
604
- if (DVI && DVI->getValue () == Variable. second )
604
+ if (DVI && DVI->getValue () == Value )
605
605
IGM.DebugInfo ->getBuilder ().insertDbgValueIntrinsic (
606
606
DVI->getValue (), 0 , DVI->getVariable (), DVI->getExpression (),
607
607
DVI->getDebugLoc (), &*CurBB->getFirstInsertionPt ());
@@ -649,7 +649,7 @@ class IRGenSILFunction :
649
649
if (!needsShadowCopy (Storage)) {
650
650
// Mark for debug value range extension unless this is a constant.
651
651
if (auto *Value = dyn_cast<llvm::Instruction>(Storage))
652
- ValueVariables.push_back ({ getActiveDominancePoint (), Value });
652
+ ValueVariables.insert ({Value, getActiveDominancePoint ()});
653
653
return Storage;
654
654
}
655
655
0 commit comments