summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/LiveRangeEdit.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/LiveRangeEdit.cpp b/llvm/lib/CodeGen/LiveRangeEdit.cpp
index 01fc0a45d3d..4bc65fcdd1c 100644
--- a/llvm/lib/CodeGen/LiveRangeEdit.cpp
+++ b/llvm/lib/CodeGen/LiveRangeEdit.cpp
@@ -272,10 +272,11 @@ void LiveRangeEdit::eliminateDeadDef(MachineInstr *MI, ToShrinkSet &ToShrink,
bool ReadsPhysRegs = false;
bool isOrigDef = false;
unsigned Dest;
- if (VRM && MI->getOperand(0).isReg() && MI->getOperand(0).isDef()) {
- // It is assumed that callers of eliminateDeadDefs() will never pass in dead
- // instructions with multiple virtual register defs.
- assert(MI->getDesc().getNumDefs() == 1 && "Unexpected instruction with multiple defs.");
+ // Only optimize rematerialize case when the instruction has one def, since
+ // otherwise we could leave some dead defs in the code. This case is
+ // extremely rare.
+ if (VRM && MI->getOperand(0).isReg() && MI->getOperand(0).isDef() &&
+ MI->getDesc().getNumDefs() == 1) {
Dest = MI->getOperand(0).getReg();
unsigned Original = VRM->getOriginal(Dest);
LiveInterval &OrigLI = LIS.getInterval(Original);
OpenPOWER on IntegriCloud