git: b4b2adbcf8f1 - main - devel/llvm16: support polyhedral optimizations

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Fri, 14 Jul 2023 19:07:17 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b4b2adbcf8f1c111e26b2670de59382f764b9abd

commit b4b2adbcf8f1c111e26b2670de59382f764b9abd
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-07-14 19:07:05 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-07-14 19:07:05 +0000

    devel/llvm16: support polyhedral optimizations
    
    The POLLY option enables the Polly optimizer.  It is currently disabled
    by default to allow a merge to quarterly without added risk.  I plan to
    enable it when I create devel/llvm17 in a couple weeks.
    
    From the website (https://polly.llvm.org):
    
      Polly is a high-level loop and data-locality optimizer and
      optimization infrastructure for LLVM. It uses an abstract mathematical
      representation based on integer polyhedra to analyze and optimize the
      memory access pattern of a program. We currently perform classical
      loop transformations, especially tiling and loop fusion to improve
      data-locality. Polly can also exploit OpenMP level parallelism, expose
      SIMDization opportunities.
    
    PR:             272400
---
 devel/llvm16/Makefile          |  16 ++++--
 devel/llvm16/Makefile.MAN1SRCS |   3 ++
 devel/llvm16/pkg-plist         | 120 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 136 insertions(+), 3 deletions(-)

diff --git a/devel/llvm16/Makefile b/devel/llvm16/Makefile
index 7a70876d13e7..196dd616cc30 100644
--- a/devel/llvm16/Makefile
+++ b/devel/llvm16/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	llvm
 DISTVERSION=	16.0.6
-PORTREVISION=	2
+PORTREVISION=	3
 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}/
@@ -102,7 +102,7 @@ OPTIONS_SUB=	yes
 .if ${FLAVOR:Mlite}
 OPTIONS_DEFAULT+=	BE_FREEBSD
 .else
-OPTIONS_DEFINE+=	EXTRAS FLANG LIT LLDB MLIR OPENMP PYCLANG
+OPTIONS_DEFINE+=	EXTRAS FLANG LIT LLDB MLIR OPENMP PYCLANG POLLY
 OPTIONS_DEFINE_amd64=	GOLD
 OPTIONS_DEFINE_powerpc=	GOLD
 OPTIONS_DEFINE_powerpc64=	GOLD
@@ -123,7 +123,8 @@ OPTIONS_EXCLUDE_FreeBSD_12=	OPENMP
 .endif
 
 # All non-backend options
-_ALL_OPTIONS=	CLANG COMPILER_RT DOCS EXTRAS FLANG GOLD LIT LLD LLDB MLIR OPENMP PYCLANG STATIC_LIBS
+_ALL_OPTIONS=	CLANG COMPILER_RT DOCS EXTRAS FLANG GOLD LIT LLD LLDB MLIR \
+		OPENMP POLLY PYCLANG STATIC_LIBS
 
 BE_AMDGPU_DESC=		AMD GPU backend (required by mesa)
 BE_FREEBSD_DESC=	Backends for FreeBSD architectures
@@ -198,6 +199,8 @@ PYCLANG_DESC=		Install python bindings to libclang
 PYCLANG_IMPLIES=	CLANG
 PYCLANG_VARS=		_USES_PYTHON=python
 PYCLANG_CMAKE_ON=	-DCLANG_PYTHON_BINDINGS_VERSIONS=${PYTHON_VER}
+POLLY_DESC=		Polyhedral loop and data-locality optimizer
+POLLY_PORTDOCS=		polly
 STATIC_LIBS_DESC=	Install static libraries (does not effect sanitizers)
 
 CONFLICTS_INSTALL=	${PORTNAME}${LLVM_SUFFIX} ${PORTNAME}${LLVM_SUFFIX}-lite
@@ -327,6 +330,12 @@ COMMANDS+=	${OPENMP_COMMANDS}
 .endif
 OPENMP_PATTERN=	${OPENMP_COMMANDS:tW:C/  */|/g}|cmake\/openmp|libarcher|lib[ig]*omp|omp.h|ompt.h|ompt-multiplex.h|omp-tools.h
 
+.if ${PORT_OPTIONS:MPOLLY}
+LLVM_ENABLE_PROJECTS+=	polly
+MAN1SRCS+=	${POLLY_MAN1SRCS}
+.endif
+POLLY_PATTERN=	include\/polly|cmake\/polly|LLVMPolly.so|libPolly
+
 .if ${PORT_OPTIONS:MPYCLANG}
 PYCLANG_PATTERN=	(clang\/(__init__|cindex|enumerations).py)$$
 .endif
@@ -622,6 +631,7 @@ build-plist:
 	    if ($$0 ~ /(argdumper|lldb|six.py)/) {printf "%%%%LLDB%%%%"} \
 	    if ($$0 ~ /(${MLIR_PATTERN})/) {printf "%%%%MLIR%%%%"} \
 	    if ($$0 ~ /(${OPENMP_PATTERN})/) {printf "%%%%OPENMP%%%%"} \
+	    if ($$0 ~ /(${POLLY_PATTERN})/) {printf "%%%%POLLY%%%%"} \
 	    if ($$0 ~ /${PYCLANG_PATTERN}/) {printf "%%%%PYCLANG%%%%"} \
 	    if ($$0 !~ /(lib[a-z]*_rt|LLVMgold)/ && $$0 !~ /(${BE_PATTERN})$$/) {print}}' ${PLIST}.tmp >> ${PLIST}
 	${ECHO_CMD} '@postexec if type ccache-update-links >/dev/null 2>&1; then ccache-update-links -v; fi' >> ${PLIST}
diff --git a/devel/llvm16/Makefile.MAN1SRCS b/devel/llvm16/Makefile.MAN1SRCS
index 59eb5c909711..e6de664e6f15 100644
--- a/devel/llvm16/Makefile.MAN1SRCS
+++ b/devel/llvm16/Makefile.MAN1SRCS
@@ -66,3 +66,6 @@ LIT_MAN1SRCS= \
 
 OPENMP_MAN1SRCS= \
 	llvmopenmp.1
+
+POLLY_MAN1SRCS= \
+	polly.1
diff --git a/devel/llvm16/pkg-plist b/devel/llvm16/pkg-plist
index 2a7e5a21134b..b899a6aab80f 100644
--- a/devel/llvm16/pkg-plist
+++ b/devel/llvm16/pkg-plist
@@ -5201,6 +5201,121 @@ llvm%%LLVM_SUFFIX%%/include/llvm/XRay/YAMLXRayRecord.h
 %%MLIR%%llvm%%LLVM_SUFFIX%%/include/mlir/Transforms/Transforms.capi.cpp.inc
 %%MLIR%%llvm%%LLVM_SUFFIX%%/include/mlir/Transforms/Transforms.capi.h.inc
 %%MLIR%%llvm%%LLVM_SUFFIX%%/include/mlir/Transforms/ViewOpGraph.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Canonicalization.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/BlockGenerators.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/CodeGeneration.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/CodegenCleanup.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/IRBuilder.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/IslAst.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/IslExprBuilder.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/IslNodeBuilder.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/LoopGenerators.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/LoopGeneratorsGOMP.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/LoopGeneratorsKMP.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/PPCGCodeGeneration.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/PerfMonitor.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/RuntimeDebugBuilder.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodeGen/Utils.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/CodePreparation.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Config/config.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/DeLICM.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/DeadCodeElimination.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/DependenceInfo.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/FlattenAlgo.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/FlattenSchedule.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/ForwardOpTree.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/JSONExporter.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/LinkAllPasses.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/ManualOptimizer.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/MatmulOptimizer.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/MaximalStaticExpansion.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Options.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/PolyhedralInfo.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/PruneUnprofitable.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/RegisterPasses.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/ScheduleOptimizer.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/ScheduleTreeTransform.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/ScopBuilder.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/ScopDetection.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/ScopDetectionDiagnostic.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/ScopGraphPrinter.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/ScopInfo.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/ScopPass.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Simplify.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/DumpFunctionPass.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/DumpModulePass.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/GICHelper.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/ISLOStream.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/ISLOperators.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/ISLTools.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/LinkGPURuntime.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/SCEVAffinator.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/SCEVValidator.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/ScopHelper.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/ScopLocation.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/Support/VirtualInstruction.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/ZoneAlgo.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/aff.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/aff_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/arg.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/ast.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/ast_build.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/ast_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/constraint.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/ctx.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/fixed_box.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/flow.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/hash.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/hmap.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/id.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/id_to_ast_expr.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/id_to_id.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/id_to_pw_aff.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/id_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/ilp.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/isl-noexceptions.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/list.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/local_space.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/lp.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/map.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/map_to_basic_set.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/map_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/mat.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/maybe.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/maybe_ast_expr.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/maybe_basic_set.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/maybe_id.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/maybe_pw_aff.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/maybe_templ.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/multi.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/obj.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/options.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/point.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/polynomial.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/polynomial_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/printer.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/printer_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/schedule.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/schedule_node.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/schedule_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/set.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/set_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/space.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/space_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/stdint.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/stream.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/stride_info.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/union_map.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/union_map_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/union_set.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/union_set_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/val.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/val_gmp.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/val_type.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/vec.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/version.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/include/polly/isl/vertices.h
+%%POLLY%%llvm%%LLVM_SUFFIX%%/lib/LLVMPolly.so
 %%CLANG%%llvm%%LLVM_SUFFIX%%/lib/clang/%%LLVM_MAJOR%%/include/__clang_cuda_builtin_vars.h
 %%CLANG%%llvm%%LLVM_SUFFIX%%/lib/clang/%%LLVM_MAJOR%%/include/__clang_cuda_cmath.h
 %%CLANG%%llvm%%LLVM_SUFFIX%%/lib/clang/%%LLVM_MAJOR%%/include/__clang_cuda_complex_builtins.h
@@ -5461,6 +5576,9 @@ llvm%%LLVM_SUFFIX%%/lib/cmake/llvm/llvm-driver-template.cpp.in
 %%MLIR%%llvm%%LLVM_SUFFIX%%/lib/cmake/mlir/MLIRTargets-%%CMAKE_BUILD_TYPE%%.cmake
 %%MLIR%%llvm%%LLVM_SUFFIX%%/lib/cmake/mlir/MLIRTargets.cmake
 %%OPENMP%%llvm%%LLVM_SUFFIX%%/lib/cmake/openmp/FindOpenMPTarget.cmake
+%%POLLY%%llvm%%LLVM_SUFFIX%%/lib/cmake/polly/PollyConfig.cmake
+%%POLLY%%llvm%%LLVM_SUFFIX%%/lib/cmake/polly/PollyConfigVersion.cmake
+%%POLLY%%llvm%%LLVM_SUFFIX%%/lib/cmake/polly/PollyExports-all.cmake
 %%STATIC_LIBS%%%%FLANG%%llvm%%LLVM_SUFFIX%%/lib/libFIRAnalysis.a
 %%STATIC_LIBS%%%%FLANG%%llvm%%LLVM_SUFFIX%%/lib/libFIRBuilder.a
 %%STATIC_LIBS%%%%FLANG%%llvm%%LLVM_SUFFIX%%/lib/libFIRCodeGen.a
@@ -5824,6 +5942,8 @@ llvm%%LLVM_SUFFIX%%/lib/libLTO.so.%%LLVM_MAJOR%%
 %%STATIC_LIBS%%%%MLIR%%llvm%%LLVM_SUFFIX%%/lib/libMLIRX86VectorDialect.a
 %%STATIC_LIBS%%%%MLIR%%llvm%%LLVM_SUFFIX%%/lib/libMLIRX86VectorToLLVMIRTranslation.a
 %%STATIC_LIBS%%%%MLIR%%llvm%%LLVM_SUFFIX%%/lib/libMLIRX86VectorTransforms.a
+%%STATIC_LIBS%%%%POLLY%%llvm%%LLVM_SUFFIX%%/lib/libPolly.a
+%%STATIC_LIBS%%%%POLLY%%llvm%%LLVM_SUFFIX%%/lib/libPollyISL.a
 llvm%%LLVM_SUFFIX%%/lib/libRemarks.so
 llvm%%LLVM_SUFFIX%%/lib/libRemarks.so.%%LLVM_MAJOR%%
 %%OPENMP%%llvm%%LLVM_SUFFIX%%/lib/libarcher.so