diff options
author | Owen Anderson <resistor@mac.com> | 2008-07-29 21:17:08 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-07-29 21:17:08 +0000 |
commit | 83ea1f8e19dc1fae54a3e40689ad0a76a8ff3992 (patch) | |
tree | 849628454f6cd09532309c7f5ffe26e6c0e5b0fc /lib/CodeGen/StrongPHIElimination.cpp | |
parent | a0c032f9b2eeae3a436850eaca54de4c6a5f23b6 (diff) | |
download | external_llvm-83ea1f8e19dc1fae54a3e40689ad0a76a8ff3992.tar.gz external_llvm-83ea1f8e19dc1fae54a3e40689ad0a76a8ff3992.tar.bz2 external_llvm-83ea1f8e19dc1fae54a3e40689ad0a76a8ff3992.zip |
When merging a PHI operand's live interval into the PHI's live interval, we need to merge over all liveranges in
the operand's interval that share the relevant value number, not just the range that immediately precedes the PHI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54174 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StrongPHIElimination.cpp')
-rw-r--r-- | lib/CodeGen/StrongPHIElimination.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp index 399e615418..3d23efec7b 100644 --- a/lib/CodeGen/StrongPHIElimination.cpp +++ b/lib/CodeGen/StrongPHIElimination.cpp @@ -786,21 +786,29 @@ void StrongPHIElimination::mergeLiveIntervals(unsigned primary, LiveInterval& RHS = LI.getOrCreateInterval(secondary); LI.computeNumbering(); - const LiveRange* RangeMergingIn = RHS.getLiveRangeContaining(LI.getMBBEndIdx(pred)); + VNInfo* RHSVN = RangeMergingIn->valno; VNInfo* NewVN = LHS.getNextValue(RangeMergingIn->valno->def, RangeMergingIn->valno->copy, LI.getVNInfoAllocator()); - NewVN->hasPHIKill = true; - LiveRange NewRange(RangeMergingIn->start, RangeMergingIn->end, NewVN); - - if (RHS.containsOneValue()) + + for (LiveInterval::iterator RI = RHS.begin(), RE = RHS.end(); + RI != RE; ) + if (RI->valno == RHSVN) { + NewVN->hasPHIKill = true; + LiveRange NewRange(RI->start, RI->end, NewVN); + LHS.addRange(NewRange); + + unsigned start = RI->start; + unsigned end = RI->end; + ++RI; + RHS.removeRange(start, end, true); + } else + ++RI; + + if (RHS.begin() == RHS.end()) LI.removeInterval(RHS.reg); - else - RHS.removeRange(RangeMergingIn->start, RangeMergingIn->end, true); - - LHS.addRange(NewRange); } bool StrongPHIElimination::runOnMachineFunction(MachineFunction &Fn) { |