[llvm] r299319 - [APInt] Implement flipAllBitsSlowCase with tcComplement. NFCI

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 1 14:50:08 PDT 2017


Author: ctopper
Date: Sat Apr  1 16:50:08 2017
New Revision: 299319

URL: http://llvm.org/viewvc/llvm-project?rev=299319&view=rev
Log:
[APInt] Implement flipAllBitsSlowCase with tcComplement. NFCI

Modified:
    llvm/trunk/lib/Support/APInt.cpp

Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=299319&r1=299318&r2=299319&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Sat Apr  1 16:50:08 2017
@@ -539,8 +539,7 @@ void APInt::clearBit(unsigned bitPositio
 
 /// @brief Toggle every bit to its opposite value.
 void APInt::flipAllBitsSlowCase() {
-  for (unsigned i = 0; i < getNumWords(); ++i)
-    pVal[i] ^= UINT64_MAX;
+  tcComplement(pVal, getNumWords());
   clearUnusedBits();
 }
 




More information about the llvm-commits mailing list