summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/StrongPHIElimination.cpp
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-01-04 16:24:51 +0000
committerCameron Zwarich <zwarich@apple.com>2011-01-04 16:24:51 +0000
commit5cd3d718f6c446729f6be33469380a353c660186 (patch)
tree304a50234c21167bc5122f40d94675a949a58fa7 /llvm/lib/CodeGen/StrongPHIElimination.cpp
parent4ccb9238206026ab722e77769bdaf2468d125838 (diff)
downloadbcm5719-llvm-5cd3d718f6c446729f6be33469380a353c660186.tar.gz
bcm5719-llvm-5cd3d718f6c446729f6be33469380a353c660186.zip
Switch to path halving from path compression for a small speedup. This also
makes getLeader() nonrecursive. llvm-svn: 122811
Diffstat (limited to 'llvm/lib/CodeGen/StrongPHIElimination.cpp')
-rw-r--r--llvm/lib/CodeGen/StrongPHIElimination.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/StrongPHIElimination.cpp b/llvm/lib/CodeGen/StrongPHIElimination.cpp
index 54c6647f059..dc260af0fc7 100644
--- a/llvm/lib/CodeGen/StrongPHIElimination.cpp
+++ b/llvm/lib/CodeGen/StrongPHIElimination.cpp
@@ -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) {
OpenPOWER on IntegriCloud