summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegisterCoalescer.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-10-13 17:26:47 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-10-13 17:26:47 +0000
commitd86296a4aea7ebac9c8ef8ba92642b64545dec95 (patch)
tree95f4eb51a5efa085d5fb64072f07f1d2d93fe0f1 /lib/CodeGen/RegisterCoalescer.cpp
parent186f8d90df976349481ccf8c8e24c37c6ec5ffb4 (diff)
downloadllvm-d86296a4aea7ebac9c8ef8ba92642b64545dec95.tar.gz
llvm-d86296a4aea7ebac9c8ef8ba92642b64545dec95.tar.bz2
llvm-d86296a4aea7ebac9c8ef8ba92642b64545dec95.tar.xz
Drop <def,dead> flags when merging into an unused lane.
The new coalescer can merge a dead def into an unused lane of an otherwise live vector register. Clear the <dead> flag when that happens since the flag refers to the full virtual register which is still live after the partial dead def. This fixes PR14079. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165877 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegisterCoalescer.cpp')
-rw-r--r--lib/CodeGen/RegisterCoalescer.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp
index 19e9310d22..ad515c1064 100644
--- a/lib/CodeGen/RegisterCoalescer.cpp
+++ b/lib/CodeGen/RegisterCoalescer.cpp
@@ -1739,15 +1739,20 @@ void JoinVals::pruneValues(JoinVals &Other,
// has been replaced.
Val &OtherV = Other.Vals[Vals[i].OtherVNI->id];
bool EraseImpDef = OtherV.IsImplicitDef && OtherV.Resolution == CR_Keep;
- if (!EraseImpDef && !Def.isBlock()) {
+ if (!Def.isBlock()) {
// Remove <def,read-undef> flags. This def is now a partial redef.
+ // Also remove <def,dead> flags since the joined live range will
+ // continue past this instruction.
for (MIOperands MO(Indexes->getInstructionFromIndex(Def));
MO.isValid(); ++MO)
- if (MO->isReg() && MO->isDef() && MO->getReg() == LI.reg)
- MO->setIsUndef(false);
+ if (MO->isReg() && MO->isDef() && MO->getReg() == LI.reg) {
+ MO->setIsUndef(EraseImpDef);
+ MO->setIsDead(false);
+ }
// This value will reach instructions below, but we need to make sure
// the live range also reaches the instruction at Def.
- EndPoints.push_back(Def);
+ if (!EraseImpDef)
+ EndPoints.push_back(Def);
}
DEBUG(dbgs() << "\t\tpruned " << PrintReg(Other.LI.reg) << " at " << Def
<< ": " << Other.LI << '\n');