diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-08-22 15:37:57 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-08-22 15:37:57 +0000 |
commit | 05d96f98cbd96dab7f4ea1ea4ebe4285597e7e88 (patch) | |
tree | b32c92e060826c319744e00e4f74a20de33ad62f /lib/CodeGen/StrongPHIElimination.cpp | |
parent | fdeb9fe5e08146d9cb953000cb893eda80329a08 (diff) | |
download | llvm-05d96f98cbd96dab7f4ea1ea4ebe4285597e7e88.tar.gz llvm-05d96f98cbd96dab7f4ea1ea4ebe4285597e7e88.tar.bz2 llvm-05d96f98cbd96dab7f4ea1ea4ebe4285597e7e88.tar.xz |
Reduce duplicated hash map lookups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StrongPHIElimination.cpp')
-rw-r--r-- | lib/CodeGen/StrongPHIElimination.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp index 5b06195046..39fd600d4a 100644 --- a/lib/CodeGen/StrongPHIElimination.cpp +++ b/lib/CodeGen/StrongPHIElimination.cpp @@ -404,9 +404,9 @@ bool StrongPHIElimination::runOnMachineFunction(MachineFunction &MF) { } void StrongPHIElimination::addReg(unsigned Reg) { - if (RegNodeMap.count(Reg)) - return; - RegNodeMap[Reg] = new (Allocator) Node(Reg); + Node *&N = RegNodeMap[Reg]; + if (!N) + N = new (Allocator) Node(Reg); } StrongPHIElimination::Node* @@ -714,8 +714,9 @@ void StrongPHIElimination::InsertCopiesForPHI(MachineInstr *PHI, assert(getRegColor(CopyReg) == CopyReg); } - if (!InsertedSrcCopyMap.count(std::make_pair(PredBB, PHIColor))) - InsertedSrcCopyMap[std::make_pair(PredBB, PHIColor)] = CopyInstr; + // Insert into map if not already there. + InsertedSrcCopyMap.insert(std::make_pair(std::make_pair(PredBB, PHIColor), + CopyInstr)); } SrcMO.setReg(CopyReg); |