diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2008-08-05 21:51:46 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2008-08-05 21:51:46 +0000 |
| commit | aa33b932bdaaa903caeae8b8973d94009d650726 (patch) | |
| tree | db6bad92a3b64545fde26e58da95754d78ad52be /llvm/lib/CodeGen/VirtRegMap.cpp | |
| parent | bdaed55ef314c83cd775603ccf85833628a738e1 (diff) | |
| download | bcm5719-llvm-aa33b932bdaaa903caeae8b8973d94009d650726.tar.gz bcm5719-llvm-aa33b932bdaaa903caeae8b8973d94009d650726.zip | |
Fix PR2596: out of bound reference.
llvm-svn: 54375
Diffstat (limited to 'llvm/lib/CodeGen/VirtRegMap.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/VirtRegMap.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp index b9e96b11e29..c06ff71e6f4 100644 --- a/llvm/lib/CodeGen/VirtRegMap.cpp +++ b/llvm/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. |

