Skip to content

Commit

Permalink
LoopVectorize: Simplify code for clarity.
Browse files Browse the repository at this point in the history
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175076 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
d0k committed Feb 13, 2013
1 parent 6eaab0d commit c0a6e07
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2805,17 +2805,17 @@ unsigned LoopVectorizationCostModel::getWidestType() {
continue;

// Examine the stored values.
StoreInst *ST = 0;
if ((ST = dyn_cast<StoreInst>(it)))
if (StoreInst *ST = dyn_cast<StoreInst>(it))
T = ST->getValueOperand()->getType();

// Ignore loaded pointer types and stored pointer types that are not
// consecutive. However, we do want to take consecutive stores/loads of
// pointer vectors into account.
if (T->isPointerTy() && isConsecutiveLoadOrStore(it))
MaxWidth = std::max(MaxWidth, DL->getPointerSizeInBits());
else
MaxWidth = std::max(MaxWidth, T->getScalarSizeInBits());
if (T->isPointerTy() && !isConsecutiveLoadOrStore(it))
continue;

MaxWidth = std::max(MaxWidth,
(unsigned)DL->getTypeSizeInBits(T->getScalarType()));
}
}

Expand Down Expand Up @@ -3242,13 +3242,11 @@ namespace llvm {

bool LoopVectorizationCostModel::isConsecutiveLoadOrStore(Instruction *Inst) {
// Check for a store.
StoreInst *ST = dyn_cast<StoreInst>(Inst);
if (ST)
if (StoreInst *ST = dyn_cast<StoreInst>(Inst))
return Legal->isConsecutivePtr(ST->getPointerOperand()) != 0;

// Check for a load.
LoadInst *LI = dyn_cast<LoadInst>(Inst);
if (LI)
if (LoadInst *LI = dyn_cast<LoadInst>(Inst))
return Legal->isConsecutivePtr(LI->getPointerOperand()) != 0;

return false;
Expand Down

0 comments on commit c0a6e07

Please sign in to comment.