[llvm-commits] [llvm] r167055 - /llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp

Nadav Rotem nrotem at apple.com
Tue Oct 30 15:06:26 PDT 2012


Author: nadav
Date: Tue Oct 30 17:06:26 2012
New Revision: 167055

URL: http://llvm.org/viewvc/llvm-project?rev=167055&view=rev
Log:
Add documentation.

Modified:
    llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=167055&r1=167054&r2=167055&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Tue Oct 30 17:06:26 2012
@@ -749,16 +749,21 @@
 }
 
 
+/// This function returns the identity element (or neutral element) for
+/// the operation K.
 static unsigned
 getReductionIdentity(LoopVectorizationLegality::ReductionKind K) {
   switch (K) {
   case LoopVectorizationLegality::IntegerXor:
   case LoopVectorizationLegality::IntegerAdd:
   case LoopVectorizationLegality::IntegerOr:
+    // Adding, Xoring, Oring zero to a number does not change it.
     return 0;
   case LoopVectorizationLegality::IntegerMult:
+    // Multiplying a number by 1 does not change it.
     return 1;
   case LoopVectorizationLegality::IntegerAnd:
+    // AND-ing a number with an all-1 value does not change it.
     return -1;
   default:
     llvm_unreachable("Unknown reduction kind");





More information about the llvm-commits mailing list