ports/devel/llvm16/files/patch-backport-962c306a11d
Brooks Davis 3db2bfaf72 devel/llvm16: merge backports from FreeBSD src
These upstream LLVM commits have been merged to FreeBSD's source tree
post the 17.0.6 release:

7440e4ed85aa [sanitizer] Add re-execution on FreeBSD when ASLR is detected (#73439)
989879f8fded [Clang] Allow C++11 style initialisation of SVE types.
9ca395b5ade1 [clang][AST] Propagate the contains-errors bit to DeclRefExpr from VarDecl's initializer.

While here, be consistant about using 12 digits of commit hash.
2023-12-04 20:55:18 +00:00

42 lines
1.8 KiB
Text

commit 8e1222aee4c657e572b7d7841daf7f48ec6ba035
Author: John F. Carr <jfc@mit.edu>
Date: Tue Jun 13 14:10:00 2023 -0400
LLVM commit 962c306a11d0a21c884c12e18825b8a41ba1bd7d
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
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ 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);
}
}