CodeGen: Make computeRegisterLiveness consider successors

If the end of the block is reached during the scan, check
the live ins of the successors. This was already done in the
other direction if the block entry was reached.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341026 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matt Arsenault
2018-08-30 07:17:51 +00:00
parent 03c16fb53c
commit 23c93c1752
3 changed files with 83 additions and 7 deletions
+14
View File
@@ -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;
}