diff options
author | Matthias Braun <matze@braunis.de> | 2016-01-08 01:16:39 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2016-01-08 01:16:39 +0000 |
commit | 7c66afb887be14fc5c9cdc212b87dcb5b0e6c7f5 (patch) | |
tree | d0847b99361a52a112ebd9f7f9c84750ac706d8f /llvm/lib/Support/IntEqClasses.cpp | |
parent | bf47f63b74c92458d87a94863b231f541c6e5ea2 (diff) | |
download | llvm-7c66afb887be14fc5c9cdc212b87dcb5b0e6c7f5.zip llvm-7c66afb887be14fc5c9cdc212b87dcb5b0e6c7f5.tar.gz llvm-7c66afb887be14fc5c9cdc212b87dcb5b0e6c7f5.tar.bz2 |
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.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Support/IntEqClasses.cpp b/llvm/lib/Support/IntEqClasses.cpp index 1134495..ff21357 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 { |