[llvm] r186466 - flip the scev minus direction to simplify the code.

Nadav Rotem nrotem at apple.com
Tue Jul 16 15:57:06 PDT 2013


Author: nadav
Date: Tue Jul 16 17:57:06 2013
New Revision: 186466

URL: http://llvm.org/viewvc/llvm-project?rev=186466&view=rev
Log:
flip the scev minus direction to simplify the code.

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

Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=186466&r1=186465&r2=186466&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Tue Jul 16 17:57:06 2013
@@ -1004,7 +1004,7 @@ bool BoUpSLP::isConsecutiveAccess(Value
   // Calculate the distance.
   const SCEV *PtrSCEVA = SE->getSCEV(PtrA);
   const SCEV *PtrSCEVB = SE->getSCEV(PtrB);
-  const SCEV *OffsetSCEV = SE->getMinusSCEV(PtrSCEVA, PtrSCEVB);
+  const SCEV *OffsetSCEV = SE->getMinusSCEV(PtrSCEVB, PtrSCEVA);
   const SCEVConstant *ConstOffSCEV = dyn_cast<SCEVConstant>(OffsetSCEV);
 
   // Non constant distance.
@@ -1013,10 +1013,10 @@ bool BoUpSLP::isConsecutiveAccess(Value
 
   int64_t Offset = ConstOffSCEV->getValue()->getSExtValue();
   Type *Ty = cast<PointerType>(PtrA->getType())->getElementType();
-  // The Instructions are connsecutive if the size of the first load/store is
+  // The Instructions are consecutive if the size of the first load/store is
   // the same as the offset.
   int64_t Sz = DL->getTypeStoreSize(Ty);
-  return ((-Offset) == Sz);
+  return (Offset == Sz);
 }
 
 Value *BoUpSLP::getSinkBarrier(Instruction *Src, Instruction *Dst) {





More information about the llvm-commits mailing list