summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/IntEqClasses.cpp
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2016-01-08 01:16:39 +0000
committerMatthias Braun <matze@braunis.de>2016-01-08 01:16:39 +0000
commit7c66afb887be14fc5c9cdc212b87dcb5b0e6c7f5 (patch)
treed0847b99361a52a112ebd9f7f9c84750ac706d8f /llvm/lib/Support/IntEqClasses.cpp
parentbf47f63b74c92458d87a94863b231f541c6e5ea2 (diff)
downloadbcm5719-llvm-7c66afb887be14fc5c9cdc212b87dcb5b0e6c7f5.tar.gz
bcm5719-llvm-7c66afb887be14fc5c9cdc212b87dcb5b0e6c7f5.zip
IntEqClasses: Let join() return the new leader
The new leader is known anyway so we can return it for some micro optimization in code where it is easy to pass along the result to the next join(). llvm-svn: 257130
Diffstat (limited to 'llvm/lib/Support/IntEqClasses.cpp')
-rw-r--r--llvm/lib/Support/IntEqClasses.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Support/IntEqClasses.cpp b/llvm/lib/Support/IntEqClasses.cpp
index 11344956e4c..ff213570807 100644
--- a/llvm/lib/Support/IntEqClasses.cpp
+++ b/llvm/lib/Support/IntEqClasses.cpp
@@ -29,7 +29,7 @@ void IntEqClasses::grow(unsigned N) {
EC.push_back(EC.size());
}
-void IntEqClasses::join(unsigned a, unsigned b) {
+unsigned IntEqClasses::join(unsigned a, unsigned b) {
assert(NumClasses == 0 && "join() called after compress().");
unsigned eca = EC[a];
unsigned ecb = EC[b];
@@ -41,6 +41,8 @@ void IntEqClasses::join(unsigned a, unsigned b) {
EC[b] = eca, b = ecb, ecb = EC[b];
else
EC[a] = ecb, a = eca, eca = EC[a];
+
+ return eca;
}
unsigned IntEqClasses::findLeader(unsigned a) const {
OpenPOWER on IntegriCloud