[llvm-commits] [llvm] r166205 - /llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
Nadav Rotem
nrotem at apple.com
Thu Oct 18 11:34:50 PDT 2012
Author: nadav
Date: Thu Oct 18 13:34:50 2012
New Revision: 166205
URL: http://llvm.org/viewvc/llvm-project?rev=166205&view=rev
Log:
Avoid reconstructing the pointer set when searching for duplicated read/write pointers.
Modified:
llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=166205&r1=166204&r2=166205&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Thu Oct 18 13:34:50 2012
@@ -166,7 +166,7 @@
// Check if a pointer value is known to be disjoint.
// Example: Alloca, Global, NoAlias.
- bool isKnownDisjoint(Value* Val);
+ bool isidentifiedSafeObject(Value* Val);
/// The loop that we evaluate.
Loop *TheLoop;
@@ -818,34 +818,31 @@
// disjoint memory locations, or that they are no-alias arguments.
ValueVector::iterator r, re, w, we;
for (r = Reads.begin(), re = Reads.end(); r != re; ++r) {
- if (!isKnownDisjoint(*r)) {
+ if (!isidentifiedSafeObject(*r)) {
DEBUG(dbgs() << "LV: Found a bad read Ptr: "<< **r << "\n");
return false;
}
}
for (w = Writes.begin(), we = Writes.end(); w != we; ++w) {
- if (!isKnownDisjoint(*w)) {
+ if (!isidentifiedSafeObject(*w)) {
DEBUG(dbgs() << "LV: Found a bad write Ptr: "<< **w << "\n");
return false;
}
}
// Check that there are no multiple write locations to the same pointer.
- SmallPtrSet<Value*, 8> BasePointers;
+ SmallPtrSet<Value*, 8> WritePointerSet;
for (w = Writes.begin(), we = Writes.end(); w != we; ++w) {
- if (BasePointers.count(*w)) {
+ if (!WritePointerSet.insert(*w)) {
DEBUG(dbgs() << "LV: Multiple writes to the same index :"<< **w << "\n");
return false;
}
- BasePointers.insert(*w);
}
- // Sort the writes vector so that we can use a binary search.
- std::sort(Writes.begin(), Writes.end());
// Check that the reads and the writes are disjoint.
for (r = Reads.begin(), re = Reads.end(); r != re; ++r) {
- if (std::binary_search(Writes.begin(), Writes.end(), *r)) {
+ if (WritePointerSet.count(*r)) {
DEBUG(dbgs() << "Vectorizer: Found a read/write ptr:"<< **r << "\n");
return false;
}
@@ -857,7 +854,7 @@
/// Checks if the value is a Global variable or if it is an Arguments
/// marked with the NoAlias attribute.
-bool LoopVectorizationLegality::isKnownDisjoint(Value* Val) {
+bool LoopVectorizationLegality::isidentifiedSafeObject(Value* Val) {
assert(Val && "Invalid value");
if (dyn_cast<GlobalValue>(Val))
return true;
More information about the llvm-commits
mailing list