aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-06-19 18:32:40 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-06-19 18:33:33 +0000
commitdbbaf77801a8f30e49731395e85757f339f345bf (patch)
tree161c11b14384f65527d6992b7e8d4b24e268b449 /contrib
parent194e059bb80334e6f4f791a186015b20d7f6f4b8 (diff)
downloadsrc-dbbaf77801a8f30e49731395e85757f339f345bf.tar.gz
src-dbbaf77801a8f30e49731395e85757f339f345bf.zip
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
Diffstat (limited to 'contrib')
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 5fd4e45d80fb..9d95cb25efa0 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -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);
}
}