LoopVectorize: Simplify code for clarity.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175076 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2013-02-13 21:12:29 +00:00
parent 6eaab0d69b
commit c0a6e070fc

View File

@ -2805,17 +2805,17 @@ unsigned LoopVectorizationCostModel::getWidestType() {
continue; continue;
// Examine the stored values. // Examine the stored values.
StoreInst *ST = 0; if (StoreInst *ST = dyn_cast<StoreInst>(it))
if ((ST = dyn_cast<StoreInst>(it)))
T = ST->getValueOperand()->getType(); T = ST->getValueOperand()->getType();
// Ignore loaded pointer types and stored pointer types that are not // Ignore loaded pointer types and stored pointer types that are not
// consecutive. However, we do want to take consecutive stores/loads of // consecutive. However, we do want to take consecutive stores/loads of
// pointer vectors into account. // pointer vectors into account.
if (T->isPointerTy() && isConsecutiveLoadOrStore(it)) if (T->isPointerTy() && !isConsecutiveLoadOrStore(it))
MaxWidth = std::max(MaxWidth, DL->getPointerSizeInBits()); continue;
else
MaxWidth = std::max(MaxWidth, T->getScalarSizeInBits()); MaxWidth = std::max(MaxWidth,
(unsigned)DL->getTypeSizeInBits(T->getScalarType()));
} }
} }
@ -3242,13 +3242,11 @@ namespace llvm {
bool LoopVectorizationCostModel::isConsecutiveLoadOrStore(Instruction *Inst) { bool LoopVectorizationCostModel::isConsecutiveLoadOrStore(Instruction *Inst) {
// Check for a store. // Check for a store.
StoreInst *ST = dyn_cast<StoreInst>(Inst); if (StoreInst *ST = dyn_cast<StoreInst>(Inst))
if (ST)
return Legal->isConsecutivePtr(ST->getPointerOperand()) != 0; return Legal->isConsecutivePtr(ST->getPointerOperand()) != 0;
// Check for a load. // Check for a load.
LoadInst *LI = dyn_cast<LoadInst>(Inst); if (LoadInst *LI = dyn_cast<LoadInst>(Inst))
if (LI)
return Legal->isConsecutivePtr(LI->getPointerOperand()) != 0; return Legal->isConsecutivePtr(LI->getPointerOperand()) != 0;
return false; return false;