summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Polly] Fix formatting violation. NFC.Volodymyr Sapsai2019-10-111-3/+1
| | | | llvm-svn: 374504
* [Stats] Fix polly build due to change in llvm::Statistic constructor in r374490.Volodymyr Sapsai2019-10-111-3/+1
| | | | llvm-svn: 374497
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [ScopDetect] Reject loop with multiple exit blocks.Michael Kruse2018-04-251-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Adjust to clang-format changesTobias Grosser2018-03-201-3/+0
| | | | llvm-svn: 328005
* Run clang-format after r324003. NFC.Michael Kruse2018-02-021-1/+5
| | | | llvm-svn: 324112
* Update polly for r323999.Benjamin Kramer2018-02-011-1/+1
| | | | llvm-svn: 324003
* Rename OptimizationDiagnosticInfo.h to OptimizationRemarkEmitter.hAdam Nemet2017-10-091-1/+1
| | | | | | Polly version of r315249 on LLVM trunk. llvm-svn: 315253
* [Polly] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2017-08-251-17/+30
| | | | | | other minor fixes (NFC). llvm-svn: 311802
* Revert "[polly] Fix ScopDetectionDiagnostic test failure caused by r310940"Tobias Grosser2017-08-241-1/+25
| | | | | | | | This reverts commit 950849ece9bb8fdd2b41e3ec348b9653b4e37df6. This commit broke various buildbots. llvm-svn: 311692
* [polly] Fix ScopDetectionDiagnostic test failure caused by r310940Jakub Kuderski2017-08-221-25/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: ScopDetection used to check if a loop withing a region was infinite and emitted a diagnostic in such cases. After r310940 there's no point checking against that situation, as infinite loops don't appear in regions anymore. The test failure was observed on these two polly buildbots: http://lab.llvm.org:8011/builders/polly-arm-linux/builds/8368 http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/10310 This patch XFAILs `ReportLoopHasNoExit.ll` and turns infinite loop detection into an assert. Reviewers: grosser, sanjoy, bollu Reviewed By: grosser Subscribers: efriedma, aemerson, kristof.beyls, dberlin, llvm-commits Tags: #polly Differential Revision: https://reviews.llvm.org/D36776 llvm-svn: 311503
* [Polly] [OptDiag] Updating Polly Diagnostics RemarksEli Friedman2017-07-171-13/+152
| | | | | | | | | | | | | | | | | Utilizing newer LLVM diagnostic remark API in order to enable use of opt-viewer tool. Polly Diagnostic Remarks also now appear in YAML remark file. In this patch, I've added the OptimizationRemarkEmitter into certain classes where remarks are being emitted and update the remark emit calls itself. I also provide each remark a BasicBlock or Instruction from where it is being called, in order to compute the hotness of the remark. Patch by Tarun Rajendran! Differential Revision: https://reviews.llvm.org/D35399 llvm-svn: 308233
* [ScopDetection] If a loop is not part of a scop, none of it backedges can beTobias Grosser2017-07-151-0/+20
| | | | | | | | | | | | | | | | | | This patch makes sure that in case a loop is not fully contained within a region that later forms a SCoP, none of the loop backedges are allowed to be part of the region. We currently do not support the situation where only some of a loops backedges are part of a scop. Today, this can break both scop modeling and code generation. One such breaking test case is for example test/ScopDetectionDiagnostics/loop_partially_in_scop-2.ll, where we totally forgot to code generate some of the backedges. Fortunately, it is commonly not necessary to support these partial loops, it is way more common that either no backedge is included in a region or all loop backedge are included. This fixes a recent miscompile in MultiSource/Benchmarks/MiBench/consumer-typeset which was exposed after r306477. llvm-svn: 308113
* [ScopDetection] Do not detect scops that exit to an unreachableTobias Grosser2017-03-071-0/+19
| | | | | | | | | | | | | | | Scops that exit with an unreachable are today still permitted, but make little sense to optimize. We therefore can already skip them during scop detection. This speeds up scop detection in certain cases and also ensures that bugpoint does not introduce unreachables when reducing test cases. In practice this change should have little impact, as the performance of unreachable code is unlikely to matter. This commit is part of a series that makes Polly more robust in the presence of unreachables. llvm-svn: 297151
* [ScopDetectDiagnostics] Do not format unnamed array namesTobias Grosser2017-02-121-1/+1
| | | | | | | | | | | | | Formatting unnamed array names is expensive in LLVM as the this requires deriving the numbered virtual instruction name (e.g., %12) for an llvm::Value, which is currently not implemented efficiently. As instruction numberes anyhow do not really carry a lot of information for the user, we just print 'unknown' instead. This change reduces the scop detection time from 24 to 19 seconds, for one of our large-scale inputs. This is a reduction by 21%. llvm-svn: 294894
* [ScopDetectionDiagnostic] Add meaningfull enduser message for regions with ↵Tobias Grosser2017-01-261-0/+4
| | | | | | | | | | | entry block Before this change the user only saw "Unspecified Error", when a region contained the entry block. Now we report: "Scop contains function entry (not yet supported)." llvm-svn: 293169
* ScopDetectionDiagnostics: Also emit diagnostics in case no debug info is ↵Tobias Grosser2017-01-261-0/+3
| | | | | | | | available In this case, we just use the start of the scop as the debug location. llvm-svn: 293165
* Adjust formatting to commit r292110 [NFC]Tobias Grosser2017-01-161-4/+5
| | | | llvm-svn: 292123
* Fix format after recent clang-format change.Daniel Jasper2016-12-191-5/+8
| | | | llvm-svn: 290085
* Adjust clang-format formatting to r289531Tobias Grosser2016-12-131-4/+4
| | | | | | | clang-format has been updated in r289531 to keep labels and values on the same line. This change updates Polly to the new formatting style. llvm-svn: 289533
* [ScopDetectionDiagnostic] Collect statistics for each diagnostic typeTobias Grosser2016-11-261-26/+40
| | | | | | | | | | | Our original statistics were added before we introduced a more fine-grained diagnostic system, but the granularity of our statistics has never been increased accordingly. This change introduces now one statistic counter per diagnostic to enable us to collect fine-grained statistics about who certain scops are not detected. In case coarser grained statistics are needed, the user is expected to combine counters manually. llvm-svn: 287968
* [ScopDectionDiagnostic] Use scoped enums instead three letter prefix [NFC]Tobias Grosser2016-11-261-33/+37
| | | | | | This improves readability of the code. llvm-svn: 287963
* [ScopDetection] Remove redundant checks for endless loopsTobias Grosser2016-09-201-20/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Both `canUseISLTripCount()` and `addOverApproximatedRegion()` contained checks to reject endless loops which are now removed and replaced by a single check in `isValidLoop()`. For reporting such loops the `ReportLoopOverlapWithNonAffineSubRegion` is renamed to `ReportLoopHasNoExit`. The test case `ReportLoopOverlapWithNonAffineSubRegion.ll` is adapted and renamed as well. The schedule generation in `buildSchedule()` is based on the following assumption: Given some block B that is contained in a loop L and a SESE region R, we assume that L is contained in R or the other way around. However, this assumption is broken in the presence of endless loops that are nested inside other loops. Therefore, in order to prevent erroneous behavior in `buildSchedule()`, r265280 introduced a corresponding check in `canUseISLTripCount()` to reject endless loops. Unfortunately, it was possible to bypass this check with -polly-allow-nonaffine-loops which was fixed by adding another check to reject endless loops in `allowOverApproximatedRegion()` in r273905. Hence there existed two separate locations that handled this case. Thank you Johannes Doerfert for helping to provide the above background information. Reviewers: Meinersbur, grosser Subscribers: _jdoerfert, pollydev Differential Revision: https://reviews.llvm.org/D24560 Contributed-by: Matthias Reisinger <d412vv1n@gmail.com> llvm-svn: 281987
* Drop '@brief' from doxygen commentsTobias Grosser2016-09-021-2/+2
| | | | | | | | LLVM's coding guideline suggests to not use @brief for one-sentence doxygen comments to improve readability. Switch this once and for all to ensure people do not copy @brief comments from other parts of Polly, when writing new code. llvm-svn: 280468
* Fix assertion due to loop overlap with nonaffine region.Michael Kruse2016-06-271-0/+29
| | | | | | | | | | | | Reject and report regions that contains loops overlapping nonaffine region. This situation typically happens in the presence of inifinite loops. This addresses bug llvm.org/PR28071. Differential Revision: http://reviews.llvm.org/D21312 Contributed-by: Huihui Zhang <huihuiz@codeaurora.org> llvm-svn: 273905
* clang-tidy: Add llvm namespace commentsTobias Grosser2016-06-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | llvm commonly adds a comment to the closing brace of a namespace to indicate which namespace is closed. clang-tidy provides with llvm-namespace-comment a handy tool to check for this habit. We use it to ensure we consitently use namespace comments in Polly. There are slightly different styles in how namespaces are closed in LLVM. As there is no large difference between the different comment styles we go for the style clang-tidy suggests by default. To reproduce this fix run: for i in `ls tools/polly/lib/*/*.cpp`; \ clang-tidy -checks='-*,llvm-namespace-comment' -p build $i -fix \ -header-filter=".*"; \ done This cleanup was suggested by Eugene Zelenko <eugene.zelenko@gmail.com> in http://reviews.llvm.org/D21488 and was split out to increase readability. llvm-svn: 273621
* Cleanup rejection log handling [NFC]Johannes Doerfert2016-05-121-6/+21
| | | | | | | | | | | | This patch cleans up the rejection log handling during the ScopDetection. It consists of two interconnected parts: - We keep all detection contexts for a function in order to provide more information to the user, e.g., about the rejection of extended/intermediate regions. - We remove the mutable "RejectLogs" member as the information is available through the detection contexts. llvm-svn: 269323
* Allow unsigned comparisonsJohannes Doerfert2016-04-261-16/+0
| | | | | | | | With this patch we will optimistically assume that the result of an unsigned comparison is the same as the result of the same comparison interpreted as signed. llvm-svn: 267559
* Make memory accesses with different element types optionalTobias Grosser2016-02-071-0/+18
| | | | | | | | We also disable this feature by default, as there are still some issues in combination with invariant load hoisting that slipped through my initial testing. llvm-svn: 260025
* Support accesses with differently sized types to the same arrayTobias Grosser2016-02-041-18/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows code such as: void multiple_types(char *Short, char *Float, char *Double) { for (long i = 0; i < 100; i++) { Short[i] = *(short *)&Short[2 * i]; Float[i] = *(float *)&Float[4 * i]; Double[i] = *(double *)&Double[8 * i]; } } To model such code we use as canonical element type of the modeled array the smallest element type of all original array accesses, if type allocation sizes are multiples of each other. Otherwise, we use a newly created iN type, where N is the gcd of the allocation size of the types used in the accesses to this array. Accesses with types larger as the canonical element type are modeled as multiple accesses with the smaller type. For example the second load access is modeled as: { Stmt_bb2[i0] -> MemRef_Float[o0] : 4i0 <= o0 <= 3 + 4i0 } To support code-generating these memory accesses, we introduce a new method getAccessAddressFunction that assigns each statement instance a single memory location, the address we load from/store to. Currently we obtain this address by taking the lexmin of the access function. We may consider keeping track of the memory location more explicitly in the future. We currently do _not_ handle multi-dimensional arrays and also keep the restriction of not supporting accesses where the offset expression is not a multiple of the access element type size. This patch adds tests that ensure we correctly invalidate a scop in case these accesses are found. Both types of accesses can be handled using the very same model, but are left to be added in the future. We also move the initialization of the scop-context into the constructor to ensure it is already available when invalidating the scop. Finally, we add this as a new item to the 2.9 release notes Reviewers: jdoerfert, Meinersbur Differential Revision: http://reviews.llvm.org/D16878 llvm-svn: 259784
* Revert "Support loads with differently sized types from a single array"Tobias Grosser2016-02-031-0/+18
| | | | | | This reverts commit (@259587). It needs some further discussions. llvm-svn: 259629
* Support loads with differently sized types from a single arrayTobias Grosser2016-02-021-18/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We support now code such as: void multiple_types(char *Short, char *Float, char *Double) { for (long i = 0; i < 100; i++) { Short[i] = *(short *)&Short[2 * i]; Float[i] = *(float *)&Float[4 * i]; Double[i] = *(double *)&Double[8 * i]; } } To support such code we use as element type of the modeled array the smallest element type of all original array accesses. Accesses with larger types are modeled as multiple accesses with the smaller type. For example the second load access is modeled as: { Stmt_bb2[i0] -> MemRef_Float[o0] : 4i0 <= o0 <= 3 + 4i0 } To support jscop-rewritable memory accesses we need each statement instance to only be assigned a single memory location, which will be the address at which we load the value. Currently we obtain this address by taking the lexmin of the access function. We may consider keeping track of the memory location more explicitly in the future. llvm-svn: 259587
* ScopDetection: Do not detect regions with irreducible control as scopsTobias Grosser2016-01-221-0/+17
| | | | | | | | | | | | | | Polly currently does not support irreducible control and it is probably not worth supporting. This patch adds code that checks for irreducible control and refuses regions containing irreducible control. Polly traditionally had rather restrictive checks on the control flow structure which would have refused irregular control, but within the last couple of months most of the control flow restrictions have been removed. As part of this generalization we accidentally allowed irregular control flow. Contributed-by: Karthik Senthil and Ajith Pandel llvm-svn: 258497
* Do not enforce lcssaJohannes Doerfert2015-11-211-16/+0
| | | | | | | | 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
* Emit SCoP source location as remark during ScopInfoJohannes Doerfert2015-11-121-12/+1
| | | | | | | This removes a similar feature from ScopDetection, though with -polly-report that feature present twice anyway. llvm-svn: 252846
* ScopDetect: Bail out for non-simple memory accessesTobias Grosser2015-10-251-0/+23
| | | | | | | | | | | | | 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
* Allow switch instructions in SCoPsJohannes Doerfert2015-09-281-6/+6
| | | | | | | | | | | | | | | This patch allows switch instructions with affine conditions in the SCoP. Also switch instructions in non-affine subregions are allowed. Both did not require much changes to the code, though there was some refactoring needed to integrate them without code duplication. In the llvm-test suite the number of profitable SCoPs increased from 135 to 139 but more importantly we can handle more benchmarks and user inputs without preprocessing. Differential Revision: http://reviews.llvm.org/D13200 llvm-svn: 248701
* Remove obsolete checkJohannes Doerfert2015-09-281-21/+0
| | | | | | | | This check was needed at some point but seems not useful anymore. Only one adjustment in the domain generation was needed to cope with the cases this check prevented from happening before. llvm-svn: 248695
* [NFC] Remove unused SCoP diagnosticJohannes Doerfert2015-09-281-44/+0
| | | | llvm-svn: 248694
* [NFC] Remove obsolete diagnostic for unstructured control flowJohannes Doerfert2015-09-201-15/+0
| | | | llvm-svn: 248118
* Add diagnostic for unsigned integer comparisionsTobias Grosser2015-05-201-0/+16
| | | | llvm-svn: 237800
* Sort include directivesTobias Grosser2015-05-091-6/+4
| | | | | | | | | | Upcoming revisions of isl require us to include header files explicitly, which have previously been already transitively included. Before we add them, we sort the existing includes. Thanks to Chandler for sort_includes.py. A simple, but very convenient script. llvm-svn: 236930
* Adding debug location information to Polly's JSCOP and dot exportsTobias Grosser2015-05-031-23/+1
| | | | | | | | | | | | | | | | | | | | This change adds location information for the detected regions in Polly when the required debug information is available. The JSCOP output format is extended with a "location" field which contains the information in the format "source.c:start-end" The dot output is extended to contain the location information for each nested region in the analyzed function. As part of this change, the existing getDebugLocation function has been moved into lib/Support/ScopLocation.cpp to avoid having to include polly/ScopDetectionDiagnostics.h. Differential Revision: http://reviews.llvm.org/D9431 Contributed-by: Roal Jordans <r.jordans@tue.nl> llvm-svn: 236393
* Update polly for LLVM rename of debug info metadata with DI* prefixDuncan P. N. Exon Smith2015-04-291-1/+1
| | | | | | | Ran the same rename-md-di-prefix.sh script attached to PR23080 as in LLVM r236120 and CFE r236121. llvm-svn: 236127
* Fix polly build after LLVM r235327Duncan P. N. Exon Smith2015-04-201-1/+1
| | | | llvm-svn: 235343
* [opaque pointer types] Explicit non-pointer type for call expressionsDavid Blaikie2015-04-161-1/+1
| | | | | | (migration for recent LLVM change to textual IR for calls) llvm-svn: 235146
* Fix polly build after LLVM r234263Duncan P. N. Exon Smith2015-04-071-1/+1
| | | | llvm-svn: 234266
* DebugInfo: Use the new DebugLoc API from r233573Duncan P. N. Exon Smith2015-03-301-11/+8
| | | | | | | | This should fix the build [1] after r233599 removed the old API. [1]: http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3-polly-parallel-fast/builds/5265 llvm-svn: 233605
* Shorten user report message slightlyTobias Grosser2015-03-091-2/+1
| | | | llvm-svn: 231633
* Add end user report message for unprofitable regions [NFC]Johannes Doerfert2015-03-081-1/+18
| | | | llvm-svn: 231593
OpenPOWER on IntegriCloud