aboutsummaryrefslogtreecommitdiff
path: root/polly/test/CodeGen
AgeCommit message (Collapse)AuthorFilesLines
2026-04-20[Polly] Apply gist only after converting to pw_aff (#192975)Michael Kruse1-0/+28
A single-valued set/map is not necessarily single-valued anymore after applying after gisting a context. In particular, the set/map might not be single-valued outside the context. Convert the result of MemoryAccess::getAddressFunction() directly to pw_aff. Since it is the result of lexmin(), it is single-valued by definition. Gist the context only after te conversion. We should consider using `isl_basic_map_partial_lexmin_pw_multi_aff` in `getAddressFunction()` directly to avoid the intermediate step. Fixes #190459
2026-04-06[Polly] Correct integer comparison bit width (#190493)Michael Kruse1-0/+27
For making an integer compareable to bool, don't compare it to bool. Bug occured during the reduction of #190459
2026-04-04[SCEV] Move NoWrapFlags definition outside SCEV scope, use for SCEVUse. ↵Florian Hahn1-2/+1
(#190199) The patch moves out of SCEV's scope so they can be re-used for SCEVUse. SCEVUse gets an additional getNoWrapFlags helper that returns the union of the expressions SCEV flags and the use-specific flags. SCEVExpander has been updated to use this new helper. In order to avoid other changes, the original names are exposed via constexpr in SCEV. Not sure if there's a nicer way. One alternative would be to define the enum in struct, and have SCEV inherit from it. The patch also clarifies that the SCEVUse flags encode NUW/NSW, and hides getInt, setInt, etc to avoid potential mis-use. PR: https://github.com/llvm/llvm-project/pull/190199
2026-04-02[Polly] Print params with stmt tracing (#189362)Michael Kruse1-5/+15
It was helpful for #189350.
2026-03-28[Polly] Forward VFS from PassBuilder for IO sandboxing (#188657)Michael Kruse1-23/+0
#184545 default-enables the IO sandbox in assert-builds. This causes Clang using Polly to crash (#188568). The issue is that `PassBuilder` uses `vfs::getRealFileSystem()` by default which is considered a IO sandbox violation in the Clang process. With this PR store the VFS from the `PassBuilder` from the original `registerPollyPasses` call for creating other `PassBuilder` instances. This PR also adds infrastructure for running Polly in `clang` (in addition in `opt`). `opt` does not enable the sandbox such that we need separate tests using Clang. Closes: #188568
2026-03-12[Polly] Use GenDT in assertion (#186164)Michael Kruse1-0/+28
`DT` is always the analysis for the to-be-optimized function while `GenDT` is the analysis of the function that we currently generate code for, which can also be an outlined function. Here, we want to check dominance in the generated code, hence we must use `GenDT`. #179433 already fixed the same issue for `BlockGenerator`. The same pattern is used in `RegionGenerator` which is fixed here. A good argument to avoid code duplication. Fixes: #185313 Thanks to @jaschiu for the bug report and reproducer
2026-02-08[Polly] Update isl to isl-0.27-78-gfc484e00 (#180377)Michael Kruse1-86/+0
Update isl to include https://repo.or.cz/isl.git/commit/fc484e004200964f8f18249de1f510393ec924a9 which fixes #180000. The isl update also fixes #34710 which had the same cause but with an empty access domain (#180000 has an empty statement domain). Thus we also revert 163cacb46960be4dd0d8562737bbf0ea97cb14ad which now only adds unnecessary overhead. A regression test has been added to isl which is why we do not add a test in Polly. Fixes: #180000 Thanks @skimo-openhub for the fix and @thapgua for the bugreport.
2026-02-03[Polly] Use GenDT in assertion (#179433)Michael Kruse1-0/+32
`DT` is always the analysis for the to-be-optimized function while `GenDT` is the analysis of the function that we currently generate code for which can also be an outlined function. Here, we want to check dominance in the generated code, hence we must use `GenDT`. Fixes: #179135
2026-01-24[Polly] Avoid dependence on x86 backendMichael Kruse1-57/+32
Unbreak the polly-arm-linux buildbot.
2026-01-24[Polly] Update isl to isl-0.27 (#177776)Michael Kruse1-5/+62
Fixes: #177527 Updated test cases: * CodeGen/OpenMP/matmul-parallel.ll, ScheduleOptimizer/pattern-matching-based-opts.ll Before the update, ISL bailed out the dependency computation due to hitting the max operation limit. The commit https://repo.or.cz/isl.git/commit/4bdfe2567715c5d1a8287c07d8685eb3db281e32 seems to have reduced the complexity needed of the dependency computation, thus now being able to recognize some loops as parallel. The tests were checking that the outer loop is not parallel, but some inner loops can be parallized, particularly the array packing loops. * DeLICM/reduction_looprotate_hoisted.ll changes in how isl generates expressions * ScheduleOptimizer/pattern-matching-based-opts_5.ll changes in how isl generates expressions, and AST node changes
2025-12-17[Polly] Recalculate dependencies after import-jscop (#172640)Michael Kruse1-3/+8
The new access functions may have different dependencies than the original ones. Invalidate the dependency analysis after an jscop-import.
2025-11-16[Polly] Remove ScopPass infrastructure (#125783)Michael Kruse1-1/+1
PR #125442 replaces the pass-based Polly architecture with a monolithic pass consisting of phases. Reasons listed in https://github.com/llvm/llvm-project/pull/125442. With this change, the SCoP-passes became redundant problematic versions of the same functionality and are removed.
2025-11-14[Polly] Introduce PhaseManager and remove LPM support (#125442) (#167560)Michael Kruse273-440/+404
Reapply of a22d1c2225543aa9ae7882f6b1a97ee7b2c95574. Using this PR for pre-merge CI. Instead of relying on any pass manager to schedule Polly's passes, add Polly's own pipeline manager which is seen as a monolithic pass in LLVM's pass manager. Polly's former passes are now phases of the new PhaseManager component. Relying on LLVM's pass manager (the legacy as well as the New Pass Manager) to manage Polly's phases never was a good fit that the PhaseManager resolves: * Polly passes were modifying analysis results, in particular RegionInfo and ScopInfo. This means that there was not just one unique and "definite" analysis result, the actual result depended on which analyses ran prior, and the pass manager was not allowed to throw away cached analyses or prior SCoP optimizations would have been forgotten. The LLVM pass manger's persistance of analysis results is not contractual but designed for caching. * Polly depends on a particular execution order of passes and regions (e.g. regression tests, invalidation of consecutive SCoPs). LLVM's pass manager does not guarantee any excecution order. * Polly does not completely preserve DominatorTree, RegionInfo, LoopInfo, or ScalarEvolution, but only as-needed for Polly's own uses. Because the ScopDetection object stores references to those analyses, it still had to lie to the pass manager that they would be preserved, or the pass manager would have released and recomputed the invalidated analysis objects that ScopDetection/ScopInfo was still referencing. To ensure that no non-Polly pass would see these not-completely-preserved analyses, all analyses still had to be thrown away after the ScopPassManager, respectively with a BarrierNoopPass in case of the LPM. * The NPM's PassInstrumentation wraps the IR unit into an `llvm::Any` object, but implementations such as PrintIRInstrumentation call llvm_unreachable on encountering an unknown IR unit, such as SCoPs, with no extension points to add support. Hence LLVM crashes when dumping IR between SCoP passes (such as `-print-before-changed` with Polly being active). The new PhaseManager uses some command line options that previously belonged to Polly's legacy passes, such as `-polly-print-detect` (so the option will continue to work). Hence the LPM support is incompatible with the new approach and support for it is removed.
2025-11-10[Polly] Retain vectorization for fallback loop when RTC is unsatisfiable ↵Karthika Devi C1-0/+28
(#165525) When Polly generates a false runtime condition (RTC), the associated Polly generated loop is never executed and is eventually eliminated. As a result, the fallback loop becomes the default execution path. Disabling vectorization for this fallback loop will be counterproductive. This patch ensures that vectorization is only disabled when the RTC is not false (no Codegen failure).
2025-11-04Revert "[Polly] Introduce PhaseManager and remove LPM support (#125442)"Aiden Grossman271-338/+438
This reverts commit e987ab11a6f3d3965ef26fc42c82db3e8b1d56f5. This broke premerge: 1. https://lab.llvm.org/staging/#/builders/192/builds/9521 2. https://github.com/llvm/llvm-project/actions/runs/19054182009 Notably this did not break inside the PR. Not exactly sure why. I realize that there is a lot of test churn here, but they're largely in polly where commit frequency is much lower, so a reapply of the patch should be clean.
2025-11-03[Polly] Introduce PhaseManager and remove LPM support (#125442)Michael Kruse271-438/+338
Instead of relying on any pass manager to schedule Polly's passes, add Polly's own pipeline manager which is seen as a monolithic pass in LLVM's pass manager. Polly's former passes are now phases of the new PhaseManager component. Relying on LLVM's pass manager (the legacy as well as the New Pass Manager) to manage Polly's phases never was a good fit that the PhaseManager resolves: * Polly passes were modifying analysis results, in particular RegionInfo and ScopInfo. This means that there was not just one unique and "definite" analysis result, the actual result depended on which analyses ran prior, and the pass manager was not allowed to throw away cached analyses or prior SCoP optimizations would have been forgotten. The LLVM pass manger's persistance of analysis results is not contractual but designed for caching. * Polly depends on a particular execution order of passes and regions (e.g. regression tests, invalidation of consecutive SCoPs). LLVM's pass manager does not guarantee any excecution order. * Polly does not completely preserve DominatorTree, RegionInfo, LoopInfo, or ScalarEvolution, but only as-needed for Polly's own uses. Because the ScopDetection object stores references to those analyses, it still had to lie to the pass manager that they would be preserved, or the pass manager would have released and recomputed the invalidated analysis objects that ScopDetection/ScopInfo was still referencing. To ensure that no non-Polly pass would see these not-completely-preserved analyses, all analyses still had to be thrown away after the ScopPassManager, respectively with a BarrierNoopPass in case of the LPM. * The NPM's PassInstrumentation wraps the IR unit into an `llvm::Any` object, but implementations such as PrintIRInstrumentation call llvm_unreachable on encountering an unknown IR unit, such as SCoPs, with no extension points to add support. Hence LLVM crashes when dumping IR between SCoP passes (such as `-print-before-changed` with Polly being active). The new PhaseManager uses some command line options that previously belonged to Polly's legacy passes, such as `-polly-print-detect` (so the option will continue to work). Hence the LPM support is incompatible with the new approach and support for it is removed.
2025-10-22[polly] Remove unsafe-fp-math uses (NFC) (#164603)paperchalice21-119/+56
Post cleanup for #164534.
2025-07-21[IR] Only allow lifetime.start/end on allocas (#149310)Nikita Popov1-2/+2
lifetime.start and lifetime.end are primarily intended for use on allocas, to enable stack coloring and other liveness optimizations. This is necessary because all (static) allocas are hoisted into the entry block, so lifetime markers are the only way to convey the actual lifetimes. However, lifetime.start and lifetime.end are currently *allowed* to be used on non-alloca pointers. We don't actually do this in practice, but just the mere fact that this is possible breaks the core purpose of the lifetime markers, which is stack coloring of allocas. Stack coloring can only work correctly if all lifetime markers for an alloca are analyzable. * If a lifetime marker may operate on multiple allocas via a select/phi, we don't know which lifetime actually starts/ends and handle it incorrectly (https://github.com/llvm/llvm-project/issues/104776). * Stack coloring operates on the assumption that all lifetime markers are visible, and not, for example, hidden behind a function call or escaped pointer. It's not possible to change this, as part of the purpose of lifetime markers is that they work even in the presence of escaped pointers, where simple use analysis is insufficient. I don't think there is any way to have coherent semantics for lifetime markers on allocas, while also permitting them on arbitrary pointer values. This PR restricts lifetimes to operate on allocas only. As a followup, I will also drop the size argument, which is superfluous if we always operate on an alloca. (This change also renders various code handling lifetime markers on non-alloca dead. I plan to clean up that kind of code after dropping the size argument as well.) In practice, I've only found a few places that currently produce lifetimes on non-allocas: * CoroEarly replaces the promise alloca with the result of an intrinsic, which will later be replaced back with an alloca. I think this is the only place where there is some legitimate loss of functionality, but I don't think this is particularly important (I don't think we'd expect the promise in a coroutine to admit useful lifetime optimization.) * SafeStack moves unsafe allocas onto a separate frame. We can safely drop lifetimes here, as SafeStack performs its own stack coloring. * Similar for AddressSanitizer, it also moves allocas into separate memory. * LSR sometimes replaces the lifetime argument with a GEP chain of the alloca (where the offsets ultimately cancel out). This is just unnecessary. (Fixed separately in https://github.com/llvm/llvm-project/pull/149492.) * InferAddrSpaces sometimes makes lifetimes operate on an addrspacecast of an alloca. I don't think this is necessary.
2025-05-22Fix regression tests with bad FileCheck checks (#140373)Mohammad Bashir1-2/+2
Fixes https://github.com/llvm/llvm-project/issues/140149
2025-01-27[Polly] Fix typos discovered by codespell (#124545)Christian Clauss6-6/+6
Patch created using the following command line: ```bash codespell polly --skip="*.pdf,polly/lib/External/*" --write-changes \ --ignore-words-list=couter,createor,distribues,doble,identty,indention,indx,olt,ore,padd,sais,te,theses ```
2025-01-22[Polly] Add vectorize metadata to loops identified as vectorizable by polly ↵Karthika Devi C1-0/+61
(#113994) This patch introduces the initial implementation for annotating loops created by Polly. Polly generates RunTimeChecks (RTCs), which result in loop versioning. Specifically, the loop created by Polly is executed when the RTCs pass, otherwise, the original loop is executed. This patch adds the "llvm.loop.vectorize.enable" metadata, setting it to true for loops created by Polly. Disabling vectorization for the original fallback loop is already merged in #119188. This behavior is controlled by the 'polly-annotate-metadata-vectorize' flag, and the annotations are applied only when this flag is enabled. This flag is set to false by default. NOTE: This commit is initial patch in effort to make polly interact with Loop Vectorizer via metadata. --------- Co-authored-by: Michael Kruse <github@meinersbur.de>
2025-01-08[Polly] Switch DT/LI in RegionGenerator for parallel subfn (#120413)Karthika Devi C1-0/+41
The patch #102460 already implements separate DT/LI/SE for parallel sub function. Crashes have been reported while region generator tries using oringinal function's DT while creating new parallel sub function due to checks in #101198. This patch aims at fixing those cases by switching the DT/LI while generating parallel function using Region Generator. Fixes #117877
2024-12-11[Polly] Disable vectorization for Polly's fallback loops (#119188)Karthika Devi C17-63/+68
The patch sets the vectorization metadata to false for Polly's fallback loops. These are the loops executed when RTCs fail. This minimizes the multiple loop versioning carried out by Polly and subsequently by the Loop Vectorizer. --------- Co-authored-by: Michael Kruse <github@meinersbur.de>
2024-11-07[SCEV] Disallow simplifying phi(undef, X) to X (#115109)Yingwei Zheng7-12/+12
See the following case: ``` @GlobIntONE = global i32 0, align 4 define ptr @src() { entry: br label %for.body.peel.begin for.body.peel.begin: ; preds = %entry br label %for.body.peel for.body.peel: ; preds = %for.body.peel.begin br i1 true, label %cleanup.peel, label %cleanup.loopexit.peel cleanup.loopexit.peel: ; preds = %for.body.peel br label %cleanup.peel cleanup.peel: ; preds = %cleanup.loopexit.peel, %for.body.peel %retval.2.peel = phi ptr [ undef, %for.body.peel ], [ @GlobIntONE, %cleanup.loopexit.peel ] br i1 true, label %for.body.peel.next, label %cleanup7 for.body.peel.next: ; preds = %cleanup.peel br label %for.body.peel.next1 for.body.peel.next1: ; preds = %for.body.peel.next br label %entry.peel.newph entry.peel.newph: ; preds = %for.body.peel.next1 br label %for.body for.body: ; preds = %cleanup, %entry.peel.newph %retval.0 = phi ptr [ %retval.2.peel, %entry.peel.newph ], [ %retval.2, %cleanup ] br i1 false, label %cleanup, label %cleanup.loopexit cleanup.loopexit: ; preds = %for.body br label %cleanup cleanup: ; preds = %cleanup.loopexit, %for.body %retval.2 = phi ptr [ %retval.0, %for.body ], [ @GlobIntONE, %cleanup.loopexit ] br i1 false, label %for.body, label %cleanup7.loopexit cleanup7.loopexit: ; preds = %cleanup %retval.2.lcssa.ph = phi ptr [ %retval.2, %cleanup ] br label %cleanup7 cleanup7: ; preds = %cleanup7.loopexit, %cleanup.peel %retval.2.lcssa = phi ptr [ %retval.2.peel, %cleanup.peel ], [ %retval.2.lcssa.ph, %cleanup7.loopexit ] ret ptr %retval.2.lcssa } define ptr @tgt() { entry: br label %for.body.peel.begin for.body.peel.begin: ; preds = %entry br label %for.body.peel for.body.peel: ; preds = %for.body.peel.begin br i1 true, label %cleanup.peel, label %cleanup.loopexit.peel cleanup.loopexit.peel: ; preds = %for.body.peel br label %cleanup.peel cleanup.peel: ; preds = %cleanup.loopexit.peel, %for.body.peel %retval.2.peel = phi ptr [ undef, %for.body.peel ], [ @GlobIntONE, %cleanup.loopexit.peel ] br i1 true, label %for.body.peel.next, label %cleanup7 for.body.peel.next: ; preds = %cleanup.peel br label %for.body.peel.next1 for.body.peel.next1: ; preds = %for.body.peel.next br label %entry.peel.newph entry.peel.newph: ; preds = %for.body.peel.next1 br label %for.body for.body: ; preds = %cleanup, %entry.peel.newph br i1 false, label %cleanup, label %cleanup.loopexit cleanup.loopexit: ; preds = %for.body br label %cleanup cleanup: ; preds = %cleanup.loopexit, %for.body br i1 false, label %for.body, label %cleanup7.loopexit cleanup7.loopexit: ; preds = %cleanup %retval.2.lcssa.ph = phi ptr [ %retval.2.peel, %cleanup ] br label %cleanup7 cleanup7: ; preds = %cleanup7.loopexit, %cleanup.peel %retval.2.lcssa = phi ptr [ %retval.2.peel, %cleanup.peel ], [ %retval.2.lcssa.ph, %cleanup7.loopexit ] ret ptr %retval.2.lcssa } ``` 1. `simplifyInstruction(%retval.2.peel)` returns `@GlobIntONE`. Thus, `ScalarEvolution::createNodeForPHI` returns SCEV expr `@GlobIntONE` for `%retval.2.peel`. 2. `SimplifyIndvar::replaceIVUserWithLoopInvariant` tries to replace the use of `%retval.2.peel` in `%retval.2.lcssa.ph` with `@GlobIntONE`. 3. `simplifyLoopAfterUnroll -> simplifyLoopIVs -> SCEVExpander::expand` reuses `%retval.2.peel = phi ptr [ undef, %for.body.peel ], [ @GlobIntONE, %cleanup.loopexit.peel ]` to generate code for `@GlobIntONE`. It is incorrect. This patch disallows simplifying `phi(undef, X)` to `X` by setting `CanUseUndef` to false. Closes https://github.com/llvm/llvm-project/issues/114879.
2024-08-09[IRBuilder] Generate nuw GEPs for struct member accesses (#99538)Hari Limaye5-8/+8
Generate nuw GEPs for struct member accesses, as inbounds + non-negative implies nuw. Regression tests are updated using update scripts where possible, and by find + replace where not.
2024-06-14 [RemoveDIs] Print IR with debug records by default (#91724)Stephen Tozer1-5/+5
This patch makes the final major change of the RemoveDIs project, changing the default IR output from debug intrinsics to debug records. This is expected to break a large number of tests: every single one that tests for uses or declarations of debug intrinsics and does not explicitly disable writing records. If this patch has broken your downstream tests (or upstream tests on a configuration I wasn't able to run): 1. If you need to immediately unblock a build, pass `--write-experimental-debuginfo=false` to LLVM's option processing for all failing tests (remember to use `-mllvm` for clang/flang to forward arguments to LLVM). 2. For most test failures, the changes are trivial and mechanical, enough that they can be done by script; see the migration guide for a guide on how to do this: https://llvm.org/docs/RemoveDIsDebugInfo.html#test-updates 3. If any tests fail for reasons other than FileCheck check lines that need updating, such as assertion failures, that is most likely a real bug with this patch and should be reported as such. For more information, see the recent PSA: https://discourse.llvm.org/t/psa-ir-output-changing-from-debug-intrinsics-to-debug-records/79578
2024-06-03[test] Fix filecheck annotation typos (#91854)klensy1-1/+1
Similar to https://github.com/rust-lang/rust/pull/125007
2024-05-24Reland "[polly] Port polly tests to use NPM" (#92918)rahulana-quic263-348/+347
Even as the NPM has been in use by Polly for a while now, the majority of the tests continue using the LPM passes. This patch ports the tests to use the NPM passes (for example, by replacing a flag such as -polly-detect with -passes=polly-detect following the NPM syntax for specifying passes) with some exceptions for some missing features in the new passes. Relanding #90632.
2024-05-14Revert "[polly] Port polly tests to use NPM" (#92215)Eli Friedman263-334/+335
Reverts llvm/llvm-project#90632. Causing failures on buildbots that dynamically load polly. Reverting while we sort it out.
2024-05-14[polly] Port polly tests to use NPM (#90632)rahulana-quic263-335/+334
Even as the NPM has been in use by Polly for a while now, the majority of the tests continue using the LPM passes. This patch ports the tests to use the NPM passes (for example, by replacing a flag such as -polly-detect with -passes=polly-detect following the NPM syntax for specifying passes) with some exceptions for some missing features in the new passes. Additionally, the lit substitution %loadPolly is replaced by the substitution of what was %loadNPMPolly and %loadNPMPolly is removed.
2023-12-05[Polly] Add disjoint flag to some tests (NFC)Nikita Popov1-3/+3
2023-10-31[SCEV] Teach SCEVExpander to use zext nneg when possible (#70815)Philip Reames1-1/+1
zext nneg was recently added to the IR in #67982. Teaching SCEVExpander to emit nneg when possible is valuable since SCEV may have proved non-trivial facts about loop bounds which would otherwise be lost when materializing the value.
2023-09-18[IR] Remove unnecessary bitcast from CreateMalloc()Nikita Popov1-7/+7
This bitcast is no longer necessary with opaque pointers. This results in some annoying variable name changes in tests.
2023-05-31[SCEV] Compute AddRec range computations using different type BECountJoshua Cao1-7/+7
Before this patch, we can only use the MaxBECount for an AddRec's range computation if the MaxBECount has <= bit width of the AddRec. This patch reasons that if a MaxBECount has > bit width, and is <= the max value of AddRec's bit width, we can still use the MaxBECount. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D151698
2023-04-28[polly] Drop redundant use of -instnamer in polly MemAccess lit testsBjorn Pettersson4-4/+4
Differential Revision: https://reviews.llvm.org/D148530
2023-04-27[Polly] Update polly test after SCEV changesNikita Popov1-1/+1
Make the phi non-trivial, so SCEV can't see through it.
2023-03-17[Polly] Convert remaining tests to opaque pointers (NFC)Nikita Popov16-254/+243
2023-03-17[Polly] Convert some tests to opaque pointers (NFC)Nikita Popov39-454/+461
2023-03-17[Polly] Convert some tests to opaque pointers (NFC)Nikita Popov7-125/+118
2023-03-08[Polly] Remove -polly-vectorizer=polly.Michael Kruse24-1075/+1
Polly's internal vectorizer is not well maintained and is known to not work in some cases such as region ScopStmts. Unlike LLVM's LoopVectorize pass it also does not have a target-dependent cost heuristics, and we recommend using LoopVectorize instead of -polly-vectorizer=polly. In the future we hope that Polly can collaborate better with LoopVectorize, like Polly marking a loop is safe to vectorize with a specific simd width, instead of replicating its functionality. Reviewed By: grosser Differential Revision: https://reviews.llvm.org/D142640
2023-01-18[AsmParser] Remove typed pointer auto-detectionNikita Popov71-98/+98
IR is now always parsed in opaque pointer mode, unless -opaque-pointers=0 is explicitly given. There is no automatic detection of typed pointers anymore. The -opaque-pointers=0 option is added to any remaining IR tests that haven't been migrated yet. Differential Revision: https://reviews.llvm.org/D141912
2023-01-17[Polly] Convert some tests to opaque pointers (NFC)Nikita Popov197-1714/+1622
2023-01-11[IRBuilder] Use canonical i64 type for insertelement index used by vector ↵Paul Walker4-4/+4
splats. Instcombine prefers this canonical form (see getPreferredVectorIndex), as does IRBuilder when passing the index as an integer so we may as well use the prefered form from creation. NOTE: All test changes are mechanical with nothing else expected beyond a change of index type from i32 to i64. Differential Revision: https://reviews.llvm.org/D140983
2022-08-07[polly] Fixed a number of typos. NFCGabriel Ravier1-1/+1
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-07-26[Polly] Insert !dbg metadata for emitted CallInsts.Michael Kruse1-0/+162
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-06-29[Polly][MatMul] Abandon dependence analysis.Michael Kruse1-18/+6
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-02[IR] Enable opaque pointers by defaultNikita Popov4-5/+5
This enabled opaque pointers by default in LLVM. The effect of this is twofold: * If IR that contains *neither* explicit ptr nor %T* types is passed to tools, we will now use opaque pointer mode, unless -opaque-pointers=0 has been explicitly passed. * Users of LLVM as a library will now default to opaque pointers. It is possible to opt-out by calling setOpaquePointers(false) on LLVMContext. A cmake option to toggle this default will not be provided. Frontends or other tools that want to (temporarily) keep using typed pointers should disable opaque pointers via LLVMContext. Differential Revision: https://reviews.llvm.org/D126689
2022-03-24[polly] Remove last instances of -analyzeArthur Eubanks2-3/+3
As mentioned in D120782, the loop block order can be different depending on if LoopInfo is incrementally updated or freshly computed. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D122195
2022-03-18Reland "Load pass plugins during option processing, so that plugin options ↵Wael Yehia1-2/+2
are registered and live." Fix Polly failures. Reviewed By: mehdi_amini, Meinersbur Differential Revision: https://reviews.llvm.org/D121566
2022-03-14[polly] Introduce -polly-print-* passes to replace -analyze.Michael Kruse66-86/+76
The `opt -analyze` option only works with the legacy pass manager and might be removed in the future, as explained in llvm.org/PR53733. This patch introduced -polly-print-* passes that print what the pass would print with the `-analyze` option and replaces all uses of `-analyze` in the regression tests. There are two exceptions: `CodeGen\single_loop_param_less_equal.ll` and `CodeGen\loop_with_condition_nested.ll` use `-analyze on the `-loops` pass which is not part of Polly. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D120782