Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions llvm/lib/CodeGen/StackColoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,10 +914,10 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
if (!VI.Var || !VI.inStackSlot())
continue;
int Slot = VI.getStackSlot();
if (SlotRemap.count(Slot)) {
if (auto It = SlotRemap.find(Slot); It != SlotRemap.end()) {
LLVM_DEBUG(dbgs() << "Remapping debug info for ["
<< cast<DILocalVariable>(VI.Var)->getName() << "].\n");
VI.updateStackSlot(SlotRemap[Slot]);
VI.updateStackSlot(It->second);
FixedDbg++;
}
}
Expand Down Expand Up @@ -1004,10 +1004,11 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
if (!AI)
continue;

if (!Allocas.count(AI))
auto It = Allocas.find(AI);
if (It == Allocas.end())
continue;

MMO->setValue(Allocas[AI]);
MMO->setValue(It->second);
FixedMemOp++;
}

Expand Down Expand Up @@ -1173,8 +1174,8 @@ void StackColoring::expungeSlotMap(DenseMap<int, int> &SlotRemap,
// Expunge slot remap map.
for (unsigned i=0; i < NumSlots; ++i) {
// If we are remapping i
if (SlotRemap.count(i)) {
int Target = SlotRemap[i];
if (auto It = SlotRemap.find(i); It != SlotRemap.end()) {
int Target = It->second;
// As long as our target is mapped to something else, follow it.
while (SlotRemap.count(Target)) {
Target = SlotRemap[Target];
Expand Down