Grow the map on entry so that we don't crash if joinIntervals never
runs (if coalescing is disabled for example).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16259 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index e0fefc3..04978d6 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -88,6 +88,7 @@
mri_ = tm_->getRegisterInfo();
lv_ = &getAnalysis<LiveVariables>();
allocatableRegs_ = mri_->getAllocatableSet(fn);
+ r2rMap_.grow(mf_->getSSARegMap()->getLastVirtReg());
// number MachineInstrs
unsigned miIndex = 0;
@@ -619,8 +620,6 @@
void LiveIntervals::joinIntervals() {
DEBUG(std::cerr << "********** JOINING INTERVALS ***********\n");
- // reserve space for the reg2reg map
- r2rMap_.grow(mf_->getSSARegMap()->getLastVirtReg());
const LoopInfo &LI = getAnalysis<LoopInfo>();
if (LI.begin() == LI.end()) {