summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 38e8369dc73..62c360c5100 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -1439,6 +1439,20 @@ MachineBasicBlock::computeRegisterLiveness(const TargetRegisterInfo *TRI,
}
}
+ // If we reached the end, it is safe to clobber Reg at the end of a block of
+ // no successor has it live in.
+ if (I == end()) {
+ for (MachineBasicBlock *S : successors()) {
+ for (MCSubRegIterator SubReg(Reg, TRI, /*IncludeSelf*/true);
+ SubReg.isValid(); ++SubReg) {
+ if (S->isLiveIn(*SubReg))
+ return LQR_Live;
+ }
+ }
+
+ return LQR_Dead;
+ }
+
// At this point we have no idea of the liveness of the register.
return LQR_Unknown;
}
OpenPOWER on IntegriCloud