diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-13 21:12:29 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-02-13 21:12:29 +0000 |
| commit | 0aa2ad61049651136c592633033911dc217f5102 (patch) | |
| tree | 46ffa5cd5f477c5aae314a1ee640302af77a97c5 /llvm/lib/Transforms/Vectorize | |
| parent | a361c9dd30dce42036d9a2900d9381eaabf3687b (diff) | |
| download | bcm5719-llvm-0aa2ad61049651136c592633033911dc217f5102.tar.gz bcm5719-llvm-0aa2ad61049651136c592633033911dc217f5102.zip | |
LoopVectorize: Simplify code for clarity.
No functionality change.
llvm-svn: 175076
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 842ae0291e2..ab1068dfa70 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -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())); } } @@ -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; |

