Changeset View
Changeset View
Standalone View
Standalone View
lib/Transforms/Vectorize/LoopVectorize.cpp
Property | Old Value | New Value |
---|---|---|
File Mode | 100644 | 100755 |
Context not available. | |||||
bool UseDeferred = SetIteration > 0; | bool UseDeferred = SetIteration > 0; | ||||
PtrAccessSet &S = UseDeferred ? DeferredAccesses : Accesses; | PtrAccessSet &S = UseDeferred ? DeferredAccesses : Accesses; | ||||
for (auto A : AS) { | for (auto AV : AS) { | ||||
Value *Ptr = A.getValue(); | Value *Ptr = AV.getValue(); | ||||
bool IsWrite = S.count(MemAccessInfo(Ptr, true)); | |||||
// If we're using the deferred access set, then it contains only reads. | // For a single memory access in AliasSetTracker, Accesses may contain | ||||
bool IsReadOnlyPtr = ReadOnlyPtr.count(Ptr) && !IsWrite; | // both read and write, and they both need to be handled for CheckDeps. | ||||
if (UseDeferred && !IsReadOnlyPtr) | for (auto AC : S) { | ||||
continue; | if (AC.getPointer() != Ptr) | ||||
// Otherwise, the pointer must be in the PtrAccessSet, either as a read | continue; | ||||
// or a write. | |||||
assert(((IsReadOnlyPtr && UseDeferred) || IsWrite || | |||||
S.count(MemAccessInfo(Ptr, false))) && | |||||
"Alias-set pointer not in the access set?"); | |||||
MemAccessInfo Access(Ptr, IsWrite); | |||||
DepCands.insert(Access); | |||||
// Memorize read-only pointers for later processing and skip them in the | |||||
// first round (they need to be checked after we have seen all write | |||||
// pointers). Note: we also mark pointer that are not consecutive as | |||||
// "read-only" pointers (so that we check "a[b[i]] +="). Hence, we need | |||||
// the second check for "!IsWrite". | |||||
if (!UseDeferred && IsReadOnlyPtr) { | |||||
DeferredAccesses.insert(Access); | |||||
continue; | |||||
} | |||||
// If this is a write - check other reads and writes for conflicts. If | bool IsWrite = AC.getInt(); | ||||
// this is a read only check other writes for conflicts (but only if | |||||
// there is no other write to the ptr - this is an optimization to | // If we're using the deferred access set, then it contains only | ||||
// catch "a[i] = a[i] + " without having to do a dependence check). | // reads. | ||||
if ((IsWrite || IsReadOnlyPtr) && SetHasWrite) { | bool IsReadOnlyPtr = ReadOnlyPtr.count(Ptr) && !IsWrite; | ||||
CheckDeps.insert(Access); | if (UseDeferred && !IsReadOnlyPtr) | ||||
IsRTCheckNeeded = true; | continue; | ||||
} | // Otherwise, the pointer must be in the PtrAccessSet, either as a | ||||
// read or a write. | |||||
assert(((IsReadOnlyPtr && UseDeferred) || IsWrite || | |||||
S.count(MemAccessInfo(Ptr, false))) && | |||||
"Alias-set pointer not in the access set?"); | |||||
MemAccessInfo Access(Ptr, IsWrite); | |||||
DepCands.insert(Access); | |||||
// Memorize read-only pointers for later processing and skip them in | |||||
// the first round (they need to be checked after we have seen all | |||||
// write pointers). Note: we also mark pointer that are not | |||||
// consecutive as "read-only" pointers (so that we check | |||||
// "a[b[i]] +="). Hence, we need the second check for "!IsWrite". | |||||
if (!UseDeferred && IsReadOnlyPtr) { | |||||
DeferredAccesses.insert(Access); | |||||
continue; | |||||
} | |||||
if (IsWrite) | // If this is a write - check other reads and writes for conflicts. If | ||||
SetHasWrite = true; | // this is a read only check other writes for conflicts (but only if | ||||
// there is no other write to the ptr - this is an optimization to | |||||
// Create sets of pointers connected by a shared alias set and | // catch "a[i] = a[i] + " without having to do a dependence check). | ||||
// underlying object. | if ((IsWrite || IsReadOnlyPtr) && SetHasWrite) { | ||||
typedef SmallVector<Value *, 16> ValueVector; | CheckDeps.insert(Access); | ||||
ValueVector TempObjects; | IsRTCheckNeeded = true; | ||||
GetUnderlyingObjects(Ptr, TempObjects, DL); | } | ||||
for (Value *UnderlyingObj : TempObjects) { | |||||
UnderlyingObjToAccessMap::iterator Prev = | if (IsWrite) | ||||
ObjToLastAccess.find(UnderlyingObj); | SetHasWrite = true; | ||||
if (Prev != ObjToLastAccess.end()) | |||||
DepCands.unionSets(Access, Prev->second); | // Create sets of pointers connected by a shared alias set and | ||||
// underlying object. | |||||
ObjToLastAccess[UnderlyingObj] = Access; | typedef SmallVector<Value *, 16> ValueVector; | ||||
ValueVector TempObjects; | |||||
GetUnderlyingObjects(Ptr, TempObjects, DL); | |||||
for (Value *UnderlyingObj : TempObjects) { | |||||
UnderlyingObjToAccessMap::iterator Prev = | |||||
ObjToLastAccess.find(UnderlyingObj); | |||||
if (Prev != ObjToLastAccess.end()) | |||||
DepCands.unionSets(Access, Prev->second); | |||||
ObjToLastAccess[UnderlyingObj] = Access; | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
Context not available. |