Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 May 2013 07:02:16 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r250593 - head/contrib/llvm/lib/Transforms/Vectorize
Message-ID:  <201305130702.r4D72GbD086997@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Mon May 13 07:02:15 2013
New Revision: 250593
URL: http://svnweb.freebsd.org/changeset/base/250593

Log:
  Pull in r181286 from upstream llvm trunk:
  
    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.
  
  This should fix Firefox crashes some people have been reporting, when it
  is compiled with -O3.

Modified:
  head/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Modified: head/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
==============================================================================
--- head/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp	Mon May 13 06:52:46 2013	(r250592)
+++ head/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp	Mon May 13 07:02:15 2013	(r250593)
@@ -214,7 +214,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.
@@ -771,7 +771,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() &&
@@ -784,8 +784,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.
@@ -1928,7 +1928,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;
         }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305130702.r4D72GbD086997>