We require DataLayout for analyzing the size of stores.
authorNadav Rotem <nrotem@apple.com>
Wed, 10 Apr 2013 18:57:27 +0000 (18:57 +0000)
committerNadav Rotem <nrotem@apple.com>
Wed, 10 Apr 2013 18:57:27 +0000 (18:57 +0000)
llvm-svn: 179206

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/lib/Transforms/Vectorize/VecUtils.cpp

index 4b61dc9..01b2b92 100644 (file)
@@ -107,6 +107,11 @@ struct SLPVectorizer : public BasicBlockPass {
     AA = &getAnalysis<AliasAnalysis>();
     StoreRefs.clear();
 
+    // Must have DataLayout. We can't require it because some tests run w/o
+    // triple.
+    if (!DL)
+      return false;
+
     // Use the bollom up slp vectorizer to construct chains that start with
     // he store instructions.
     BoUpSLP R(&BB, SE, DL, TTI, AA);
index 7e9f12d..3efaaf6 100644 (file)
@@ -94,7 +94,7 @@ bool BoUpSLP::isConsecutiveAccess(Value *A, Value *B) {
   Type *Ty = cast<PointerType>(PtrA->getType())->getElementType();
   // The Instructions are connsecutive if the size of the first load/store is
   // the same as the offset.
-  unsigned Sz = (DL ? DL->getTypeStoreSize(Ty) : Ty->getScalarSizeInBits()/8);
+  unsigned Sz = DL->getTypeStoreSize(Ty);
   return ((-Offset) == Sz);
 }