diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2018-08-30 07:17:51 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2018-08-30 07:17:51 +0000 |
| commit | eba9e9a2663523d084acda3a63977d33f40c6e2b (patch) | |
| tree | 20f4497222d835659137fc6ffe71dab213f3dd25 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
| parent | 06adfa17188859cab229fb977ec9dfe2b7dce6ed (diff) | |
| download | bcm5719-llvm-eba9e9a2663523d084acda3a63977d33f40c6e2b.tar.gz bcm5719-llvm-eba9e9a2663523d084acda3a63977d33f40c6e2b.zip | |
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.cpp | 14 |
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; } |

