Skip to content

Commit 6e29a87

Browse files
committed
Cleanup the Diff
1 parent a2eccfe commit 6e29a87

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

llvm/lib/CodeGen/StackColoring.cpp

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ class StackColoring {
530530

531531
/// Go over the machine function and change instructions which use stack
532532
/// slots to use the joint slots.
533-
void remapInstructions(DenseMap<int, int> &SlotRemap, int MergedSlot);
533+
void remapInstructions(DenseMap<int, int> &SlotRemap);
534534

535535
/// The input program may contain instructions which are not inside lifetime
536536
/// markers. This can happen due to a bug in the compiler or due to a bug in
@@ -1190,7 +1190,7 @@ bool StackColoring::removeAllMarkers() {
11901190
return Count;
11911191
}
11921192

1193-
void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedSlot) {
1193+
void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
11941194
unsigned FixedInstr = 0;
11951195
unsigned FixedMemOp = 0;
11961196
unsigned FixedDbg = 0;
@@ -1200,9 +1200,6 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
12001200
if (!VI.Var || !VI.inStackSlot())
12011201
continue;
12021202
int Slot = VI.getStackSlot();
1203-
if (Slot >= 0 && Slot2Info[Slot].Offset != InvalidIdx) {
1204-
VI.updateStackSlot(MergedSlot);
1205-
}
12061203
if (auto It = SlotRemap.find(Slot); It != SlotRemap.end()) {
12071204
LLVM_DEBUG(dbgs() << "Remapping debug info for ["
12081205
<< cast<DILocalVariable>(VI.Var)->getName() << "].\n");
@@ -1311,12 +1308,6 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
13111308
if (FromSlot<0)
13121309
continue;
13131310

1314-
if (FromSlot >= 0 && Slot2Info[FromSlot].Offset != InvalidIdx) {
1315-
MO.setIndex(MergedSlot);
1316-
MO.setOffset(MO.getOffset() + Slot2Info[FromSlot].Offset);
1317-
continue;
1318-
}
1319-
13201311
// Only look at mapped slots.
13211312
if (!SlotRemap.count(FromSlot))
13221313
continue;
@@ -1358,8 +1349,6 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
13581349
auto To = SlotRemap.find(FI);
13591350
if (To != SlotRemap.end())
13601351
SSRefs[FI].push_back(MMO);
1361-
if (FI >= 0 && Slot2Info[FI].Offset != InvalidIdx)
1362-
SSRefs[FI].push_back(MMO);
13631352
}
13641353

13651354
// If this memory location can be a slot remapped here,
@@ -1378,7 +1367,7 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
13781367
// that is not remapped, we continue checking.
13791368
// Otherwise, we need to invalidate AA infomation.
13801369
const AllocaInst *AI = dyn_cast_or_null<AllocaInst>(V);
1381-
if ((AI && MergedAllocas.count(AI)) || UseNewStackColoring) {
1370+
if (AI && MergedAllocas.count(AI)) {
13821371
MayHaveConflictingAAMD = true;
13831372
break;
13841373
}
@@ -1402,20 +1391,13 @@ void StackColoring::remapInstructions(DenseMap<int, int>& SlotRemap, int MergedS
14021391
// Rewrite MachineMemOperands that reference old frame indices.
14031392
for (auto E : enumerate(SSRefs))
14041393
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);
14161398
}
14171399

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.
14191401
if (WinEHFuncInfo *EHInfo = MF->getWinEHFuncInfo())
14201402
for (WinEHTryBlockMapEntry &TBME : EHInfo->TryBlockMap)
14211403
for (WinEHHandlerType &H : TBME.HandlerArray)
@@ -1935,7 +1917,7 @@ bool StackColoring::run(MachineFunction &Func) {
19351917
// indices to use the remapped frame index.
19361918
if (!SlotRemap.empty()) {
19371919
expungeSlotMap(SlotRemap, NumSlots);
1938-
remapInstructions(SlotRemap, InvalidIdx);
1920+
remapInstructions(SlotRemap);
19391921
}
19401922
} else {
19411923
// Maybe this entire logic should be moved to a generic StackLayouter that

0 commit comments

Comments
 (0)