[llvm] r342944 - Use TRI->regsOverlap() in MachineBasicBlock::computeRegisterLiveness
Mikael Holmen via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 24 23:10:04 PDT 2018
Author: uabelho
Date: Mon Sep 24 23:10:04 2018
New Revision: 342944
URL: http://llvm.org/viewvc/llvm-project?rev=342944&view=rev
Log:
Use TRI->regsOverlap() in MachineBasicBlock::computeRegisterLiveness
Summary:
For the loop that used MCRegAliasIterator this should be NFC.
For the loop that previously used MCSubRegIterator we should
now detect more cases where the register is actually live out that
we previously missed.
Reviewers: MatzeB, arsenm
Reviewed By: MatzeB
Subscribers: wdng, llvm-commits
Differential Revision: https://reviews.llvm.org/D52410
Modified:
llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=342944&r1=342943&r2=342944&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Mon Sep 24 23:10:04 2018
@@ -1404,9 +1404,8 @@ MachineBasicBlock::computeRegisterLivene
// 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))
+ for (const MachineBasicBlock::RegisterMaskPair &LI : S->liveins()) {
+ if (TRI->regsOverlap(LI.PhysReg, Reg))
return LQR_Live;
}
}
@@ -1460,9 +1459,8 @@ MachineBasicBlock::computeRegisterLivene
// Did we get to the start of the block?
if (I == begin()) {
// If so, the register's state is definitely defined by the live-in state.
- for (MCRegAliasIterator RAI(Reg, TRI, /*IncludeSelf=*/true); RAI.isValid();
- ++RAI)
- if (isLiveIn(*RAI))
+ for (const MachineBasicBlock::RegisterMaskPair &LI : liveins())
+ if (TRI->regsOverlap(LI.PhysReg, Reg))
return LQR_Live;
return LQR_Dead;
More information about the llvm-commits
mailing list