aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2018-08-30 07:17:51 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2018-08-30 07:17:51 +0000
commiteba9e9a2663523d084acda3a63977d33f40c6e2b (patch)
tree20f4497222d835659137fc6ffe71dab213f3dd25 /llvm/lib/CodeGen/MachineBasicBlock.cpp
parent06adfa17188859cab229fb977ec9dfe2b7dce6ed (diff)
downloadllvm-eba9e9a2663523d084acda3a63977d33f40c6e2b.zip
llvm-eba9e9a2663523d084acda3a63977d33f40c6e2b.tar.gz
llvm-eba9e9a2663523d084acda3a63977d33f40c6e2b.tar.bz2
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. llvm-svn: 341026
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-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 38e8369..62c360c 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;
}