[llvm] r254842 - Use std::fill instead of memset to initialize an array to avoid hardcoded count and a multiply. The outputed code is identical.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 4 23:13:25 PST 2015


Author: ctopper
Date: Sat Dec  5 01:13:25 2015
New Revision: 254842

URL: http://llvm.org/viewvc/llvm-project?rev=254842&view=rev
Log:
Use std::fill instead of memset to initialize an array to avoid hardcoded count and a multiply. The outputed code is identical.

Modified:
    llvm/trunk/include/llvm/Target/TargetLowering.h

Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=254842&r1=254841&r2=254842&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Sat Dec  5 01:13:25 2015
@@ -1293,7 +1293,7 @@ protected:
 
   /// Remove all register classes.
   void clearRegisterClasses() {
-    memset(RegClassForVT, 0,MVT::LAST_VALUETYPE * sizeof(TargetRegisterClass*));
+    std::fill(std::begin(RegClassForVT), std::end(RegClassForVT), nullptr);
 
     AvailableRegClasses.clear();
   }




More information about the llvm-commits mailing list