aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/VirtRegMap.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-08-05 21:51:46 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-08-05 21:51:46 +0000
commite3b8a48d3285cdaf3593af9d4b658e15df037b9f (patch)
treeb14b508aa4d4ec3e85bfb05c1dd9a17990c93c90 /lib/CodeGen/VirtRegMap.cpp
parent5d2f8072d41bcde63c9f4267efe2d50bacc1e5f3 (diff)
Fix PR2596: out of bound reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54375 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/VirtRegMap.cpp')
-rw-r--r--lib/CodeGen/VirtRegMap.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp
index b9e96b11e2..c06ff71e6f 100644
--- a/lib/CodeGen/VirtRegMap.cpp
+++ b/lib/CodeGen/VirtRegMap.cpp
@@ -560,8 +560,11 @@ static void InvalidateKills(MachineInstr &MI, BitVector &RegKills,
if (!MO.isRegister() || !MO.isUse() || !MO.isKill())
continue;
unsigned Reg = MO.getReg();
+ if (TargetRegisterInfo::isVirtualRegister(Reg))
+ continue;
if (KillRegs)
KillRegs->push_back(Reg);
+ assert(Reg < KillOps.size());
if (KillOps[Reg] == &MO) {
RegKills.reset(Reg);
KillOps[Reg] = NULL;
@@ -943,9 +946,11 @@ bool LocalSpiller::PrepForUnfoldOpti(MachineBasicBlock &MBB,
return false;
continue;
}
- PhysReg = VRM.getPhys(VirtReg);
- if (!TRI->regsOverlap(PhysReg, UnfoldPR))
- continue;
+ if (VRM.hasPhys(VirtReg)) {
+ PhysReg = VRM.getPhys(VirtReg);
+ if (!TRI->regsOverlap(PhysReg, UnfoldPR))
+ continue;
+ }
// Ok, we'll need to reload the value into a register which makes
// it impossible to perform the store unfolding optimization later.