git: 2eae0958d553 - main - devel/llvm-devel: enable polyhedral optimizations

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Tue, 11 Jul 2023 23:12:44 UTC
The branch main has been updated by brooks:

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

commit 2eae0958d55329a790b2f964e4d5d0bc619a8c7d
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-07-11 23:11:39 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-07-11 23:11:39 +0000

    devel/llvm-devel: enable polyhedral optimizations
    
    The POLLY option enables the Polly optimizer.  It is enabled by default.
    
    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/llvm-devel/Makefile          |  20 +++++--
 devel/llvm-devel/Makefile.MAN1SRCS |   3 +
 devel/llvm-devel/pkg-plist         | 118 +++++++++++++++++++++++++++++++++++++
 3 files changed, 135 insertions(+), 6 deletions(-)

diff --git a/devel/llvm-devel/Makefile b/devel/llvm-devel/Makefile
index 242e30817517..c3614ba5f7f8 100644
--- a/devel/llvm-devel/Makefile
+++ b/devel/llvm-devel/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	llvm
 PORTVERSION=	${LLVM_MAJOR}.0.d${SNAPDATE}
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	devel lang
 PKGNAMESUFFIX=	${LLVM_SUFFIX}
 
@@ -90,13 +90,14 @@ OPTIONS_EXCLUDE_armv6=	COMPILER_RT
 OPTIONS_EXCLUDE_armv7=	COMPILER_RT
 OPTIONS_SUB=	yes
 .if !${FLAVOR:Mlite}
-OPTIONS_DEFINE+=	EXTRAS FLANG LIT LLDB MLIR OPENMP
+OPTIONS_DEFINE+=	EXTRAS FLANG LIT LLDB MLIR OPENMP POLLY
 OPTIONS_DEFINE_amd64=	GOLD
 OPTIONS_DEFINE_powerpc=	GOLD
 OPTIONS_DEFINE_powerpc64=	GOLD
 OPTIONS_DEFINE_powerpc64le=	GOLD
 
-OPTIONS_DEFAULT+=	COMPILER_RT EXTRAS FLANG LIT LLDB MLIR OPENMP STATIC_LIBS
+OPTIONS_DEFAULT+=	COMPILER_RT EXTRAS FLANG LIT LLDB MLIR OPENMP POLLY \
+			STATIC_LIBS
 OPTIONS_DEFAULT_amd64=	GOLD
 OPTIONS_DEFAULT_powerpc=	GOLD
 OPTIONS_DEFAULT_powerpc64=	GOLD
@@ -113,7 +114,7 @@ OPTIONS_EXCLUDE_FreeBSD_12=	OPENMP
 .endif
 
 _ALL_OPTIONS=	CLANG COMPILER_RT DOCS EXTRAS FLANG GOLD LIT LLD LLDB MLIR \
-		OPENMP STATIC_LIBS
+		OPENMP POLLY STATIC_LIBS
 
 CLANG_DESC=	Build clang
 CLANG_CMAKE_ON=		-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp
@@ -168,8 +169,8 @@ MLIR_DESC=		Multi-Level Intermediate Representation
 OPENMP_DESC=		Install libomp, the LLVM OpenMP runtime library
 OPENMP_CMAKE_ON=	-DLIBOMPTARGET_BUILD_DEVICERTL_BCLIB=OFF
 OPENMP_PORTDOCS=	openmp
-STATIC_LIBS_DESC=	Install static libraries (does not effect sanitizers)
-
+POLLY_DESC=		Polyhedral loop and data-locality optimizer
+POLLY_PORTDOCS=	polly
 CONFLICTS_INSTALL=	${PORTNAME}${LLVM_SUFFIX} ${PORTNAME}${LLVM_SUFFIX}-lite
 
 PLIST_SUB+=	LLVM_MAJOR=${LLVM_MAJOR} \
@@ -291,6 +292,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 defined(LLVM_ENABLE_PROJECTS)
 CMAKE_ARGS+=	-DLLVM_ENABLE_PROJECTS="${LLVM_ENABLE_PROJECTS:ts;}"
 .endif
@@ -512,6 +519,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 !~ /(lib[a-z]*_rt|LLVMgold)/) {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/llvm-devel/Makefile.MAN1SRCS b/devel/llvm-devel/Makefile.MAN1SRCS
index 68640672ebbd..ba623f229a00 100644
--- a/devel/llvm-devel/Makefile.MAN1SRCS
+++ b/devel/llvm-devel/Makefile.MAN1SRCS
@@ -68,3 +68,6 @@ LIT_MAN1SRCS= \
 
 OPENMP_MAN1SRCS= \
 	llvmopenmp.1
+
+POLLY_MAN1SRCS= \
+	polly.1
diff --git a/devel/llvm-devel/pkg-plist b/devel/llvm-devel/pkg-plist
index f12cb5ca495b..463a4033c1ac 100644
--- a/devel/llvm-devel/pkg-plist
+++ b/devel/llvm-devel/pkg-plist
@@ -5437,6 +5437,119 @@ llvm-devel/include/llvm/XRay/YAMLXRayRecord.h
 %%MLIR%%llvm-devel/include/mlir/Transforms/Transforms.capi.cpp.inc
 %%MLIR%%llvm-devel/include/mlir/Transforms/Transforms.capi.h.inc
 %%MLIR%%llvm-devel/include/mlir/Transforms/ViewOpGraph.h
+%%POLLY%%llvm-devel/include/polly/Canonicalization.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/BlockGenerators.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/CodeGeneration.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/CodegenCleanup.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/IRBuilder.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/IslAst.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/IslExprBuilder.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/IslNodeBuilder.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/LoopGenerators.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/LoopGeneratorsGOMP.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/LoopGeneratorsKMP.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/PerfMonitor.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/RuntimeDebugBuilder.h
+%%POLLY%%llvm-devel/include/polly/CodeGen/Utils.h
+%%POLLY%%llvm-devel/include/polly/CodePreparation.h
+%%POLLY%%llvm-devel/include/polly/Config/config.h
+%%POLLY%%llvm-devel/include/polly/DeLICM.h
+%%POLLY%%llvm-devel/include/polly/DeadCodeElimination.h
+%%POLLY%%llvm-devel/include/polly/DependenceInfo.h
+%%POLLY%%llvm-devel/include/polly/FlattenAlgo.h
+%%POLLY%%llvm-devel/include/polly/FlattenSchedule.h
+%%POLLY%%llvm-devel/include/polly/ForwardOpTree.h
+%%POLLY%%llvm-devel/include/polly/JSONExporter.h
+%%POLLY%%llvm-devel/include/polly/LinkAllPasses.h
+%%POLLY%%llvm-devel/include/polly/ManualOptimizer.h
+%%POLLY%%llvm-devel/include/polly/MatmulOptimizer.h
+%%POLLY%%llvm-devel/include/polly/MaximalStaticExpansion.h
+%%POLLY%%llvm-devel/include/polly/Options.h
+%%POLLY%%llvm-devel/include/polly/PolyhedralInfo.h
+%%POLLY%%llvm-devel/include/polly/PruneUnprofitable.h
+%%POLLY%%llvm-devel/include/polly/RegisterPasses.h
+%%POLLY%%llvm-devel/include/polly/ScheduleOptimizer.h
+%%POLLY%%llvm-devel/include/polly/ScheduleTreeTransform.h
+%%POLLY%%llvm-devel/include/polly/ScopBuilder.h
+%%POLLY%%llvm-devel/include/polly/ScopDetection.h
+%%POLLY%%llvm-devel/include/polly/ScopDetectionDiagnostic.h
+%%POLLY%%llvm-devel/include/polly/ScopGraphPrinter.h
+%%POLLY%%llvm-devel/include/polly/ScopInfo.h
+%%POLLY%%llvm-devel/include/polly/ScopPass.h
+%%POLLY%%llvm-devel/include/polly/Simplify.h
+%%POLLY%%llvm-devel/include/polly/Support/DumpFunctionPass.h
+%%POLLY%%llvm-devel/include/polly/Support/DumpModulePass.h
+%%POLLY%%llvm-devel/include/polly/Support/GICHelper.h
+%%POLLY%%llvm-devel/include/polly/Support/ISLOStream.h
+%%POLLY%%llvm-devel/include/polly/Support/ISLOperators.h
+%%POLLY%%llvm-devel/include/polly/Support/ISLTools.h
+%%POLLY%%llvm-devel/include/polly/Support/SCEVAffinator.h
+%%POLLY%%llvm-devel/include/polly/Support/SCEVValidator.h
+%%POLLY%%llvm-devel/include/polly/Support/ScopHelper.h
+%%POLLY%%llvm-devel/include/polly/Support/ScopLocation.h
+%%POLLY%%llvm-devel/include/polly/Support/VirtualInstruction.h
+%%POLLY%%llvm-devel/include/polly/ZoneAlgo.h
+%%POLLY%%llvm-devel/include/polly/isl/aff.h
+%%POLLY%%llvm-devel/include/polly/isl/aff_type.h
+%%POLLY%%llvm-devel/include/polly/isl/arg.h
+%%POLLY%%llvm-devel/include/polly/isl/ast.h
+%%POLLY%%llvm-devel/include/polly/isl/ast_build.h
+%%POLLY%%llvm-devel/include/polly/isl/ast_type.h
+%%POLLY%%llvm-devel/include/polly/isl/constraint.h
+%%POLLY%%llvm-devel/include/polly/isl/ctx.h
+%%POLLY%%llvm-devel/include/polly/isl/fixed_box.h
+%%POLLY%%llvm-devel/include/polly/isl/flow.h
+%%POLLY%%llvm-devel/include/polly/isl/hash.h
+%%POLLY%%llvm-devel/include/polly/isl/hmap.h
+%%POLLY%%llvm-devel/include/polly/isl/id.h
+%%POLLY%%llvm-devel/include/polly/isl/id_to_ast_expr.h
+%%POLLY%%llvm-devel/include/polly/isl/id_to_id.h
+%%POLLY%%llvm-devel/include/polly/isl/id_to_pw_aff.h
+%%POLLY%%llvm-devel/include/polly/isl/id_type.h
+%%POLLY%%llvm-devel/include/polly/isl/ilp.h
+%%POLLY%%llvm-devel/include/polly/isl/isl-noexceptions.h
+%%POLLY%%llvm-devel/include/polly/isl/list.h
+%%POLLY%%llvm-devel/include/polly/isl/local_space.h
+%%POLLY%%llvm-devel/include/polly/isl/lp.h
+%%POLLY%%llvm-devel/include/polly/isl/map.h
+%%POLLY%%llvm-devel/include/polly/isl/map_to_basic_set.h
+%%POLLY%%llvm-devel/include/polly/isl/map_type.h
+%%POLLY%%llvm-devel/include/polly/isl/mat.h
+%%POLLY%%llvm-devel/include/polly/isl/maybe.h
+%%POLLY%%llvm-devel/include/polly/isl/maybe_ast_expr.h
+%%POLLY%%llvm-devel/include/polly/isl/maybe_basic_set.h
+%%POLLY%%llvm-devel/include/polly/isl/maybe_id.h
+%%POLLY%%llvm-devel/include/polly/isl/maybe_pw_aff.h
+%%POLLY%%llvm-devel/include/polly/isl/maybe_templ.h
+%%POLLY%%llvm-devel/include/polly/isl/multi.h
+%%POLLY%%llvm-devel/include/polly/isl/obj.h
+%%POLLY%%llvm-devel/include/polly/isl/options.h
+%%POLLY%%llvm-devel/include/polly/isl/point.h
+%%POLLY%%llvm-devel/include/polly/isl/polynomial.h
+%%POLLY%%llvm-devel/include/polly/isl/polynomial_type.h
+%%POLLY%%llvm-devel/include/polly/isl/printer.h
+%%POLLY%%llvm-devel/include/polly/isl/printer_type.h
+%%POLLY%%llvm-devel/include/polly/isl/schedule.h
+%%POLLY%%llvm-devel/include/polly/isl/schedule_node.h
+%%POLLY%%llvm-devel/include/polly/isl/schedule_type.h
+%%POLLY%%llvm-devel/include/polly/isl/set.h
+%%POLLY%%llvm-devel/include/polly/isl/set_type.h
+%%POLLY%%llvm-devel/include/polly/isl/space.h
+%%POLLY%%llvm-devel/include/polly/isl/space_type.h
+%%POLLY%%llvm-devel/include/polly/isl/stdint.h
+%%POLLY%%llvm-devel/include/polly/isl/stream.h
+%%POLLY%%llvm-devel/include/polly/isl/stride_info.h
+%%POLLY%%llvm-devel/include/polly/isl/union_map.h
+%%POLLY%%llvm-devel/include/polly/isl/union_map_type.h
+%%POLLY%%llvm-devel/include/polly/isl/union_set.h
+%%POLLY%%llvm-devel/include/polly/isl/union_set_type.h
+%%POLLY%%llvm-devel/include/polly/isl/val.h
+%%POLLY%%llvm-devel/include/polly/isl/val_gmp.h
+%%POLLY%%llvm-devel/include/polly/isl/val_type.h
+%%POLLY%%llvm-devel/include/polly/isl/vec.h
+%%POLLY%%llvm-devel/include/polly/isl/version.h
+%%POLLY%%llvm-devel/include/polly/isl/vertices.h
+%%POLLY%%llvm-devel/lib/LLVMPolly.so
 %%CLANG%%llvm-devel/lib/clang/%%LLVM_MAJOR%%/include/__clang_cuda_builtin_vars.h
 %%CLANG%%llvm-devel/lib/clang/%%LLVM_MAJOR%%/include/__clang_cuda_cmath.h
 %%CLANG%%llvm-devel/lib/clang/%%LLVM_MAJOR%%/include/__clang_cuda_complex_builtins.h
@@ -5715,6 +5828,9 @@ llvm-devel/lib/cmake/llvm/llvm-driver-template.cpp.in
 %%MLIR%%llvm-devel/lib/cmake/mlir/MLIRTargets-%%CMAKE_BUILD_TYPE%%.cmake
 %%MLIR%%llvm-devel/lib/cmake/mlir/MLIRTargets.cmake
 %%OPENMP%%llvm-devel/lib/cmake/openmp/FindOpenMPTarget.cmake
+%%POLLY%%llvm-devel/lib/cmake/polly/PollyConfig.cmake
+%%POLLY%%llvm-devel/lib/cmake/polly/PollyConfigVersion.cmake
+%%POLLY%%llvm-devel/lib/cmake/polly/PollyExports-all.cmake
 %%STATIC_LIBS%%%%FLANG%%llvm-devel/lib/libFIRAnalysis.a
 %%STATIC_LIBS%%%%FLANG%%llvm-devel/lib/libFIRBuilder.a
 %%STATIC_LIBS%%%%FLANG%%llvm-devel/lib/libFIRCodeGen.a
@@ -6206,6 +6322,8 @@ llvm-devel/lib/libLTO.so.%%LLVM_MAJOR%%git
 %%STATIC_LIBS%%%%MLIR%%llvm-devel/lib/libMLIRX86VectorDialect.a
 %%STATIC_LIBS%%%%MLIR%%llvm-devel/lib/libMLIRX86VectorToLLVMIRTranslation.a
 %%STATIC_LIBS%%%%MLIR%%llvm-devel/lib/libMLIRX86VectorTransforms.a
+%%STATIC_LIBS%%%%POLLY%%llvm-devel/lib/libPolly.a
+%%STATIC_LIBS%%%%POLLY%%llvm-devel/lib/libPollyISL.a
 llvm-devel/lib/libRemarks.so
 llvm-devel/lib/libRemarks.so.%%LLVM_MAJOR%%git
 %%OPENMP%%llvm-devel/lib/libarcher.so