Skip to content

[llvm] Call *Map::erase directly (NFC) #135545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ class LVDWARFReader final : public LVBinaryReader {
}

// Remove offset from global map.
void removeGlobalOffset(LVOffset Offset) {
LVOffsetElementMap::iterator Iter = GlobalOffsets.find(Offset);
if (Iter != GlobalOffsets.end())
GlobalOffsets.erase(Iter);
}
void removeGlobalOffset(LVOffset Offset) { GlobalOffsets.erase(Offset); }

// Get the location information for DW_AT_data_member_location.
void processLocationMember(dwarf::Attribute Attr,
Expand Down
10 changes: 4 additions & 6 deletions llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2849,12 +2849,10 @@ ARMPreAllocLoadStoreOpt::RescheduleLoadStoreInstrs(MachineBasicBlock *MBB) {
// Erase the entry into the DbgValueSinkCandidates for the DBG_VALUE
// that was moved.
auto DbgVar = createDebugVariableFromMachineInstr(DbgInstr);
auto DbgIt = DbgValueSinkCandidates.find(DbgVar);
// If the instruction is a DBG_VALUE_LIST, it may have already been
// erased from the DbgValueSinkCandidates. Only erase if it exists in
// the DbgValueSinkCandidates.
if (DbgIt != DbgValueSinkCandidates.end())
DbgValueSinkCandidates.erase(DbgIt);
// Erase DbgVar from DbgValueSinkCandidates if still present. If the
// instruction is a DBG_VALUE_LIST, it may have already been erased from
// DbgValueSinkCandidates.
DbgValueSinkCandidates.erase(DbgVar);
// Zero out original dbg instr
forEachDbgRegOperand(DbgInstr,
[&](MachineOperand &Op) { Op.setReg(0); });
Expand Down
7 changes: 2 additions & 5 deletions llvm/lib/Target/Hexagon/HexagonTfrCleanup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,8 @@ bool HexagonTfrCleanup::updateImmMap(MachineInstr *MI, ImmediateMap &IMap) {
if (!Mo->isReg() || !Mo->isDef())
continue;
unsigned R = Mo->getReg();
for (MCRegAliasIterator AR(R, TRI, true); AR.isValid(); ++AR) {
ImmediateMap::iterator F = IMap.find(*AR);
if (F != IMap.end())
IMap.erase(F);
}
for (MCRegAliasIterator AR(R, TRI, true); AR.isValid(); ++AR)
IMap.erase(*AR);
}
return true;
}
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,7 @@ class LowerMatrixIntrinsics {
/// Erase \p Inst from both ShapeMap (if an entry exists) and erase \p Inst
/// itself.
void eraseFromParentAndRemoveFromShapeMap(Instruction *Inst) {
auto Iter = ShapeMap.find(Inst);
if (Iter != ShapeMap.end())
ShapeMap.erase(Iter);
ShapeMap.erase(Inst);
Inst->eraseFromParent();
}

Expand Down