From: Dan Gohman Date: Wed, 9 Jul 2008 19:51:00 +0000 (+0000) Subject: Use find with std::map, when that's what's needed, instead of lower_bound X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=0383bc014c82ce3979416e5fe28caaca59142a05;p=oota-llvm.git Use find with std::map, when that's what's needed, instead of lower_bound with extra checks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53344 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp index ed45961db91..7acf982bdf8 100644 --- a/lib/CodeGen/RegAllocLocal.cpp +++ b/lib/CodeGen/RegAllocLocal.cpp @@ -250,9 +250,9 @@ namespace { /// to be held on the stack. int RALocal::getStackSpaceFor(unsigned VirtReg, const TargetRegisterClass *RC) { // Find the location Reg would belong... - std::map::iterator I =StackSlotForVirtReg.lower_bound(VirtReg); + std::map::iterator I = StackSlotForVirtReg.find(VirtReg); - if (I != StackSlotForVirtReg.end() && I->first == VirtReg) + if (I != StackSlotForVirtReg.end()) return I->second; // Already has space allocated? // Allocate a new stack object for this spill location... diff --git a/lib/CodeGen/RegAllocSimple.cpp b/lib/CodeGen/RegAllocSimple.cpp index 081edd8d5eb..f07f7f92be8 100644 --- a/lib/CodeGen/RegAllocSimple.cpp +++ b/lib/CodeGen/RegAllocSimple.cpp @@ -103,10 +103,9 @@ namespace { int RegAllocSimple::getStackSpaceFor(unsigned VirtReg, const TargetRegisterClass *RC) { // Find the location VirtReg would belong... - std::map::iterator I = - StackSlotForVirtReg.lower_bound(VirtReg); + std::map::iterator I = StackSlotForVirtReg.find(VirtReg); - if (I != StackSlotForVirtReg.end() && I->first == VirtReg) + if (I != StackSlotForVirtReg.end()) return I->second; // Already has space allocated? // Allocate a new stack object for this spill location...