diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-10-02 21:46:39 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-10-02 21:46:39 +0000 |
commit | 27cb347d0e765175efb2c4d388bcbba84cf1b95e (patch) | |
tree | 3941172340fa3c1f5c26af2731534f62c2781064 /lib/CodeGen | |
parent | abe704309f2958f14ba4b59d9be8c9fba72a48c1 (diff) | |
download | llvm-27cb347d0e765175efb2c4d388bcbba84cf1b95e.tar.gz llvm-27cb347d0e765175efb2c4d388bcbba84cf1b95e.tar.bz2 llvm-27cb347d0e765175efb2c4d388bcbba84cf1b95e.tar.xz |
Make sure the whole live range is covered when values are pruned twice.
JoinVals::pruneValues() calls LIS->pruneValue() to avoid conflicts when
overlapping two different values. This produces a set of live range end
points that are used to reconstruct the live range (with SSA update)
after joining the two registers.
When a value is pruned twice, the set of end points was insufficient:
v1 = DEF
v1 = REPLACE1
v1 = REPLACE2
KILL v1
The end point at KILL would only reconstruct the live range from
REPLACE2 to KILL, leaving the range REPLACE1-REPLACE2 dead.
Add REPLACE2 as an end point in this case so the full live range is
reconstructed.
This fixes PR13999.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/RegisterCoalescer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index f45072f1ac..ad1f5f4f12 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -1733,11 +1733,15 @@ void JoinVals::pruneValues(JoinVals &Other, // This value takes precedence over the value in Other.LI. LIS->pruneValue(&Other.LI, Def, &EndPoints); // Remove <def,read-undef> flags. This def is now a partial redef. - if (!Def.isBlock()) + if (!Def.isBlock()) { for (MIOperands MO(Indexes->getInstructionFromIndex(Def)); MO.isValid(); ++MO) if (MO->isReg() && MO->isDef() && MO->getReg() == LI.reg) MO->setIsUndef(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); + } DEBUG(dbgs() << "\t\tpruned " << PrintReg(Other.LI.reg) << " at " << Def << ": " << Other.LI << '\n'); break; |