[llvm] fb7f50a - [CodeGen] Use DenseMapBase::lookup (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 2 21:05:24 PDT 2023
Author: Kazu Hirata
Date: 2023-06-02T21:05:13-07:00
New Revision: fb7f50a0c38ae9e6dc138f6ddcb3d33d2782563d
URL: https://github.com/llvm/llvm-project/commit/fb7f50a0c38ae9e6dc138f6ddcb3d33d2782563d
DIFF: https://github.com/llvm/llvm-project/commit/fb7f50a0c38ae9e6dc138f6ddcb3d33d2782563d.diff
LOG: [CodeGen] Use DenseMapBase::lookup (NFC)
Note that DenseMapBase::lookup and Reg2MIMap::get do exactly the same
thing.
Added:
Modified:
llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp b/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
index e9840290c95d9..c44b968b317d7 100644
--- a/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
+++ b/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
@@ -44,13 +44,8 @@ class MachineLateInstrsCleanup : public MachineFunctionPass {
// Data structures to map regs to their definitions and kills per MBB.
struct Reg2MIMap : public SmallDenseMap<Register, MachineInstr *> {
- MachineInstr *get(Register Reg) {
- auto I = find(Reg);
- return I != end() ? I->second : nullptr;
- }
-
bool hasIdentical(Register Reg, MachineInstr *ArgMI) {
- MachineInstr *MI = get(Reg);
+ MachineInstr *MI = lookup(Reg);
return MI && MI->isIdenticalTo(*ArgMI);
}
};
@@ -128,13 +123,13 @@ clearKillsForDef(Register Reg, MachineBasicBlock *MBB,
VisitedPreds.set(MBB->getNumber());
// Kill flag in MBB
- if (MachineInstr *KillMI = RegKills[MBB->getNumber()].get(Reg)) {
+ if (MachineInstr *KillMI = RegKills[MBB->getNumber()].lookup(Reg)) {
KillMI->clearRegisterKills(Reg, TRI);
return;
}
// Def in MBB (missing kill flag)
- if (MachineInstr *DefMI = RegDefs[MBB->getNumber()].get(Reg))
+ if (MachineInstr *DefMI = RegDefs[MBB->getNumber()].lookup(Reg))
if (DefMI->getParent() == MBB)
return;
More information about the llvm-commits
mailing list