Switch to path halving from path compression for a small speedup. This also

makes getLeader() nonrecursive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122811 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Cameron Zwarich 2011-01-04 16:24:51 +00:00
parent ee38f85104
commit 26db45818a

View File

@ -400,12 +400,18 @@ void StrongPHIElimination::addReg(unsigned Reg) {
StrongPHIElimination::Node*
StrongPHIElimination::Node::getLeader() {
Node* parentPointer = parent.getPointer();
if (parentPointer == this)
return this;
Node* newParent = parentPointer->getLeader();
parent.setPointer(newParent);
return newParent;
Node* N = this;
Node* Parent = parent.getPointer();
Node* Grandparent = Parent->parent.getPointer();
while (Parent != Grandparent) {
N->parent.setPointer(Grandparent);
N = Grandparent;
Parent = Parent->parent.getPointer();
Grandparent = Parent->parent.getPointer();
}
return Parent;
}
unsigned StrongPHIElimination::getRegColor(unsigned Reg) {