@@ -530,7 +530,7 @@ class StackColoring {
530
530
531
531
// / Go over the machine function and change instructions which use stack
532
532
// / slots to use the joint slots.
533
- void remapInstructions (DenseMap<int , int > &SlotRemap, int MergedSlot );
533
+ void remapInstructions (DenseMap<int , int > &SlotRemap);
534
534
535
535
// / The input program may contain instructions which are not inside lifetime
536
536
// / markers. This can happen due to a bug in the compiler or due to a bug in
@@ -1190,7 +1190,7 @@ bool StackColoring::removeAllMarkers() {
1190
1190
return Count;
1191
1191
}
1192
1192
1193
- void StackColoring::remapInstructions (DenseMap<int , int >& SlotRemap, int MergedSlot ) {
1193
+ void StackColoring::remapInstructions (DenseMap<int , int > & SlotRemap) {
1194
1194
unsigned FixedInstr = 0 ;
1195
1195
unsigned FixedMemOp = 0 ;
1196
1196
unsigned FixedDbg = 0 ;
@@ -1200,9 +1200,6 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
1200
1200
if (!VI.Var || !VI.inStackSlot ())
1201
1201
continue ;
1202
1202
int Slot = VI.getStackSlot ();
1203
- if (Slot >= 0 && Slot2Info[Slot].Offset != InvalidIdx) {
1204
- VI.updateStackSlot (MergedSlot);
1205
- }
1206
1203
if (auto It = SlotRemap.find (Slot); It != SlotRemap.end ()) {
1207
1204
LLVM_DEBUG (dbgs () << " Remapping debug info for ["
1208
1205
<< cast<DILocalVariable>(VI.Var )->getName () << " ].\n " );
@@ -1311,12 +1308,6 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
1311
1308
if (FromSlot<0 )
1312
1309
continue ;
1313
1310
1314
- if (FromSlot >= 0 && Slot2Info[FromSlot].Offset != InvalidIdx) {
1315
- MO.setIndex (MergedSlot);
1316
- MO.setOffset (MO.getOffset () + Slot2Info[FromSlot].Offset );
1317
- continue ;
1318
- }
1319
-
1320
1311
// Only look at mapped slots.
1321
1312
if (!SlotRemap.count (FromSlot))
1322
1313
continue ;
@@ -1358,8 +1349,6 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
1358
1349
auto To = SlotRemap.find (FI);
1359
1350
if (To != SlotRemap.end ())
1360
1351
SSRefs[FI].push_back (MMO);
1361
- if (FI >= 0 && Slot2Info[FI].Offset != InvalidIdx)
1362
- SSRefs[FI].push_back (MMO);
1363
1352
}
1364
1353
1365
1354
// If this memory location can be a slot remapped here,
@@ -1378,7 +1367,7 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
1378
1367
// that is not remapped, we continue checking.
1379
1368
// Otherwise, we need to invalidate AA infomation.
1380
1369
const AllocaInst *AI = dyn_cast_or_null<AllocaInst>(V);
1381
- if (( AI && MergedAllocas.count (AI)) || UseNewStackColoring ) {
1370
+ if (AI && MergedAllocas.count (AI)) {
1382
1371
MayHaveConflictingAAMD = true ;
1383
1372
break ;
1384
1373
}
@@ -1402,20 +1391,13 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
1402
1391
// Rewrite MachineMemOperands that reference old frame indices.
1403
1392
for (auto E : enumerate(SSRefs))
1404
1393
if (!E.value ().empty ()) {
1405
- if (UseNewStackColoring) {
1406
- const PseudoSourceValue *NewSV =
1407
- MF->getPSVManager ().getFixedStack (MergedSlot);
1408
- for (MachineMemOperand *Ref : E.value ())
1409
- Ref->setValue (NewSV);
1410
- } else {
1411
- const PseudoSourceValue *NewSV = MF->getPSVManager ().getFixedStack (
1412
- SlotRemap.find (E.index ())->second );
1413
- for (MachineMemOperand *Ref : E.value ())
1414
- Ref->setValue (NewSV);
1415
- }
1394
+ const PseudoSourceValue *NewSV =
1395
+ MF->getPSVManager ().getFixedStack (SlotRemap.find (E.index ())->second );
1396
+ for (MachineMemOperand *Ref : E.value ())
1397
+ Ref->setValue (NewSV);
1416
1398
}
1417
1399
1418
- // Update the location of C++ catch objects for the MSVC personality routine.
1400
+ // Update the location of C++ catch objects for the MSVC personality routine.
1419
1401
if (WinEHFuncInfo *EHInfo = MF->getWinEHFuncInfo ())
1420
1402
for (WinEHTryBlockMapEntry &TBME : EHInfo->TryBlockMap )
1421
1403
for (WinEHHandlerType &H : TBME.HandlerArray )
@@ -1935,7 +1917,7 @@ bool StackColoring::run(MachineFunction &Func) {
1935
1917
// indices to use the remapped frame index.
1936
1918
if (!SlotRemap.empty ()) {
1937
1919
expungeSlotMap (SlotRemap, NumSlots);
1938
- remapInstructions (SlotRemap, InvalidIdx );
1920
+ remapInstructions (SlotRemap);
1939
1921
}
1940
1922
} else {
1941
1923
// Maybe this entire logic should be moved to a generic StackLayouter that
0 commit comments