summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/IRBuilder.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Apply include-what-you-use #include removal suggestions. NFC.Michael Kruse2019-03-281-1/+0
| | | | | | | | | | | | This removes unused includes (and forward declarations) as suggested by include-what-you-use. If a transitive include of a removed include is required to compile a file, I added the required header (or forward declaration if suggested by include-what-you-use). This should reduce compilation time and reduce the number of iterative recompilations when a header was changed. llvm-svn: 357209
* 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
* [CodeGen] Fix potential null pointer dereference. NFC.Michael Kruse2018-07-051-3/+5
| | | | | | | | | | ScalarEvolution::getSCEV dereferences its argument, s.t. passing nullptr leads to undefined behaviour. Check for nullptr before calling it instead of checking its argument afterwards. llvm-svn: 336350
* [CodeGen] Fix noalias annotations for memcpy/memmove.Michael Kruse2017-12-221-0/+6
| | | | | | | | | | | | | | | | Memory transfer instructions take two pointers. It is not defined to which of those a noalias annotation applies. To ensure correctness, do not add noalias annotations to memcpy/memmove instructions anymore. The caused a miscompile with test-suite's MultiSource/Applications/obsequi. Since r321138, the MemCpyOpt pass would remove memcpy/memmove calls if known to copy uninitialized memory. In that case, it was initialized by another memcpy, but the annotation for the target pointer said it would not alias. The annotation was actually meant for the source pointer, which was was an alloca and could not alias with the target pointer. llvm-svn: 321371
* [IRBuilder] Only emit alias scop metadata for arrays, but not scalarsTobias Grosser2017-08-221-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: There is no need to emit alias metadata for scalars, as basicaa will easily distinguish them from arrays. This reduces the size of the metadata we generate. This is especially useful after we moved to -polly-position=before-vectorizer, where a lot more scalar dependences are introduced, which increased the size of the alias analysis metadata and made us commonly reach the limits after which we do not emit alias metadata that have been introduced to prevent quadratic growth of this alias metadata. This improves 2mm performance from 1.5 seconds to 0.17 seconds. Reviewers: Meinersbur, bollu, singam-sanjay Reviewed By: Meinersbur Subscribers: pollydev, llvm-commits Tags: #polly Differential Revision: https://reviews.llvm.org/D37028 llvm-svn: 311498
* Disable the Loop Vectorizer in case of GEMMRoman Gareev2017-08-221-8/+20
| | | | | | | | | | | | | | Currently, in case of GEMM and the pattern matching based optimizations, we use only the SLP Vectorizer out of two LLVM vectorizers. Since the Loop Vectorizer can get in the way of optimal code generation, we disable the Loop Vectorizer for the innermost loop using mark nodes and emitting the corresponding metadata. Reviewed-by: Tobias Grosser <tobias@grosser.es> Differential Revision: https://reviews.llvm.org/D36928 llvm-svn: 311473
* Use SCEV information for the second level aliasingRoman Gareev2017-08-081-8/+10
| | | | | | | | | | | | | | | | | | | | | We introduce another level of alias metadata to distinguish the individual non-aliasing accesses that have inter iteration alias-free base pointers marked with "Inter iteration alias-free" mark nodes. To distinguish two accesses, the comparison of raw pointers representing base pointers is used. In case of, for example, ublas's prod function that implements GEMM, and DeLiCM we can get accesses to same location represented by different raw pointers. Consequently, we create different alias sets that can prevent accesses from, for example, being sinked or hoisted. To avoid the issue, we compare the corresponding SCEV information instead of the corresponding raw pointers. Reviewed-by: Tobias Grosser <tobias@grosser.es> Differential Revision: https://reviews.llvm.org/D35761 llvm-svn: 310380
* [CodeGen] Emit aliasing metadata for new arrays.Michael Kruse2017-06-191-1/+3
| | | | | | | | | | | | Ensure that all array base pointers are assigned before generating aliasing metadata by allocating new arrays beforehand. Before this patch, getBasePtr() returned nullptr for new arrays because the arrays were created at a later point. Nullptr did not match to any array after the created array base pointers have been assigned and when the loads/stores are generated. llvm-svn: 305675
* [PollyIRBuilder] Bound size of alias metadataTobias Grosser2017-04-031-0/+8
| | | | | | | | | | | | No-alias metadata grows quadratic in the size of arrays involved, which can become very costly for large programs. This commit bounds the number of arrays for which we construct no-alias information to ten. This is conservatively correct, as we just provide less information to LLVM and speeds up the compile time of one of my internal test cases from 'does-not-terminate' to 'finishes-in-less-than-a-minute'. In the future we might try to be more clever here, but this change should provide a good baseline. llvm-svn: 299352
* Introduce another level of metadata to distinguish non-aliasing accessesRoman Gareev2017-03-221-5/+56
| | | | | | | | | | | | | | Introduce another level of alias metadata to distinguish the individual non-aliasing accesses that have inter iteration alias-free base pointers marked with "Inter iteration alias-free" mark nodes. It can be used to, for example, distinguish different stores (loads) produced by unrolling of the innermost loops and, subsequently, sink (hoist) them by LICM. Reviewed-by: Tobias Grosser <tobias@grosser.es> Differential Revision: https://reviews.llvm.org/D30606 llvm-svn: 298510
* [IRBuilder] Extract base pointers directly from ScopArrayTobias Grosser2017-02-091-13/+7
| | | | | | | | | | | | | Instead of iterating over statements and their memory accesses to extract the set of available base pointers, just directly iterate over all ScopArray objects. This reflects more the actual intend of the code: collect all arrays (and their base pointers) to emit alias information that specifies that accesses to different arrays cannot alias. This change removes unnecessary uses of MemoryAddress::getBaseAddr() in preparation for https://reviews.llvm.org/D28518. llvm-svn: 294574
* Perform copying to created arrays according to the packing transformationRoman Gareev2016-09-141-1/+2
| | | | | | | | | | | | | | | | This is the fourth patch to apply the BLIS matmul optimization pattern on matmul kernels (http://www.cs.utexas.edu/users/flame/pubs/TOMS-BLIS-Analytical.pdf). BLIS implements gemm as three nested loops around a macro-kernel, plus two packing routines. The macro-kernel is implemented in terms of two additional loops around a micro-kernel. The micro-kernel is a loop around a rank-1 (i.e., outer product) update. In this change we perform copying to created arrays, which is the last step to implement the packing transformation. Reviewed-by: Tobias Grosser <tobias@grosser.es> Differential Revision: https://reviews.llvm.org/D23260 llvm-svn: 281441
* Drop '@brief' from doxygen commentsTobias Grosser2016-09-021-1/+1
| | | | | | | | 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
* Support calls with known ModRef function behaviourJohannes Doerfert2016-02-251-1/+5
| | | | | | | | | 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
* Introduce MemAccInst helper class; NFCMichael Kruse2016-01-271-2/+3
| | | | | | | | | | | | | | | | MemAccInst wraps the common members of LoadInst and StoreInst. Also use of this class in: - ScopInfo::buildMemoryAccess - BlockGenerator::generateLocationAccessed - ScopInfo::addArrayAccess - Scop::buildAliasGroups - Replace every use of polly::getPointerOperand Reviewers: jdoerfert, grosser Differential Revision: http://reviews.llvm.org/D16530 llvm-svn: 258947
* IRBuilder: Use Map.lookup instead of Map.find [NFC]Tobias Grosser2015-10-071-8/+6
| | | | | | | This simplifies the code. Suggested-by: Johannes Doerfert llvm-svn: 249545
* IRBuilder: Ensure we do not add empty map elementsTobias Grosser2015-10-071-4/+14
| | | | | | | | | | | Do not use "Map[Key] == nullptr" to check if a Key is in the map, but use "Map.find(Key) == Map.end()". Map[Key] always adds Key into the map, a side-effect we do not want. Found by inspection. This is hard to test outside of a targetted unit test, which seems too much overhead for this individual issue. llvm-svn: 249544
* IRBuilder: Simplify code and reduce indention [NFC]Tobias Grosser2015-10-071-20/+24
| | | | llvm-svn: 249543
* Generate alias metadata even in OpenMP modeTobias Grosser2015-08-191-2/+10
| | | | | | | | To make alias scope metadata generation work in OpenMP mode we now provide the ScopAnnotator with information about the base pointer rewrite that happens when passing arrays into the OpenMP subfunction. llvm-svn: 245451
* Use value semantics for list of ScopStmt(s) instead of std::owningptrTobias Grosser2015-05-271-2/+2
| | | | | | | | | | | | | | | | David Blaike suggested this as an alternative to the use of owningptr(s) for our memory management, as value semantics allow to avoid the additional interface complexity caused by owningptr while still providing similar memory consistency guarantees. We could also have used a std::vector, but the use of std::vector would yield possibly changing pointers which currently causes problems as for example the memory accesses carry pointers to their parent statements. Such pointers should not change. Reviewer: jblaikie, jdoerfert Differential Revision: http://reviews.llvm.org/D10041 llvm-svn: 238290
* Use unique_ptr to clarify ownership of ScopStmtTobias Grosser2015-05-231-1/+1
| | | | llvm-svn: 238090
* Sort include directivesTobias Grosser2015-05-091-2/+0
| | | | | | | | | | 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
* CodeGen: Update IRBuilder for LLVM API changeDuncan P. N. Exon Smith2015-01-191-3/+2
| | | | | | `MDNode::getTemporary()` returns a `unique_ptr<>` as of r226504. llvm-svn: 226506
* Unbreak after LLVM's metadata split in r223802Tobias Grosser2014-12-091-4/+4
| | | | llvm-svn: 223838
* Stop relying on MDNode::get() returning self-referencesDuncan P. N. Exon Smith2014-12-071-2/+3
| | | | | | | | | | | | | Update for LLVM API change, wherein self-references are not uniqued (and will never be returned by `MDNode::get()`). We already have `Id`; just return it. This should fix the failing buildbot: http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/25167 http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/25168 llvm-svn: 223620
* Safely generate new loop metadata nodeDavid Peixotto2014-11-071-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Polly was accidently modifying a debug info metadata node when attempting to generate a new unique metadata node for the loop id. The problem was that we had dwarf metadata that referred to a metadata node with a null value, like this: !6 = ... some dwarf metadata referring to !7 ... !7 = {null} When we attempt to generate a new metadata node, we reserve the first space for self-referential node by setting the first argument to null and then mutating the node later to refer to itself. However, because the nodes are uniqued based on pointer values, when we get the new metadata node it actually referred to an existing node (!7 in the example). When we went to modify the metadata to point to itself, we were accidently mutating the dwarf metatdata. We ended up in this situation: !6 = ... some dwarf metadata referring to !7 ... !7 = {!7} and this causes an assert when generating the debug info. The fix is simple, we just need to use a unique value when getting a new metadata node. The MDNode::getTemporary() provides exactly the API we need (and it is used in clang to generate the unique nodes). Differential Revision: http://reviews.llvm.org/D6174 llvm-svn: 221550
* [Refactor] Rename LoopAnnotator to ScopAnnotatorJohannes Doerfert2014-10-021-7/+7
| | | | | | | | | The LoopAnnotator doesn't annotate only loops any more, thus it is called ScopAnnotator from now on. This also removes unnecessary polly:: namespace tags. llvm-svn: 218878
* Allow to annotate alias scopes in the new SCoP.Johannes Doerfert2014-10-021-13/+80
| | | | | | | | | The command line flag -polly-annotate-alias-scopes controls whether or not Polly annotates alias scopes in the new SCoP (default ON). This can improve later optimizations as the new SCoP is basically an alias free environment for them. llvm-svn: 218877
* Annotate LLVM-IR for all parallel loopsJohannes Doerfert2014-10-011-25/+43
| | | | | | | | | | | | | | This change allows to annotate all parallel loops with loop id metadata. Furthermore, it will annotate memory instructions with llvm.mem.parallel_loop_access metadata for all surrounding parallel loops. This is especially usefull if an external paralleliser is used. This also removes the PollyLoopInfo class and comments the LoopAnnotator. A test case for multiple parallel loops is attached. llvm-svn: 218793
* Emit llvm.loop metadata for parallel loopsTobias Grosser2014-03-041-0/+60
For now we only mark innermost loops for the loop vectorizer. We could later also mark not-innermost loops to enable the introduction of openmp parallelism. llvm-svn: 202854
OpenPOWER on IntegriCloud