summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegisterCoalescer.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-10-05 00:01:46 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-10-05 00:01:46 +0000
commitb077cf338bd85a6a7397ec88d65278f02f0ed06f (patch)
tree184f5e206bb514fd500b9f5eca5c7100f22ee727 /lib/CodeGen/RegisterCoalescer.cpp
parent2fec6c5ff153786744ba7d0d302b73179731c5e9 (diff)
downloadllvm-b077cf338bd85a6a7397ec88d65278f02f0ed06f.tar.gz
llvm-b077cf338bd85a6a7397ec88d65278f02f0ed06f.tar.bz2
llvm-b077cf338bd85a6a7397ec88d65278f02f0ed06f.tar.xz
Also add <def,undef> flags when coalescing sub-registers.
RegisterCoalescer can create sub-register defs when it is joining a register with a sub-register. Add <undef> flags to these new sub-register defs where appropriate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141138 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegisterCoalescer.cpp')
-rw-r--r--lib/CodeGen/RegisterCoalescer.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp
index 990ef370bb..361ae7a63f 100644
--- a/lib/CodeGen/RegisterCoalescer.cpp
+++ b/lib/CodeGen/RegisterCoalescer.cpp
@@ -967,6 +967,14 @@ RegisterCoalescer::UpdateRegDefsUses(const CoalescerPair &CP) {
Kills |= MO.isKill();
Deads |= MO.isDead();
+ // Make sure we don't create read-modify-write defs accidentally. We
+ // assume here that a SrcReg def cannot be joined into a live DstReg. If
+ // RegisterCoalescer starts tracking partially live registers, we will
+ // need to check the actual LiveInterval to determine if DstReg is live
+ // here.
+ if (SubIdx && !Reads)
+ MO.setIsUndef();
+
if (DstIsPhys)
MO.substPhysReg(DstReg, *TRI);
else