aboutsummaryrefslogtreecommitdiff
path: root/polly
AgeCommit message (Collapse)AuthorFilesLines
2022-12-13[NFC] Cleanup: Replace BB->getInstList().erase() with I->eraseFromParent().Vasileios Porpodas1-1/+1
This is part of a series of patches that aim at making BasicBlock::getInstList() private. Differential Revision: https://reviews.llvm.org/D139992
2022-12-11[CMake] Warn when the version is older than 3.20.0.Mark de Wever1-0/+7
This is a preparation to require CMake 3.20.0 after LLVM 16 has been released. This change has been discussed on discourse https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193 Reviewed By: #libc_vendors, MaskRay, ChuanqiXu, to268, thieta, stellaraccident, ldionne, #libc, #libc_abi, phosek Differential Revision: https://reviews.llvm.org/D137724
2022-12-05[Polly] Use std::nullopt to unbreak build.Michael Kruse1-1/+1
2022-12-05[AST] Make AliasSetTracker work on BatchAANikita Popov2-6/+6
D138014 restricted AST to work on immutable IR. This means it is also safe to use a single BatchAA instance for the entire AST lifetime, instead of only batching parts of individual queries. The primary motivation for this is not compile-time, but rather having a central place to control cross-iteration AA, which will be used by D137958. Differential Revision: https://reviews.llvm.org/D137955
2022-12-05Remove unused #include "llvm/ADT/Optional.h"Fangrui Song1-1/+0
2022-12-03[polly] Use std::nullopt instead of None (NFC)Kazu Hirata2-6/+6
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-11-25Add version to all LLVM cmake packageThomas Preud'homme3-1/+24
Add a version to non-LLVM cmake package so that users needing an exact version match can use the version parameter to find_package. Also adjust the find_package(LLVM) to use an exact version match as well. Reviewed By: arsenm, stellaraccident, mceier Differential Revision: https://reviews.llvm.org/D138274
2022-11-25Revert: Add version to all LLVM cmake packageThomas Preud'homme3-24/+1
Summary: This reverts commit ad485b71b51168ce13282ae159bd8feff48baf84. Reviewers: Subscribers:
2022-11-21[llvm,polly,clang] Stop setting config.enable_shared in most placesNico Weber1-1/+0
Clang's lit.cfg.py reads this to add an "enable-shared" feature that three of clang's lit tests use. Nothing else reads enable_shared, so remove it from most lit.site.cfg.py.in files. Differential Revision: https://reviews.llvm.org/D138301
2022-11-20Add version to all LLVM cmake packageThomas Preud'homme3-1/+24
Add a version to non-LLVM cmake package so that users needing an exact version match can use the version parameter to find_package. Also adjust the find_package(LLVM) to use an exact version match as well. Reviewed By: arsenm, stellaraccident Differential Revision: https://reviews.llvm.org/D138274
2022-11-10[clang] Only use major version in resource dirTimm Bäder1-1/+1
This causes unnecessary churn for downstreams. For the full discussion, see https://discourse.llvm.org/t/should-we-continue-embed-the-full-llvm-version-in-lib-clang/62094 Differential Revision: https://reviews.llvm.org/D125860
2022-11-09Move googletest to the third-party directoryTom Stellard1-2/+2
Rre-commit of 59052468c3e38cab15582cefbb5133fd4c2ffce5 with a typo fix in compiler-rt/CMakeLists.txt
2022-11-09Revert "Move googletest to the third-party directory"Tom Stellard1-2/+2
This reverts commit 59052468c3e38cab15582cefbb5133fd4c2ffce5. It looks like this patch breaks the build when compiler-rt is passed to LLVM_ENABLE_PROJECTS instead of LLVM_ENABLE_RUNTIMES.
2022-11-09Move googletest to the third-party directoryTom Stellard1-2/+2
This will help improve the project's layering, so that sub-projects that don't actually need any llvm code can still use googletest without having to reference code in the llvm directory. This will also make it easier to consolidate and simplify the standalone build configurations. Reviewed By: stellaraccident, lattner, probinson, phosek Differential Revision: https://reviews.llvm.org/D131919
2022-11-08[CMake] Fix -Wstrict-prototypesSam James1-12/+12
Fixes warnings (or errors, if someone injects -Werror in their build system, which happens in fact with some folks vendoring LLVM too) with Clang 16: ``` +/var/tmp/portage.notmp/portage/sys-devel/llvm-15.0.4/work/llvm_build-abi_x86_64.amd64/CMakeFiles/CMakeTmp/src.c:3:9: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -/var/tmp/portage.notmp/portage/sys-devel/llvm-14.0.4/work/llvm_build-abi_x86_64.amd64/CMakeFiles/CMakeTmp/src.c:3:9: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] int main() {return 0;} ^ void ``` Differential Revision: https://reviews.llvm.org/D137503
2022-10-28[polly][test] Remove -polly-target from testsArthur Eubanks4-4/+4
This flag was removed in D136621.
2022-10-28[polly] Format RegisterPasses.cppArthur Eubanks1-8/+4
2022-10-28[polly] Remove legacy pass manager hooksArthur Eubanks4-309/+67
And some options that only throw errors with the new PM. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D136621
2022-10-26[Polly] Add support for -polly-enable-mse with NPM.Michael Kruse1-2/+1
The MaximalStaticExpansionPass was already ported to the NPM in 02f640672e2875c4e7578366bb2e22582548d7c1. Allow adding it to the default NPM pass builder pipeline using -polly-enable-mse.
2022-10-26[Polly] Add support for -polly-export with NPM.Michael Kruse2-2/+61
The JSONExporter pass was already ported to the NPM, the pass builder jsut had to add it to the pass pipeline when requested.
2022-10-24[Polly][docs] Avoid use of code-block:: guess.Michael Kruse1-8/+8
The 'guess' language triggers a warning in the polly-sphinx-docs: https://lab.llvm.org/staging/#/builders/199/builds/209 which is treated as an error by default. This might be related to the Sphinx bug https://github.com/sphinx-doc/sphinx/issues/7139
2022-10-20[Polly] Ensure -polly-detect-keep-going still eventually rejects invalid ↵Michael Kruse6-66/+100
regions. Fixes #58484
2022-10-19[AA] Rename getModRefBehavior() to getMemoryEffects() (NFC)Nikita Popov2-2/+2
Follow up on D135962, renaming the method name to match the new type name.
2022-10-19[AA] Rename uses of FunctionModRefBehavior (NFC)Nikita Popov2-8/+8
Followup to D135962 to rename remaining uses of FunctionModRefBehavior to MemoryEffects. Does not touch API names yet, but also updates variables names FMRB/MRB to ME, to match the new type name.
2022-09-14[CMake] Avoid `LLVM_BINARY_DIR` when other more specific variable are ↵John Ericson2-2/+2
better-suited, part 2 A simple sed doing these substitutions: - `${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}\>` -> `${LLVM_LIBRARY_DIR}` - `${LLVM_BINARY_DIR}/bin\>` -> `${LLVM_TOOLS_BINARY_DIR}` where `\>` means "word boundary". The only manual modifications were reverting changes in - `runtimes/CMakeLists.txt` because these were "entry points" where we wanted to tread carefully not not introduce a "loop" which would end with an undefined variable being expanded to nothing. There are some `${LLVM_BINARY_DIR}/lib` without the `${LLVM_LIBDIR_SUFFIX}`, but these refer to the lib subdirectory of the source (`llvm/lib`). That `lib` is automatically appended to make the local `CMAKE_CURRENT_BINARY_DIR` value by `add_subdirectory`; since the directory name in the source tree is fixed without any suffix, the corresponding `CMAKE_CURRENT_BINARY_DIR` will also be. We therefore do not replace it but leave it as-is. This picks up where D133828 left off, getting the occurrences with*out* `CMAKE_CFG_INTDIR`. But this is difficult to do correctly and so not done in the (retroactively) previous diff. This hopefully increases readability overall, and also decreases the usages of `LLVM_LIBDIR_SUFFIX`, preparing us for D130586. Reviewed By: sebastian-ne Differential Revision: https://reviews.llvm.org/D132316
2022-09-14[AA] Tracking per-location ModRef info in FunctionModRefBehavior (NFCI)Nikita Popov2-47/+25
Currently, FunctionModRefBehavior tracks whether the function reads or writes memory (ModRefInfo) and which locations it can access (argmem, inaccessiblemem and other). This patch changes it to track ModRef information per-location instead. To give two examples of why this is useful: * D117095 highlights a weakness of ModRef modelling in the presence of operand bundles. For a memcpy call with deopt operand bundle, we want to say that it can read any memory, but only write argument memory. This would allow them to be treated like any other calls. However, we currently can't express this and have to say that it can read or write any memory. * D127383 would ideally be modelled as a separate threadid location, where threadid Refs outside pre-split coroutines can be ignored (like other accesses to constant memory). The current representation does not allow modelling this precisely. The patch as implemented is intended to be NFC, but there are some obvious opportunities for improvements and simplification. To fully capitalize on this we would also want to change the way we represent memory attributes on functions, but that's a larger change, and I think it makes sense to separate out the FunctionModRefBehavior refactoring. Differential Revision: https://reviews.llvm.org/D130896
2022-08-28Use std::gcd (NFC)Kazu Hirata1-1/+2
To avoid changing semantics inadvertently, this patch casts arguments to uint64_t before calling std::gcd.
2022-08-25Revert "[CMake] Avoid `LLVM_BINARY_DIR` when other more specific variable ↵John Ericson2-2/+2
are better-suited" This reverts commit ad8c34bc3089d847a09bb740f7a58c96073e0959.
2022-08-24Exclude check-polly-unittests and check-polly-isl from check-allEli Friedman1-0/+2
The unittests are already included in check-polly, so check-all was running them twice. Running them twice causes a race on the output files, which led to intermittent failures on the reverse-iteration buildbot.
2022-08-24[CMake] Avoid `LLVM_BINARY_DIR` when other more specific variable are ↵John Ericson2-2/+2
better-suited A simple sed doing these substitutions: - `${LLVM_BINARY_DIR}/(\$\{CMAKE_CFG_INTDIR}/)?lib(${LLVM_LIBDIR_SUFFIX})?\>` -> `${LLVM_LIBRARY_DIR}` - `${LLVM_BINARY_DIR}/(\$\{CMAKE_CFG_INTDIR}/)?bin\>` -> `${LLVM_TOOLS_BINARY_DIR}` where `\>` means "word boundary". The only manual modifications were reverting changes in - `compiler-rt/cmake/Modules/CompilerRTUtils.cmake - `runtimes/CMakeLists.txt` because these were "entry points" where we wanted to tread carefully not not introduce a "loop" which would end with an undefined variable being expanded to nothing. This hopefully increases readability overall, and also decreases the usages of `LLVM_LIBDIR_SUFFIX`, preparing us for D130586. Reviewed By: sebastian-ne Differential Revision: https://reviews.llvm.org/D132316
2022-08-23[Polly] Don't use `llvm-config` anymore (in CMake sad path)John Ericson1-6/+3
If `LLVM_BUILD_MAIN_SRC_DIR` is not defined, just assume we are in regular monorepo layout. Non-standard (and not really supported) layouts can still be configured manually. Reviewed By: beanz Differential Revision: https://reviews.llvm.org/D132314
2022-08-18Revert "[cmake] Use `CMAKE_INSTALL_LIBDIR` too"John Ericson3-6/+6
This reverts commit f7a33090a91015836497c75f173775392ab0304d. Unfortunately this causes a number of failures that didn't show up in my local build.
2022-08-18[cmake] Use `CMAKE_INSTALL_LIBDIR` tooJohn Ericson3-6/+6
We held off on this before as `LLVM_LIBDIR_SUFFIX` conflicted with it. Now we return this. `LLVM_LIBDIR_SUFFIX` is kept as a deprecated way to set `CMAKE_INSTALL_LIBDIR`. The other `*_LIBDIR_SUFFIX` are just removed entirely. I imagine this is too potentially-breaking to make LLVM 15. That's fine. I have a more minimal version of this in the disto (NixOS) patches for LLVM 15 (like previous versions). This more expansive version I will test harder after the release is cut. Reviewed By: sebastian-ne, ldionne, #libc, #libc_abi Differential Revision: https://reviews.llvm.org/D130586
2022-08-17[test] Propagate HWASAN_OPTIONSVitaly Buka1-0/+2
2022-08-14[Polly] Remove the test case that depends on InstCombine and DeLICM.Roman Gareev1-79/+0
2022-08-09LLVM_FALLTHROUGH => [[fallthrough]]. NFCFangrui Song4-7/+7
2022-08-07[polly] Fixed a number of typos. NFCGabriel Ravier27-33/+33
I went over the output of the following mess of a command: `(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)` and proceeded to spend a few days looking at it to find probable typos and fixed a few hundred of them in all of the llvm project (note, the ones I found are not anywhere near all of them, but it seems like a good start). Reviewed By: inclyc Differential Revision: https://reviews.llvm.org/D131167
2022-08-07[Polly] Suppress the LLVM-IR output for pattern matching tests, if there is ↵Roman Gareev4-5/+5
no FileCheck-ing for it.
2022-08-07[Polly] Generalize the pattern matching to the case of tensor contractionsRoman Gareev21-21/+1734
The pattern matching optimization of Polly detects and optimizes dense general matrix-matrix multiplication. The generated code is close to high performance implementations of matrix-matrix multiplications, which are contained in manually tuned libraries. The described pattern matching optimization is a particular case of tensor contraction optimization, which was introduced in [1]. This patch generalizes the pattern matching to the case of tensor contractions using the form of data dependencies and memory accesses produced by tensor contractions [1]. Optimization of tensor contractions will be added in the next patch. Following the ideas introduced in [2], it will logically represent tensor contraction operands as matrix multiplication operands and use an approach for optimization of matrix-matrix multiplications. [1] - Gareev R., Grosser T., Kruse M. High-Performance Generalized Tensor Op­erations: A Compiler-Oriented Approach // ACM Transactions on Architec­ture and Code Optimization (TACO). 2018. Vol. 15, no. 3. P. 34:1–34:27. DOI: 10.1145/3235029. [2] - Matthews D. High-Performance Tensor Contraction without BLAS // SIAM Journal on Scientific Computing. 2018. Vol. 40, no. 1. P. C 1—C 24. DOI: 110.1137/16m108968x. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D114336
2022-07-26[Polly] Insert !dbg metadata for emitted CallInsts.Michael Kruse5-15/+220
The IR Verifier requires that every call instruction to an inlineable function (among other things, its implementation must be visible in the translation unit) must also have !dbg metadata attached to it. When parallelizing, Polly emits calls to OpenMP runtime function out of thin air, or at least not directly derived from a bounded list of previous instruction. While we could search for instructions in the SCoP that has some debug info attached to it, there is no guarantee that we find any. Our solution is to generate a new DILocation that points to line 0 to represent optimized code. The OpenMP function implementation is usually not available in the user's translation unit, but can become visible in an LTO build. For the bug to appear, libomp must also be built with debug symbols. IMHO, the IR verifier rule is too strict. Runtime functions can also be inserted by other optimization passes, such as LoopIdiomRecognize. When inserting a call to e.g. memset, it uses the DebugLoc from a StoreInst from the unoptimized code. It is not required to have !dbg metadata attached either. Fixes #56692
2022-07-25Remove redundaunt virtual specifiers (NFC)Kazu Hirata10-27/+26
Identified with tidy-modernize-use-override.
2022-07-25[cmake] Support custom package install pathsJohn Ericson1-8/+15
Firstly, we we make an additional GNUInstallDirs-style variable. With NixOS, for example, this is crucial as we want those to go in `${dev}/lib/cmake` not `${out}/lib/cmake` as that would a cmake subdir of the "regular" libdir, which is installed even when no one needs to do any development. Secondly, we make *Config.cmake robust to absolute package install paths. We for NixOS will in fact be passing them absolute paths to make the `${dev}` vs `${out}` distinction mentioned above, and the GNUInstallDirs-style variables are suposed to support absolute paths in general so it's good practice besides the NixOS use-case. Thirdly, we make `${project}_INSTALL_PACKAGE_DIR` CACHE PATHs like other install dirs are. Reviewed By: sebastian-ne Differential Revision: https://reviews.llvm.org/D117973
2022-07-22Use any_of (NFC)Kazu Hirata1-2/+1
2022-07-20Use llvm::is_contained (NFC)Kazu Hirata1-2/+1
2022-07-15Use value instead of getValue (NFC)Kazu Hirata3-13/+13
2022-07-15[IR] Don't use blockaddresses as callbr argumentsNikita Popov1-1/+1
Following some recent discussions, this changes the representation of callbrs in IR. The current blockaddress arguments are replaced with `!` label constraints that refer directly to callbr indirect destinations: ; Before: %res = callbr i8* asm "", "=r,r,i"(i8* %x, i8* blockaddress(@test8, %foo)) to label %asm.fallthrough [label %foo] ; After: %res = callbr i8* asm "", "=r,r,!i"(i8* %x) to label %asm.fallthrough [label %foo] The benefit of this is that we can easily update the successors of a callbr, without having to worry about also updating blockaddress references. This should allow us to remove some limitations: * Allow unrolling/peeling/rotation of callbr, or any other clone-based optimizations (https://github.com/llvm/llvm-project/issues/41834) * Allow duplicate successors (https://github.com/llvm/llvm-project/issues/45248) This is just the IR representation change though, I will follow up with patches to remove limtations in various transformation passes that are no longer needed. Differential Revision: https://reviews.llvm.org/D129288
2022-07-13Use has_value instead of hasValue (NFC)Kazu Hirata1-1/+1
2022-06-29[Polly][MatMul] Abandon dependence analysis.Michael Kruse6-49/+63
The copy statements inserted by the matrix-multiplication optimization introduce new dependencies between the copy statements and other statements. As a result, the DependenceInfo must be recomputed. Not recomputing them caused IslAstInfo to deduce that some loops are parallel but cause race conditions when accessing the packed arrays. As a result, matrix-matrix multiplication currently cannot be parallelized. Also see discussion at https://reviews.llvm.org/D125202
2022-06-26Don't use Optional::hasValue (NFC)Kazu Hirata2-5/+5
This patch replaces x.hasValue() with x where x is contextually convertible to bool.
2022-06-25Revert "Don't use Optional::hasValue (NFC)"Kazu Hirata3-21/+22
This reverts commit aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.