summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-07-19 23:19:18 +0000
committerJustin Lebar <jlebar@google.com>2016-07-19 23:19:18 +0000
commit2cf2c2287083df0bf2e4506e5fc17b48731db511 (patch)
treedc4a3e27d2326918ba72b6d84cf87d53bf655ce4 /llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
parent4ee8a2d024a8204aee1c1e8a4dd0b253545d6fea (diff)
downloadbcm5719-llvm-2cf2c2287083df0bf2e4506e5fc17b48731db511.tar.gz
bcm5719-llvm-2cf2c2287083df0bf2e4506e5fc17b48731db511.zip
[LSV] Use make_range, and reformat a DEBUG message. NFC
Summary: The DEBUG message was hard to read because two Values were being printed on the same line with only the delimiter "aliases". This change makes us print each Value on its own line. Reviewers: asbirlea Subscribers: llvm-commits, arsenm, mzolotukhin Differential Revision: https://reviews.llvm.org/D22533 llvm-svn: 276055
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
index 941699a005e..290681599c0 100644
--- a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
@@ -431,14 +431,15 @@ unsigned Vectorizer::getVectorizablePrefixEndIdx(ArrayRef<Value *> Chain,
SmallVector<std::pair<Value *, unsigned>, 16> ChainInstrs;
unsigned InstrIdx = 0;
- for (auto I = From; I != To; ++I, ++InstrIdx) {
+ for (Instruction &I : make_range(From, To)) {
+ ++InstrIdx;
if (isa<LoadInst>(I) || isa<StoreInst>(I)) {
- if (!is_contained(Chain, &*I))
- MemoryInstrs.push_back({&*I, InstrIdx});
+ if (!is_contained(Chain, &I))
+ MemoryInstrs.push_back({&I, InstrIdx});
else
- ChainInstrs.push_back({&*I, InstrIdx});
- } else if (I->mayHaveSideEffects()) {
- DEBUG(dbgs() << "LSV: Found side-effecting operation: " << *I << '\n');
+ ChainInstrs.push_back({&I, InstrIdx});
+ } else if (I.mayHaveSideEffects()) {
+ DEBUG(dbgs() << "LSV: Found side-effecting operation: " << I << '\n');
return 0;
}
}
@@ -477,11 +478,13 @@ unsigned Vectorizer::getVectorizablePrefixEndIdx(ArrayRef<Value *> Chain,
Value *Ptr0 = getPointerOperand(M0);
Value *Ptr1 = getPointerOperand(M1);
- dbgs() << "LSV: Found alias.\n"
- " Aliasing instruction and pointer:\n"
- << *MemInstrValue << " aliases " << *Ptr0 << '\n'
- << " Aliased instruction and pointer:\n"
- << *ChainInstrValue << " aliases " << *Ptr1 << '\n';
+ dbgs() << "LSV: Found alias:\n"
+ " Aliasing instruction and pointer:\n"
+ << " " << *MemInstrValue << '\n'
+ << " " << *Ptr0 << '\n'
+ << " Aliased instruction and pointer:\n"
+ << " " << *ChainInstrValue << '\n'
+ << " " << *Ptr1 << '\n';
});
return ChainIdx;
@@ -744,7 +747,7 @@ bool Vectorizer::vectorizeStoreChain(
DEBUG({
dbgs() << "LSV: Stores to vectorize:\n";
for (Value *V : Chain)
- V->dump();
+ dbgs() << " " << *V << "\n";
});
// We won't try again to vectorize the elements of the chain, regardless of
OpenPOWER on IntegriCloud