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
This commit is contained in:
Dan Gohman 2008-07-09 19:51:00 +00:00
parent f56c2f7a4b
commit 0383bc014c
2 changed files with 4 additions and 5 deletions

View File

@ -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<unsigned, int>::iterator I =StackSlotForVirtReg.lower_bound(VirtReg);
std::map<unsigned, int>::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...

View File

@ -103,10 +103,9 @@ namespace {
int RegAllocSimple::getStackSpaceFor(unsigned VirtReg,
const TargetRegisterClass *RC) {
// Find the location VirtReg would belong...
std::map<unsigned, int>::iterator I =
StackSlotForVirtReg.lower_bound(VirtReg);
std::map<unsigned, int>::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...