summaryrefslogtreecommitdiffstats
path: root/polly/test/ScopDetect
Commit message (Collapse)AuthorAgeFilesLines
* Migrate function attribute "no-frame-pointer-elim"="false" to ↵Fangrui Song2019-12-243-5/+5
| | | | "frame-pointer"="none" as cleanups after D56351
* Migrate function attribute "no-frame-pointer-elim" to "frame-pointer"="all" ↵Fangrui Song2019-12-244-5/+5
| | | | as cleanups after D56351
* [ScopHelper] Provide support for recognising collective invariant loadsPhilip Pfaffe2018-06-291-0/+56
| | | | | | | | | | | | | | Summary: This patch aims to provide support for detecting load patterns which are collectively invariant but right now `isHoistableLoad()` is checking each load instruction individually which cannot detect the load pattern as a whole. Patch by: Sahil Girish Yerawar Reviewers: bollu, philip.pfaffe, Meinersbur Reviewed By: philip.pfaffe, Meinersbur Differential Revision: https://reviews.llvm.org/D48026 llvm-svn: 335949
* Adjust to debug info metadata format change.Tobias Grosser2018-05-101-2/+2
| | | | | | Rename variable to retainedNodes. This unbreaks the Polly builds. llvm-svn: 331960
* [ScopDetect] Reject loop with multiple exit blocks.Michael Kruse2018-04-252-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current statement domain derivation algorithm does not (always) consider that different exit blocks of a loop can have different conditions to be reached. From the code for (int i = n; ; i-=2) { if (i <= 0) goto even; if (i <= 1) goto odd; A[i] = i; } even: A[0] = 42; return; odd: A[1] = 21; return; Polly currently derives the following domains: Stmt_even_critedge Domain := [n] -> { Stmt_even_critedge[] }; Stmt_odd Domain := [n] -> { Stmt_odd[] : (1 + n) mod 2 = 0 and n > 0 }; while the domain for the odd case is correct, Stmt_even is assumed to be executed unconditionally, which is obviously wrong. While projecting out the loop dimension in `adjustDomainDimensions`, it does not consider that there are other exit condition that have matched before. I don't know a how to fix this without changing a lot of code. Therefore This patch rejects loops with multiple exist blocks to fix the miscompile of test-suite's uuencode. The odd condition is transformed by LLVM to %cmp1 = icmp eq i64 %indvars.iv, 1 such that the project_out in adjustDomainDimensions() indeed only matches for odd n (using this condition only, we'd have an infinite loop otherwise). The even condition manifests as %cmp = icmp slt i64 %indvars.iv, 3 Because buildDomainsWithBranchConstraints() does not consider other exit conditions, it has to assume that the induction variable will eventually be lower than 3 and taking this exit. IMHO we need to reuse the algorithm that determines the number of iterations (addLoopBoundsToHeaderDomain) to determine which exit condition applies first. It has to happen in buildDomainsWithBranchConstraints() because the result will need to propagate to successor BBs. Currently addLoopBoundsToHeaderDomain() just look for union of all backedge conditions (which means leaving not the loop here). The patch in llvm.org/PR35465 changes it to look for exit conditions instead. This is required because there might be other exit conditions that do not alternatively go back to the loop header. Differential Revision: https://reviews.llvm.org/D45649 llvm-svn: 330858
* [ScopDetect / ScopInfo] Get statistics for scops without any loop correctlyTobias Grosser2018-04-181-2/+24
| | | | | | Make sure we also counts scops not containing any loops. llvm-svn: 330285
* Remove immediate dominator heuristic for error block detection.Michael Kruse2018-04-091-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the heuristic in - Polly :: lib/Support/ScopHelper.cpp The heuristic forces blocks that directly follow a loop header to not to be considered error blocks. It was introduced in r249611 with the following commit message: > This replaces the support for user defined error functions by a > heuristic that tries to determine if a call to a non-pure function > should be considered "an error". If so the block is assumed not to be > executed at runtime. While treating all non-pure function calls as > errors will allow a lot more regions to be analyzed, it will also > cause us to dismiss a lot again due to an infeasible runtime context. > This patch tries to limit that effect. A non-pure function call is > considered an error if it is executed only in conditionally with > regards to a cheap but simple heuristic. In the code below `CCK_Abort2()` would be considered as an error block, but not `CCK_Abort1()` due to this heuristic. ``` for (int i = 0; i < n; i+=1) { if (ErrorCondition1) CCK_Abort1(); // No __attribute__((noreturn)) if (ErrorCondition2) CCK_Abort2(); // No __attribute__((noreturn)) } ``` This does not seem useful. Checking error conditions in the beginning of some work is quite common. It causes a switch default-case to be not considered an error block in SPEC's cactuBSSN. The comment justifying the heuristic mentions a "load", which does not seem to be applicable here. It has been proposed to remove the heuristic. In addition, the patch fixes the following test cases: - Polly :: ScopDetect/mod_ref_read_pointer.ll - Polly :: ScopInfo/max-loop-depth.ll - Polly :: ScopInfo/mod_ref_access_pointee_arguments.ll - Polly :: ScopInfo/mod_ref_read_pointee_arguments.ll - Polly :: ScopInfo/mod_ref_read_pointer.ll - Polly :: ScopInfo/mod_ref_read_pointers.ll The test cases failed after removing the heuristic. Differential Revision: https://reviews.llvm.org/D45274 Contributed-by: Lorenzo Chelini <l.chelini@icloud.com> llvm-svn: 329548
* Handle Top-Level-Regions in polly::isHoistableLoadPhilip Pfaffe2017-11-301-0/+73
| | | | | | | | | | | | | | | | | | | | Summary: This can be seen as a follow-up on my previous differential [D33411](https://reviews.llvm.org/D33411). We received a bug report where this error was triggered. I have tried my best to recreate the issue in a minimal lit testcase which is also part of this differential. I only handle return instructions as predecessors to a virtual TLR-exit right now. From inspecting the codebase, it seems `unreachable` instructions may also be of interest here. If requested, I can extend my patches to consider them as well. I would also apply this on `ScopHelper.cpp::isErrorBlock` (see D33411), of course. Reviewers: philip.pfaffe, bollu Reviewed By: bollu Subscribers: Meinersbur, pollydev, llvm-commits Tags: #polly Differential Revision: https://reviews.llvm.org/D40492 llvm-svn: 319431
* [ScopDetect] Do not add loads out of the SCoP to required invariant loads.Michael Kruse2017-10-011-0/+84
| | | | | | | | | | | | | | | | Loads before the SCoP are always invariant within the SCoP and therefore are no "required invariant loads". An assertion failes in ScopBuilder when it finds such an invariant load. Fix by not adding such loads to the required invariant load list. This likely will cause the region to be not considered a valid SCoP. We may want to unconditionally accept instructions defined before the region as valid invariant conditions instead of rejecting them. This fixes a compilation crash of SPEC CPU2006 453.povray's render.cpp. llvm-svn: 314636
* Check whether IslAstInfo and DependenceInfo were computed for the same Scop.Michael Kruse2017-09-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Since -polly-codegen reports itself to preserve DependenceInfo and IslAstInfo, we might get those analysis that were computed by a different ScopInfo for a different Scop structure. This would be unfortunate because DependenceInfo and IslAstInfo hold references to resources allocated by ScopInfo/ScopBuilder/Scop (e.g. isl_id). If -polly-codegen and DependenceInfo/IslAstInfo do not agree on which Scop to use, unpredictable things can happen. When the ScopInfo/Scop object is freed, there is a high probability that the new ScopInfo/Scop object will be created at the same heap position with the same address. Comparing whether the Scop or ScopInfo address is the expected therefore is unreliable. Instead, we compare the address of the isl_ctx object. Both, DependenceInfo and IslAstInfo must hold a reference to the isl_ctx object to ensure it is not freed before the destruction of those analyses which might happen after the destruction of the Scop/ScopInfo they refer to. Hence, the isl_ctx will not be freed and its address not reused as long there is a DependenceInfo or IslAstInfo around. This fixes llvm.org/PR34441 llvm-svn: 313842
* [ScopHelper] Do not crash on unreachable blocksTobias Grosser2017-09-031-0/+36
| | | | | | This resolves llvm.org/PR34433. Thanks to Zhendong Su for reporting. llvm-svn: 312451
* [Detect] Consider nested loop profitable if entry block is not in loopTobias Grosser2017-08-271-0/+94
| | | | | | | | | | | | | In cases where the entry block of a scop was not contained in a loop that was part of the scop region and at the same time there was a loop surrounding the scop, we missed to count the loops in the scop and consequently did not consider the scop profitable. We correct this by only moving to the loop parent, in case the current loop is loop contained in the scop. This increases the number of loops in COSMO which we assume to be profitable from 3974 to 4981. llvm-svn: 311863
* [ScopDetect] Include zero-iteration loops in loop count.Michael Kruse2017-08-231-8/+36
| | | | | | | | | | | | | | | | | | | | Loop with zero iteration are, syntactically, loops. They have been excluded from the loop counter even for the non-profitable counters. This seems to be unintentially as the sentinel value of '0' minimal iterations does exclude such loops. Fix by never considering the iteration count when the sentinel value of 0 is found. This makes the recently added NumTotalLoops couter redundant with NumLoopsOverall, which now is equivalent. Hence, NumTotalLoops is removed as well. Note: The test case 'ScopDetect/statistics.ll' effectively does not check profitability, because -polly-process-unprofitable is passed to all test cases. llvm-svn: 311551
* [test] Do not pipe binary data to FileCheck.Michael Kruse2017-08-221-1/+1
| | | | llvm-svn: 311470
* [ScopDetection] Add stat for total number of loops.Michael Kruse2017-08-221-0/+1
| | | | | | | The total number of loops is useful as a baseline comparing how many loops have been optimized in different configurations. llvm-svn: 311469
* [JSON] Make the failure to parse a jscop file a hard errorPhilip Pfaffe2017-08-101-4/+0
| | | | | | | | | | | | | | | | | | Summary: Before, if we fail to parse a jscop file, this will be reported as an error and importing is aborted. However, this isn't actually strong enough, since although the import is aborted, the scop has already been modified and is very likely broken. Instead, make this a hard failure and throw an LLVM error. This new behaviour requires small changes to the tests for the legacy pass, namely using `not` to verify the error. Further, fixed the jscop file for the base_pointer_load_is_inst_inside_invariant_1 testcase. Reviewed By: Meinersbur Split out of D36578. llvm-svn: 310599
* [ScopDetect] add `-polly-ignore-func` flag to ignore functions by name.Siddharth Bhat2017-07-281-0/+124
| | | | | | | | | | Ignore all functions whose name match a regex. Useful because creating a regex that does *not* match a string is somewhat hard. Example: https://stackoverflow.com/questions/1240275/how-to-negate-specific-word-in-regex llvm-svn: 309377
* [SCEVValidator] Loop exit values of loops before the SCoP are synthesizable.Michael Kruse2017-07-262-2/+86
| | | | | | | | | | | | | | | | | | | | | | | In the following loop: int i; for (i = 0; i < func(); i+=1) ; SCoP: for (int j = 0; j<n; j+=1) S(i, j) The value i is synthesizable in the SCoP that includes only the j-loop. This is because i is fixed within the SCoP, it is irrelevant whether it originates from another loop. This fixes a strange case where a PHI was synthesiable in a SCoP, but not its incoming value, triggering an assertion. This should fix MultiSource/Applications/sgefa/sgefa of the perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable buildbot. llvm-svn: 309109
* [Polly] [NFC] [ScopDetection] Make `polly-only-func` perform regex scop name ↵Siddharth Bhat2017-07-241-0/+130
| | | | | | | | | | | | | | match. Summary: - We were using `.count` in `StringRef`, which matches substrings. - We may want to use this for equality as well. - Generalise this, so allow regexes as a parameter to `polly-only-func`. Differential Revision: https://reviews.llvm.org/D35728 llvm-svn: 308875
* [tests] Set -polly-import-jscop-dir=%S alwaysTobias Grosser2017-07-112-2/+2
| | | | | | This simplifies the test cases. llvm-svn: 307645
* [Polly] [ScopDetection] Allow passing multiple functions to `-polly-only-func`.Siddharth Bhat2017-06-091-0/+100
| | | | | | | | - This is useful to run optimisations on only certain functions. Differential Revision: https://reviews.llvm.org/D33990 llvm-svn: 305060
* [NFC] [Fortran Support] Cleanup Fortran Array pattern mactch testcasesSiddharth Bhat2017-05-122-230/+0
| | | | | | | | | | - Move the testcases to ScopInfo/ since the processing takes place in ScopBuilder. - Cleanup testcases, run -polly-canonicalize on them, find minimal set of opt parameters. llvm-svn: 302886
* [NFC] [Fortran Support] move Fortran array detection testcasesSiddharth Bhat2017-05-102-0/+230
| | | | | | move these testcases to where they belong: ScopDetect llvm-svn: 302735
* [ScopDetection] Only allow SCoP-wide available base pointers.Michael Kruse2017-03-083-5/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simplify ScopDetection::isInvariant(). Essentially deny everything that is defined within the SCoP and is not load-hoisted. The previous understanding of "invariant" has a few holes: - Expressions without side-effects with only invariant arguments, but are defined withing the SCoP's region with the exception of selects and PHIs. These should be part of the index expression derived by ScalarEvolution and not of the base pointer. - Function calls with that are !mayHaveSideEffects() (typically functions with "readnone nounwind" attributes). An example is given below. @C = external global i32 declare float* @getNextBasePtr(float*) readnone nounwind ... %ptr = call float* @getNextBasePtr(float* %A, float %B) The call might return: * %A, so %ptr aliases with it in the SCoP * %B, so %ptr aliases with it in the SCoP * @C, so %ptr aliases with it in the SCoP * a new pointer everytime it is called, such as malloc() * a pointer into the allocated block of one of the aforementioned * any of the above, at random at each call Hence and contrast to a comment in the base_pointer.ll regression test, %ptr is not necessarily the same all the time. It might also alias with anything and no AliasAnalysis can tell otherwise if the definition is external. It is hence not suitable in the role of a base pointer. The practical problem with base pointers defined in SCoP statements is that it is not available globally in the SCoP. The statement instance must be executed first before the base pointer can be used. This is no problem if the base pointer is transferred as a scalar value between statements. Uses of MemoryAccess::setNewAccessRelation may add a use of the base pointer anywhere in the array. setNewAccessRelation is used by JSONImporter, DeLICM and D28518. Indeed, BlockGenerator currently assumes that base pointers are available globally and generates invalid code for new access relation (referring to the base pointer of the original code) if not, even if the base pointer would be available in the statement. This could be fixed with some added complexity and restrictions. The ExprBuilder must lookup the local BBMap and code that call setNewAccessRelation must check whether the base pointer is available first. The code would still be incorrect in the presence of aliasing. There is the switch -polly-ignore-aliasing to explicitly allow this, but it is hardly a justification for the additional complexity. It would still be mostly useless because in most cases either getNextBasePtr() has external linkage in which case the readnone nounwind attributes cannot be derived in the translation unit itself, or is defined in the same translation unit and gets inlined. Reviewed By: grosser Differential Revision: https://reviews.llvm.org/D30695 llvm-svn: 297281
* [ScopDetection] Require LoadInst base pointers to be hoisted.Michael Kruse2017-03-073-1/+76
| | | | | | | | | | | | | | | | | | Only when load-hoisted we can be sure the base pointer is invariant during the SCoP's execution. Most of the time it would be added to the required hoists for the alias checks anyway, except with -polly-ignore-aliasing, -polly-use-runtime-alias-checks=0 or if AliasAnalysis is already sure it doesn't alias with anything (for instance if there is no other pointer to alias with). Two more parts in Polly assume that this load-hoisting took place: - setNewAccessRelation() which contains an assert which tests this. - BlockGenerator which would use to the base ptr from the original code if not load-hoisted (if the access expression is regenerated) Differential Revision: https://reviews.llvm.org/D30694 llvm-svn: 297195
* [ScopDetection] Compute the maximal loop depth correctlyTobias Grosser2017-02-171-0/+249
| | | | | | | Before this change, we obtained loop depth numbers that were deeper then the actual loop depth. llvm-svn: 295430
* test: add more details to non-affine test caseTobias Grosser2016-11-221-6/+35
| | | | | | | | | | | We add CHECK lines to this test case to make it easier to see the difference between affine and non-affine memory accesses. We also change the test case to use a parameteric index expression as otherwise our range analysis will understand that the non-affine memory access can only access input[1], which makes it difficult to see that the memory access is in-fact modeled as non-affine access. llvm-svn: 287623
* Do not allow switch statements in loop latchesTobias Grosser2016-11-101-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | In r248701 "Allow switch instructions in SCoPs" support for switch statements has been introduced, but support for switch statements in loop latches was incomplete. This change completely disables switch statements in loop latches. The original commit changed addLoopBoundsToHeaderDomain to support non-branch terminator instructions, but this change was incorrect: it added a check for BI != null to the if-branch of a condition, but BI was used in the else branch es well. As a result, when a non-branch terminator instruction is encounted a nullptr dereference is triggered. Due to missing test coverage, this bug was overlooked. r249273 "[FIX] Approximate non-affine loops correctly" added code to disallow switch statements for non-affine loops, if they appear in either a loop latch or a loop exit. We adapt this code to now prohibit switch statements in loop latches even if the control condition is affine. We could possibly add support for switch statements in loop latches, but such support should be evaluated and tested separately. This fixes llvm.org/PR30952 Reported-by: Eli Friedman <efriedma@codeaurora.org> llvm-svn: 286426
* [ScopDetect] Depend transitively on ScalarEvolution.Michael Kruse2016-10-171-0/+47
| | | | | | | ScopDetection might be queried by -dot-scops or -view-scops passes for which it accesses ScalarEvolution. llvm-svn: 284385
* [ScopDetect] Do not assert in case of AddRecs with non-constant start expressionTobias Grosser2016-08-151-0/+50
| | | | llvm-svn: 278738
* Weaken profitability constraints during ScopDetectionJohannes Doerfert2016-05-101-6/+3
| | | | | | | | Regions with one affine loop can be profitable if the loop is distributable. To this end we will allow them to be treated as profitable if they contain at least two non-trivial basic blocks. llvm-svn: 269064
* Update debug metadata after LLVM commits r266445+r266446Tobias Grosser2016-04-151-4/+3
| | | | llvm-svn: 266473
* Drop explicit -polly-delinearize parameterTobias Grosser2016-03-231-1/+1
| | | | | | | Delinearization is now enabled by default and does not need to explicitly need to be enabled in our tests. llvm-svn: 264154
* Add option to disallow modref function calls in scops.Tobias Grosser2016-03-231-2/+6
| | | | | | | | | | This might be useful to evaluate the benefit of us handling modref funciton calls. Also, a new bug that was triggered by modref function calls was recently reported http://llvm.org/PR27035. To ensure the same issue does not cause troubles for other people, we temporarily disable this until the bug is resolved. llvm-svn: 264140
* [SCEVValidator] Fix loop exit values considered affine.Michael Kruse2016-03-031-0/+41
| | | | | | | | | | | | | | | | | | | | Index calculations can use the last value that come out of a loop. Ideally, ScalarEvolution can compute that exit value directly without depending on the loop induction variable, but not in all cases. This changes isAffine to not consider such loop exit values as affine to avoid that SCEVExpander adds uses of the original loop induction variable. This fix is analogous to r262404 that applies to general uses of loop exit values instead of index expressions and loop bouds as in this patch. This reduces the number of LNT test-suite fails with -polly-position=before-vectorizer -polly-unprofitable from 10 to 8. llvm-svn: 262665
* Support calls with known ModRef function behaviourJohannes Doerfert2016-02-251-0/+41
| | | | | | | | | Check the ModRefBehaviour of functions in order to decide whether or not a call instruction might be acceptable. Differential Revision: http://reviews.llvm.org/D5227 llvm-svn: 261866
* Add option to assume single-loop scops with sufficient compute are profitableTobias Grosser2015-12-211-0/+83
| | | | | | | | | | | | | | If a loop has a sufficiently large amount of compute instruction in its loop body, it is unlikely that our rewrite of the loop iterators introduces large performance changes. As Polly can also apply beneficical optimizations (such as parallelization) to such loop nests, we mark them as profitable. This option is currently "disabled" by default, but can be used to run experiments. If enabled by setting it e.g. to 40 instructions, we currently see some compile-time increases on LNT without any significant run-time changes. llvm-svn: 256199
* Fix of a comment.Roman Gareev2015-12-171-1/+1
| | | | llvm-svn: 255923
* Fix delinearization of fortran arraysRoman Gareev2015-12-171-0/+40
| | | | | | | | | | | | | | | The patch fixes Bug 25759 produced by inappropriate handling of unsigned maximum SCEV expressions by SCEVRemoveMax. Without a fix, we get an infinite loop and a segmentation fault, if we try to process, for example, '((-1 + (-1 * %b1)) umax {(-1 + (-1 * %yStart)),+,-1}<%.preheader>)'. It also fixes a potential issue related to signed maximum SCEV expressions. Tested-by: Roman Gareev <gareevroman@gmail.com> Fixed-by: Tobias Grosser <tobias@grosser.es> Differential Revision: http://reviews.llvm.org/D15563 llvm-svn: 255922
* Remove -polly-code-generator=isl from many test casesTobias Grosser2015-11-218-9/+9
| | | | | | | This is the default since a long time. Setting it again does not add value in any of these test cases. llvm-svn: 253800
* Do not enforce lcssaJohannes Doerfert2015-11-211-2/+2
| | | | | | | | At some point we enforced lcssa for the loop surrounding the entry block. This is not only questionable as it does not check any other loop but also not needed any more. llvm-svn: 253789
* ScopDetection: Tighten the check for always executed 'error blocks'Tobias Grosser2015-11-111-0/+62
| | | | | | | | | Basic blocks that are always executed can not be error blocks as their execution can not possibly be an unlikely event. In this commit we tighten the check if an error block to basic blcoks that do not dominate the exit condition, but that dominate all exiting blocks of the scop. llvm-svn: 252726
* ScopDetection: Do not allow blocks to reference operands in error blocksTobias Grosser2015-11-111-0/+54
| | | | | | | | | | | | | r252713 introduced a couple of regressions due to later basic blocks refering to instructions defined in error blocks which have not yet been modeled. This commit is currently just encoding limitations of our modeling and code generation backends to ensure correctness. In theory, we should be able to generate and optimize such regions, as everything that is dominated by an error region is assumed to not be executed anyhow. We currently just lack the code to make this happen in practice. llvm-svn: 252725
* Adjust debug metadata to LLVM changes in 252219Tobias Grosser2015-11-061-4/+4
| | | | llvm-svn: 252273
* tests: Add test cases for LLVM commit r251267Tobias Grosser2015-10-252-0/+98
| | | | | | This fixes llvm.org/PR25242 llvm-svn: 251268
* ScopDetect: Bail out for non-simple memory accessesTobias Grosser2015-10-251-0/+30
| | | | | | | | | | | | | Volatile or atomic memory accesses are currently not supported. Neither did we think about any special handling needed nor do we support the unknown instructions the alias set tracker turns them into sometimes. Before this patch, us not supporting unkown instructions in an alias set caused the following assertion failures: Assertion `AG.size() > 1 && "Alias groups should contain at least two accesses"' failed llvm-svn: 251234
* ScopDetection: Do not crash if we find zero array size candidates for ↵Tobias Grosser2015-10-251-0/+36
| | | | | | delinearization llvm-svn: 251226
* ScopDetection: Always refuse multi-dimensional memory accesses with 'undef' inTobias Grosser2015-10-251-0/+36
| | | | | | | | | | | the size expression. We previously only checked if the size expression is 'undef', but allowed size expressions of the form 'undef * undef' by accident. After this change we now require size expressions to be affine which implies no 'undef' appears anywhere in the expression. llvm-svn: 251225
* Allow invariant loads in the SCoP descriptionJohannes Doerfert2015-10-073-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows invariant loads to be used in the SCoP description, e.g., as loop bounds, conditions or in memory access functions. First we collect "required invariant loads" during SCoP detection that would otherwise make an expression we care about non-affine. To this end a new level of abstraction was introduced before SCEVValidator::isAffineExpr() namely ScopDetection::isAffine() and ScopDetection::onlyValidRequiredInvariantLoads(). Here we can decide if we want a load inside the region to be optimistically assumed invariant or not. If we do, it will be marked as required and in the SCoP generation we bail if it is actually not invariant. If we don't it will be a non-affine expression as before. At the moment we optimistically assume all "hoistable" (namely non-loop-carried) loads to be invariant. This causes us to expand some SCoPs and dismiss them later but it also allows us to detect a lot we would dismiss directly if we would ask e.g., AliasAnalysis::canBasicBlockModify(). We also allow potential aliases between optimistically assumed invariant loads and other pointers as our runtime alias checks are sound in case the loads are actually invariant. Together with the invariant checks this combination allows to handle a lot more than LICM can. The code generation of the invariant loads had to be extended as we can now have dependences between parameters and invariant (hoisted) loads as well as the other way around, e.g., test/Isl/CodeGen/invariant_load_parameters_cyclic_dependence.ll First, it is important to note that we cannot have real cycles but only dependences from a hoisted load to a parameter and from another parameter to that hoisted load (and so on). To handle such cases we materialize llvm::Values for parameters that are referred by a hoisted load on demand and then materialize the remaining parameters. Second, there are new kinds of dependences between hoisted loads caused by the constraints on their execution. If a hoisted load is conditionally executed it might depend on the value of another hoisted load. To deal with such situations we sort them already in the ScopInfo such that they can be generated in the order they are listed in the Scop::InvariantAccesses list (see compareInvariantAccesses). The dependences between hoisted loads caused by indirect accesses are handled the same way as before. llvm-svn: 249607
* Introduce -polly-process-unprofitableTobias Grosser2015-10-067-9/+9
| | | | | | | | | | This single option replaces -polly-detect-unprofitable and -polly-no-early-exit and is supposed to be the only option that disables compile-time heuristics that aim to bail out early on scops that are believed to not benefit from Polly optimizations. Suggested-by: Johannes Doerfert llvm-svn: 249426
OpenPOWER on IntegriCloud