Apply llvm fix for hanging gcc builds on 32-bit arm
Merge commit 962c306a11d0 from llvm-project (by Florian Hahn): [LV] Don't consider pointer as uniform if it is also stored. Update isVectorizedMemAccessUse to also check if the pointer is stored. This prevents LV to incorrectly consider a pointer as uniform if it is used as both pointer and stored by the same StoreInst. Fixes #61396. PR: 271992 Reported by: John F. Carr <jfc@mit.edu> MFC after: 3 days
This commit is contained in:
parent
194e059bb8
commit
dbbaf77801
@ -4627,11 +4627,17 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
|
||||
WideningDecision == CM_Interleave);
|
||||
};
|
||||
|
||||
|
||||
// Returns true if Ptr is the pointer operand of a memory access instruction
|
||||
// I, and I is known to not require scalarization.
|
||||
// I, I is known to not require scalarization, and the pointer is not also
|
||||
// stored.
|
||||
auto isVectorizedMemAccessUse = [&](Instruction *I, Value *Ptr) -> bool {
|
||||
return getLoadStorePointerOperand(I) == Ptr && isUniformDecision(I, VF);
|
||||
auto GetStoredValue = [I]() -> Value * {
|
||||
if (!isa<StoreInst>(I))
|
||||
return nullptr;
|
||||
return I->getOperand(0);
|
||||
};
|
||||
return getLoadStorePointerOperand(I) == Ptr && isUniformDecision(I, VF) &&
|
||||
GetStoredValue() != Ptr;
|
||||
};
|
||||
|
||||
// Holds a list of values which are known to have at least one uniform use.
|
||||
@ -4679,8 +4685,8 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
|
||||
if (isa<LoadInst>(I) && Legal->isUniformMemOp(I))
|
||||
addToWorklistIfAllowed(&I);
|
||||
|
||||
if (isUniformDecision(&I, VF)) {
|
||||
assert(isVectorizedMemAccessUse(&I, Ptr) && "consistency check");
|
||||
if (isVectorizedMemAccessUse(&I, Ptr)) {
|
||||
assert(isUniformDecision(&I, VF) && "consistency check");
|
||||
HasUniformUse.insert(Ptr);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user