summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocFast.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-01-09 21:58:20 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-01-09 21:58:20 +0000
commit42e9c963921776cb498c33b6c6c03f29971316f3 (patch)
tree0e3b29c341c27f498cd008f35d90e8d27b099c4c /lib/CodeGen/RegAllocFast.cpp
parent9dddf08eb8851e7c707df7f36b18e4e738e717cc (diff)
downloadllvm-42e9c963921776cb498c33b6c6c03f29971316f3.tar.gz
llvm-42e9c963921776cb498c33b6c6c03f29971316f3.tar.bz2
llvm-42e9c963921776cb498c33b6c6c03f29971316f3.tar.xz
Remove MachineRegisterInfo::getLastVirtReg(), it was giving wrong results
when no virtual registers have been allocated. It was only used to resize IndexedMaps, so provide an IndexedMap::resize() method such that Map.grow(MRI.getLastVirtReg()); can be replaced with the simpler Map.resize(MRI.getNumVirtRegs()); This works correctly when no virtuals are allocated, and it bypasses the to/from index conversions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123130 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocFast.cpp')
-rw-r--r--lib/CodeGen/RegAllocFast.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/CodeGen/RegAllocFast.cpp b/lib/CodeGen/RegAllocFast.cpp
index 109da42e9c..6666d9aaf4 100644
--- a/lib/CodeGen/RegAllocFast.cpp
+++ b/lib/CodeGen/RegAllocFast.cpp
@@ -1024,8 +1024,7 @@ bool RAFast::runOnMachineFunction(MachineFunction &Fn) {
// initialize the virtual->physical register map to have a 'null'
// mapping for all virtual registers
- unsigned LastVirtReg = MRI->getLastVirtReg();
- StackSlotForVirtReg.grow(LastVirtReg);
+ StackSlotForVirtReg.resize(MRI->getNumVirtRegs());
// Loop over all of the basic blocks, eliminating virtual register references
for (MachineFunction::iterator MBBi = Fn.begin(), MBBe = Fn.end();