summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-09-28 20:07:41 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-09-28 20:07:41 +0000
commitdcb1bcae0b641701e07831b76a3130e6df765b3b (patch)
tree57421664d0629674fa119680af05024e4daae42b /llvm/lib/CodeGen
parent6207d459a417728f4f289b8b091f8160061c134a (diff)
downloadbcm5719-llvm-dcb1bcae0b641701e07831b76a3130e6df765b3b.tar.gz
bcm5719-llvm-dcb1bcae0b641701e07831b76a3130e6df765b3b.zip
IfConversion: Add implicit uses for redefined regs with live subregisters
Normally, if conversion would add implicit uses for redefined registers, e.g. R0<def> = add_if ..., R0<imp-use>. However, if only subregisters of R0 are known to be live but not R0 itself, such implicit uses will not be added, causing prior definitions of such subregisters and R0 itself to become dead. llvm-svn: 282626
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/IfConversion.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp
index f5f752ac27e..025eea229cc 100644
--- a/llvm/lib/CodeGen/IfConversion.cpp
+++ b/llvm/lib/CodeGen/IfConversion.cpp
@@ -1453,6 +1453,17 @@ static void UpdatePredRedefs(MachineInstr &MI, LivePhysRegs &Redefs) {
}
if (LiveBeforeMI.count(Reg))
MIB.addReg(Reg, RegState::Implicit);
+ else {
+ bool HasLiveSubReg = false;
+ for (MCSubRegIterator S(Reg, TRI); S.isValid(); ++S) {
+ if (!LiveBeforeMI.count(*S))
+ continue;
+ HasLiveSubReg = true;
+ break;
+ }
+ if (HasLiveSubReg)
+ MIB.addReg(Reg, RegState::Implicit);
+ }
}
}
OpenPOWER on IntegriCloud