[llvm-commits] [llvm] r54174 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
Owen Anderson
resistor at mac.com
Tue Jul 29 14:17:09 PDT 2008
Author: resistor
Date: Tue Jul 29 16:17:08 2008
New Revision: 54174
URL: http://llvm.org/viewvc/llvm-project?rev=54174&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=54174&r1=54173&r2=54174&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Jul 29 16:17:08 2008
@@ -786,21 +786,29 @@
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);
+
+ 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.containsOneValue())
+ 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) {
More information about the llvm-commits
mailing list