[llvm-branch-commits] [llvm-branch] r181455 - Merging r181286:

Bill Wendling isanbard at gmail.com
Wed May 8 11:13:06 PDT 2013


Author: void
Date: Wed May  8 13:13:06 2013
New Revision: 181455

URL: http://llvm.org/viewvc/llvm-project?rev=181455&view=rev
Log:
Merging r181286:
------------------------------------------------------------------------
r181286 | arnolds | 2013-05-06 21:37:05 -0700 (Mon, 06 May 2013) | 7 lines

LoopVectorize: getConsecutiveVector must respect signed arithmetic

We were passing an i32 to ConstantInt::get where an i64 was needed and we must
also pass the sign if we pass negatives numbers. The start index passed to
getConsecutiveVector must also be signed.

Should fix PR15882.
------------------------------------------------------------------------

Added:
    llvm/branches/release_33/test/Transforms/LoopVectorize/reverse_induction.ll
      - copied unchanged from r181286, llvm/trunk/test/Transforms/LoopVectorize/reverse_induction.ll
Modified:
    llvm/branches/release_33/   (props changed)
    llvm/branches/release_33/lib/Transforms/Vectorize/LoopVectorize.cpp

Propchange: llvm/branches/release_33/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed May  8 13:13:06 2013
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,181296,181313
+/llvm/trunk:155241,181286,181296,181313

Modified: llvm/branches/release_33/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_33/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=181455&r1=181454&r2=181455&view=diff
==============================================================================
--- llvm/branches/release_33/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/branches/release_33/lib/Transforms/Vectorize/LoopVectorize.cpp Wed May  8 13:13:06 2013
@@ -216,7 +216,7 @@ private:
   /// This function adds 0, 1, 2 ... to each vector element, starting at zero.
   /// If Negate is set then negative numbers are added e.g. (0, -1, -2, ...).
   /// The sequence starts at StartIndex.
-  Value *getConsecutiveVector(Value* Val, unsigned StartIdx, bool Negate);
+  Value *getConsecutiveVector(Value* Val, int StartIdx, bool Negate);
 
   /// When we go over instructions in the basic block we rely on previous
   /// values within the current basic block or on loop invariant values.
@@ -829,7 +829,7 @@ Value *InnerLoopVectorizer::getBroadcast
   return Shuf;
 }
 
-Value *InnerLoopVectorizer::getConsecutiveVector(Value* Val, unsigned StartIdx,
+Value *InnerLoopVectorizer::getConsecutiveVector(Value* Val, int StartIdx,
                                                  bool Negate) {
   assert(Val->getType()->isVectorTy() && "Must be a vector");
   assert(Val->getType()->getScalarType()->isIntegerTy() &&
@@ -842,8 +842,8 @@ Value *InnerLoopVectorizer::getConsecuti
 
   // Create a vector of consecutive numbers from zero to VF.
   for (int i = 0; i < VLen; ++i) {
-    int Idx = Negate ? (-i): i;
-    Indices.push_back(ConstantInt::get(ITy, StartIdx + Idx));
+    int64_t Idx = Negate ? (-i) : i;
+    Indices.push_back(ConstantInt::get(ITy, StartIdx + Idx, Negate));
   }
 
   // Add the consecutive indices to the vector value.
@@ -2072,7 +2072,8 @@ InnerLoopVectorizer::vectorizeBlockInLoo
           // After broadcasting the induction variable we need to make the
           // vector consecutive by adding  ... -3, -2, -1, 0.
           for (unsigned part = 0; part < UF; ++part)
-            Entry[part] = getConsecutiveVector(Broadcasted, -VF * part, true);
+            Entry[part] = getConsecutiveVector(Broadcasted, -(int)VF * part,
+                                               true);
           continue;
         }
 





More information about the llvm-branch-commits mailing list