LoopVectorizer: When checking for vectorizable types, also check

the StoreInst operands.

PR14705.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171023 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nadav Rotem
2012-12-24 09:14:18 +00:00
parent daf7b5c8f2
commit 9e5329d77e
2 changed files with 37 additions and 1 deletions

View File

@@ -1464,13 +1464,20 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
return false;
}
// We do not re-vectorize vectors.
// Check that the instruction return type is vectorizable.
if (!VectorType::isValidElementType(it->getType()) &&
!it->getType()->isVoidTy()) {
DEBUG(dbgs() << "LV: Found unvectorizable type." << "\n");
return false;
}
// Check that the stored type is vectorizable.
if (StoreInst *ST = dyn_cast<StoreInst>(it)) {
Type *T = ST->getValueOperand()->getType();
if (!VectorType::isValidElementType(T))
return false;
}
// Reduction instructions are allowed to have exit users.
// All other instructions must not have external users.
if (!AllowedExit.count(it))