diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp b/lib/Transforms/Vectorize/SLPVectorizer.cpp index 4b61dc91202..01b2b92870e 100644 --- a/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -107,6 +107,11 @@ struct SLPVectorizer : public BasicBlockPass { AA = &getAnalysis(); 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); diff --git a/lib/Transforms/Vectorize/VecUtils.cpp b/lib/Transforms/Vectorize/VecUtils.cpp index 7e9f12d43c7..3efaaf6edd1 100644 --- a/lib/Transforms/Vectorize/VecUtils.cpp +++ b/lib/Transforms/Vectorize/VecUtils.cpp @@ -94,7 +94,7 @@ bool BoUpSLP::isConsecutiveAccess(Value *A, Value *B) { Type *Ty = cast(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); }