summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LivePhysRegs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/LivePhysRegs.cpp')
-rw-r--r--llvm/lib/CodeGen/LivePhysRegs.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/LivePhysRegs.cpp b/llvm/lib/CodeGen/LivePhysRegs.cpp
index b6369275051..eef7643367f 100644
--- a/llvm/lib/CodeGen/LivePhysRegs.cpp
+++ b/llvm/lib/CodeGen/LivePhysRegs.cpp
@@ -77,8 +77,9 @@ void LivePhysRegs::stepForward(const MachineInstr &MI,
if (Reg == 0)
continue;
if (O->isDef()) {
- if (!O->isDead())
- Clobbers.push_back(std::make_pair(Reg, &*O));
+ // Note, dead defs are still recorded. The caller should decide how to
+ // handle them.
+ Clobbers.push_back(std::make_pair(Reg, &*O));
} else {
if (!O->isKill())
continue;
@@ -90,8 +91,12 @@ void LivePhysRegs::stepForward(const MachineInstr &MI,
}
// Add defs to the set.
- for (auto Reg : Clobbers)
+ for (auto Reg : Clobbers) {
+ // Skip dead defs. They shouldn't be added to the set.
+ if (Reg.second->isReg() && Reg.second->isDead())
+ continue;
addReg(Reg.first);
+ }
}
/// Prin the currently live registers to OS.
OpenPOWER on IntegriCloud