[LiveRangeEdit] Handle instructions with no defs correctly.

Summary:
The code in LiveRangeEdit::eliminateDeadDef() that computes isOrigDef
doesn't handle instructions in which operand 0 is not a def (e.g. KILL)
correctly.  Add a check that operand 0 is a def before doing the rest of
the isOrigDef computation.

Reviewers: qcolombet, MatzeB, wmi

Subscribers: mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D27174

llvm-svn: 288189
This commit is contained in:
Geoff Berry 2016-11-29 19:31:35 +00:00
parent 97279a8ca3
commit 4d66cea347
1 changed files with 2 additions and 1 deletions

View File

@ -272,7 +272,8 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink,
bool ReadsPhysRegs = false;
bool isOrigDef = false;
unsigned Dest;
if (VRM && MI->getOperand(0).isReg()) {
if (VRM && MI->getOperand(0).isReg() && MI->getOperand(0).isDef()) {
assert(MI->getDesc().getNumDefs() == 1);
Dest = MI->getOperand(0).getReg();
unsigned Original = VRM->getOriginal(Dest);
LiveInterval &OrigLI = LIS.getInterval(Original);