Polly is LLVM's polyhedral optimizer for loops and data locality similar to Graphite for GCC. Please enable this functionality or at least add it as an option for the port. It's been a part of the LLVM code base for several years, so I'm surprised it hasn't been added yet.
I'll add it in the near future. I'll start with llvm-devel and aim to get llvm16 done before I make llvm17 from it at the end of the month.
A commit in branch main references this bug: 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(-)
Am I understand it correctly that this only enables support for Polly inside LLVM, but it doesn't enable it in the default compiler pipeline?
My understanding from polly.llvm.org is that it's now available to the compiler, but you need to add "-mllvm -polly" to enable it in a given compilation.
A commit in branch main references this bug: 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(-)
Done in llvm16 and llvm17 and in the latest quarterly. I don't see a lot of point in going further back, but could do so if it was useful.