Skip to content

Commit

Permalink
devel/llvm15: arm fixes, lite default change
Browse files Browse the repository at this point in the history
Change the lite flavor to default to BE_FREEBSD rather than BE_NATIVE to
allow its use in cross-build CI pipelines.

Backport fix for LLVM bug 61396. [0]  This fixes miscompilation of gcc
on 32-bit arm.

Remove an obsolete patch which breaks arm64. [1]

PR:		271992 [0], 271616 [1]
Reported by:	jfc@mit.edu [0,1]
  • Loading branch information
brooksdavis committed Jun 19, 2023
1 parent c26ca31 commit f67260a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 95 deletions.
4 changes: 2 additions & 2 deletions devel/llvm15/Makefile
@@ -1,6 +1,6 @@
PORTNAME= llvm
DISTVERSION= 15.0.7
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= devel lang
MASTER_SITES= https://github.com/llvm/llvm-project/releases/download/llvmorg-${DISTVERSION:S/rc/-rc/}/ \
https://${PRE_}releases.llvm.org/${LLVM_RELEASE}${RCDIR}/
Expand Down Expand Up @@ -97,7 +97,7 @@ OPTIONS_SINGLE_BACKENDS=BE_FREEBSD BE_NATIVE BE_STANDARD
OPTIONS_SUB= yes

.if ${FLAVOR:Mlite}
OPTIONS_DEFAULT+= BE_NATIVE
OPTIONS_DEFAULT+= BE_FREEBSD
.else
OPTIONS_DEFINE+= EXTRAS FLANG LIT LLDB MLIR OPENMP PYCLANG
OPTIONS_DEFINE_aarch64= OPENMP
Expand Down
42 changes: 42 additions & 0 deletions devel/llvm15/files/patch-backport-962c306a1
@@ -0,0 +1,42 @@
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);
}
}
93 changes: 0 additions & 93 deletions devel/llvm15/files/patch-freebsd-r352318

This file was deleted.

0 comments on commit f67260a

Please sign in to comment.