@@ -529,7 +529,7 @@ class StackColoring {
529529
530530 // / Go over the machine function and change instructions which use stack
531531 // / slots to use the joint slots.
532- void remapInstructions (DenseMap<int , int > &SlotRemap, int MergedSlot );
532+ void remapInstructions (DenseMap<int , int > &SlotRemap);
533533
534534 // / The input program may contain instructions which are not inside lifetime
535535 // / markers. This can happen due to a bug in the compiler or due to a bug in
@@ -1188,7 +1188,7 @@ bool StackColoring::removeAllMarkers() {
11881188 return Count;
11891189}
11901190
1191- void StackColoring::remapInstructions (DenseMap<int , int >& SlotRemap, int MergedSlot ) {
1191+ void StackColoring::remapInstructions (DenseMap<int , int > & SlotRemap) {
11921192 unsigned FixedInstr = 0 ;
11931193 unsigned FixedMemOp = 0 ;
11941194 unsigned FixedDbg = 0 ;
@@ -1198,9 +1198,6 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
11981198 if (!VI.Var || !VI.inStackSlot ())
11991199 continue ;
12001200 int Slot = VI.getStackSlot ();
1201- if (Slot >= 0 && Slot2Info[Slot].Offset != InvalidIdx) {
1202- VI.updateStackSlot (MergedSlot);
1203- }
12041201 if (auto It = SlotRemap.find (Slot); It != SlotRemap.end ()) {
12051202 LLVM_DEBUG (dbgs () << " Remapping debug info for ["
12061203 << cast<DILocalVariable>(VI.Var )->getName () << " ].\n " );
@@ -1309,12 +1306,6 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
13091306 if (FromSlot<0 )
13101307 continue ;
13111308
1312- if (FromSlot >= 0 && Slot2Info[FromSlot].Offset != InvalidIdx) {
1313- MO.setIndex (MergedSlot);
1314- MO.setOffset (MO.getOffset () + Slot2Info[FromSlot].Offset );
1315- continue ;
1316- }
1317-
13181309 // Only look at mapped slots.
13191310 if (!SlotRemap.count (FromSlot))
13201311 continue ;
@@ -1356,8 +1347,6 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
13561347 auto To = SlotRemap.find (FI);
13571348 if (To != SlotRemap.end ())
13581349 SSRefs[FI].push_back (MMO);
1359- if (FI >= 0 && Slot2Info[FI].Offset != InvalidIdx)
1360- SSRefs[FI].push_back (MMO);
13611350 }
13621351
13631352 // If this memory location can be a slot remapped here,
@@ -1376,7 +1365,7 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
13761365 // that is not remapped, we continue checking.
13771366 // Otherwise, we need to invalidate AA infomation.
13781367 const AllocaInst *AI = dyn_cast_or_null<AllocaInst>(V);
1379- if (( AI && MergedAllocas.count (AI)) || UseNewStackColoring ) {
1368+ if (AI && MergedAllocas.count (AI)) {
13801369 MayHaveConflictingAAMD = true ;
13811370 break ;
13821371 }
@@ -1400,20 +1389,13 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
14001389 // Rewrite MachineMemOperands that reference old frame indices.
14011390 for (auto E : enumerate(SSRefs))
14021391 if (!E.value ().empty ()) {
1403- if (UseNewStackColoring) {
1404- const PseudoSourceValue *NewSV =
1405- MF->getPSVManager ().getFixedStack (MergedSlot);
1406- for (MachineMemOperand *Ref : E.value ())
1407- Ref->setValue (NewSV);
1408- } else {
1409- const PseudoSourceValue *NewSV = MF->getPSVManager ().getFixedStack (
1410- SlotRemap.find (E.index ())->second );
1411- for (MachineMemOperand *Ref : E.value ())
1412- Ref->setValue (NewSV);
1413- }
1392+ const PseudoSourceValue *NewSV =
1393+ MF->getPSVManager ().getFixedStack (SlotRemap.find (E.index ())->second );
1394+ for (MachineMemOperand *Ref : E.value ())
1395+ Ref->setValue (NewSV);
14141396 }
14151397
1416- // Update the location of C++ catch objects for the MSVC personality routine.
1398+ // Update the location of C++ catch objects for the MSVC personality routine.
14171399 if (WinEHFuncInfo *EHInfo = MF->getWinEHFuncInfo ())
14181400 for (WinEHTryBlockMapEntry &TBME : EHInfo->TryBlockMap )
14191401 for (WinEHHandlerType &H : TBME.HandlerArray )
@@ -1933,7 +1915,7 @@ bool StackColoring::run(MachineFunction &Func) {
19331915 // indices to use the remapped frame index.
19341916 if (!SlotRemap.empty ()) {
19351917 expungeSlotMap (SlotRemap, NumSlots);
1936- remapInstructions (SlotRemap, InvalidIdx );
1918+ remapInstructions (SlotRemap);
19371919 }
19381920 } else {
19391921 // Maybe this entire logic should be moved to a generic StackLayouter that
0 commit comments