summaryrefslogtreecommitdiffstats
path: root/llvm/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* [ORC] Rename MaterializationResponsibility::delegate to replace and add a newLang Hames2018-07-091-2/+36
| | | | | | | | | | | | | delegate method (and unit test). The name 'replace' better captures what the old delegate method did: it returned materialization responsibility for a set of symbols to the VSO. The new delegate method delegates responsibility for a set of symbols to a new MaterializationResponsibility instance. This can be used to split responsibility between multiple threads, or multiple materialization methods. llvm-svn: 336603
* [VPlan][LV] Introduce condition bit in VPBlockBaseDiego Caballero2018-07-091-1/+3
| | | | | | | | | | | | | | | This patch introduces a VPValue in VPBlockBase to represent the condition bit that is used as successor selector when a block has multiple successors. This information wasn't necessary until now, when we are about to introduce outer loop vectorization support in VPlan code gen. Reviewers: fhahn, rengolin, mkuper, hfinkel, mssimpso Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D48814 llvm-svn: 336554
* [Support] Allow JSON serialization of Optional<T> for supported T.Sam McCall2018-07-091-0/+2
| | | | | | This is ported from r333881 to JSON's new home. llvm-svn: 336542
* [Support] Make JSON handle doubles and int64s losslesslySam McCall2018-07-091-0/+60
| | | | | | | | | | | | | | | | | | | Summary: This patch adds a new "integer" ValueType, and renames Number -> Double. This allows us to preserve the full precision of int64_t when parsing integers from the wire, or constructing from an integer. The API is unchanged, other than giving asInteger() a clearer contract. In addition, always output doubles with enough precision that parsing will reconstruct the same double. Reviewers: simon_tatham Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46209 llvm-svn: 336541
* Lift JSON library from clang-tools-extra/clangd to llvm/Support.Sam McCall2018-07-092-0/+293
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This consists of four main parts: - an type json::Expr representing JSON values of dynamic kind, which can be composed, inspected, and modified - a JSON parser from string -> json::Expr - a JSON printer from json::Expr -> string, with optional pretty-printing - a convention for mapping json::Expr <=> native types (fromJSON/toJSON) Mapping functions are provided for primitives (e.g. int, vector) and the ObjectMapper helper helps implement fromJSON for struct/object types. Based on clangd's usage, a couple of places I'd appreciate review attention: - fromJSON returns only bool. A richer error-signaling mechanism may be useful to provide useful messages, or let recursive fromJSONs (containers/structs) do careful error recovery. - should json::obj be always explicitly written (like json::ary) - there's no streaming parse API. I suspect there are some simple wins like a callback API where the document is a long array, and each element is small. But this can probably be bolted on easily when we see the need. Reviewers: bkramer, labath Subscribers: mgorny, ilya-biryukov, ioeric, MaskRay, llvm-commits Differential Revision: https://reviews.llvm.org/D45753 llvm-svn: 336534
* Test commitChijun Sima2018-07-071-1/+0
| | | | llvm-svn: 336485
* [Support] Clear errno before calling the function in RetryAfterSignal.Chandler Carruth2018-07-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | For certain APIs, the return value of the function does not distinguish between failure (which populates errno) and other non-error conditions (which do not set errno). For example, `fgets` returns `NULL` both when an error has occurred, or upon EOF. If `errno` is already `EINTR` for whatever reason, then ``` RetryAfterSignal(nullptr, fgets, ...); ``` on a stream that has reached EOF would infinite loop. Fix this by setting `errno` to `0` before each attempt in `RetryAfterSignal`. Patch by Ricky Zhou! Differential Revision: https://reviews.llvm.org/D48755 llvm-svn: 336479
* [Local] replaceAllDbgUsesWith: Update debug values before RAUWVedant Kumar2018-07-061-0/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The replaceAllDbgUsesWith utility helps passes preserve debug info when replacing one value with another. This improves upon the existing insertReplacementDbgValues API by: - Updating debug intrinsics in-place, while preventing use-before-def of the replacement value. - Falling back to salvageDebugInfo when a replacement can't be made. - Moving the responsibiliy for rewriting llvm.dbg.* DIExpressions into common utility code. Along with the API change, this teaches replaceAllDbgUsesWith how to create DIExpressions for three basic integer and pointer conversions: - The no-op conversion. Applies when the values have the same width, or have bit-for-bit compatible pointer representations. - Truncation. Applies when the new value is wider than the old one. - Zero/sign extension. Applies when the new value is narrower than the old one. Testing: - check-llvm, check-clang, a stage2 `-g -O3` build of clang, regression/unit testing. - This resolves a number of mis-sized dbg.value diagnostics from Debugify. Differential Revision: https://reviews.llvm.org/D48676 llvm-svn: 336451
* [Support] Make support types more easily printable.Sam McCall2018-07-062-10/+38
| | | | | | | | | | | | | | | Summary: Error's new operator<< is the first way to print an error without consuming it. formatv() can now print objects with an operator<< that works with raw_ostream. Reviewers: bkramer Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D48966 llvm-svn: 336412
* [OpenEmbedded] Add OpenEmbedded vendorMandeep Singh Grang2018-07-051-0/+6
| | | | | | | | | | | | | | | | | | Summary: The lib paths are not correctly picked up for OpenEmbedded sysroots (like arm-oe-linux-gnueabi). I fix this in a follow-up clang patch. But in order to add the correct libs I need to detect if the vendor is oe. For this reason, it is first necessary to teach llvm to detect oe vendor, which is what this patch does. Reviewers: chandlerc, compnerd, rengolin, javed.absar Reviewed By: compnerd Subscribers: kristof.beyls, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D48861 llvm-svn: 336401
* Silence an MSVC C4189 warning about a local variable being initialized but ↵Aaron Ballman2018-07-041-1/+0
| | | | | | not used; NFC. llvm-svn: 336298
* [Dominators] Add DomTreeUpdater constructor from DT* and PDT*Jakub Kuderski2018-07-041-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, if a function accepts an optional DT pointer, ``` void Foo (.., DominatorTree * DT = nullptr) { ... if(DT) DomTreeUpdater(*DT, ...).insertEdge(A, B); if(DT){ DomTreeUpdater DTU(*DT, ...); ... // Construct the update vector and applyUpdates } ... if(DT){ DomTreeUpdater DTU(*DT, ...); ... // Construct the update vector and applyUpdates } } ``` After this patch, it can be simplified as ``` void Foo (.., DominatorTree * DT = nullptr) { DomTreeUpdater DTU(DT, ...); ... DTU.insertEdge(A, B); if(DT){ ... // Construct the update vector and applyUpdates } ... if(DT){ ... // Construct the update vector and applyUpdates } } ``` Patch by Chijun Sima <simachijun@gmail.com>. Reviewers: kuhar, brzycki, dmgreen Reviewed By: kuhar Author: NutshellySima Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48923 llvm-svn: 336294
* [ThinLTO] Update ThinLTO cache file atimes when on WindowsAndrew Ng2018-07-041-0/+32
| | | | | | | | | | | | | | | | | | ThinLTO cache file access times are used for expiration based pruning and since Vista, file access times are not updated by Windows by default: https://blogs.technet.microsoft.com/filecab/2006/11/07/disabling-last-access-time-in-windows-vista-to-improve-ntfs-performance This means on Windows, cache files are currently being pruned from creation time. This change manually updates cache files that are accessed by ThinLTO, when on Windows. Patch by Owen Reynolds. Differential Revision: https://reviews.llvm.org/D47266 llvm-svn: 336276
* [llvm-exegesis] Adjust AArch64 unit testJohn Brawn2018-07-031-4/+19
| | | | | | | The signature of setRegToConstant changed in r336171, so adjust the AArch64 unit test in a similar way to how the X86 unit test was changed in that commit. llvm-svn: 336188
* [llvm-exegesis] Add an AArch64 targetJohn Brawn2018-07-033-0/+62
| | | | | | | | | The target does just enough to be able to run llvm-exegesis in latency mode for at least some opcodes. Differential Revision: https://reviews.llvm.org/D48780 llvm-svn: 336187
* [Support] This sanity check in the test only works with certain versionsChandler Carruth2018-07-031-1/+1
| | | | | | | | | | | of libstdc++, not just certain versions of GCC. The original macros broke when using Clang + libstdc++4.9 sadly. Sadly, testing for versions of libstdc++ has been extremely problematic in the past, so I'm just narrowing this down to Windows and when using libc++ as that seems at least very unlikely to keep build bots broken. llvm-svn: 336174
* [llvm-exegesis] ExegisX86Target::setRegToConstant() should depend on the ↵Clement Courbet2018-07-031-7/+133
| | | | | | | | | | | | | | subtarget features. Summary: This fixes PR38008. Reviewers: gchatelet, RKSimon Subscribers: tschuett, craig.topper, llvm-commits Differential Revision: https://reviews.llvm.org/D48820 llvm-svn: 336171
* Reappl "[Dominators] Add the DomTreeUpdater class"Jakub Kuderski2018-07-032-0/+694
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is the first in a series of patches related to the [[ http://lists.llvm.org/pipermail/llvm-dev/2018-June/123883.html | RFC - A new dominator tree updater for LLVM ]]. This patch introduces the DomTreeUpdater class, which provides a cleaner API to perform updates on available dominator trees (none, only DomTree, only PostDomTree, both) using different update strategies (eagerly or lazily) to simplify the updating process. —Prior to the patch— - Directly calling update functions of DominatorTree updates the data structure eagerly while DeferredDominance does updates lazily. - DeferredDominance class cannot be used when a PostDominatorTree also needs to be updated. - Functions receiving DT/DDT need to branch a lot which is currently necessary. - Functions using both DomTree and PostDomTree need to call the update function separately on both trees. - People need to construct an additional DeferredDominance class to use functions only receiving DDT. —After the patch— Patch by Chijun Sima <simachijun@gmail.com>. Reviewers: kuhar, brzycki, dmgreen, grosser, davide Reviewed By: kuhar, brzycki Author: NutshellySima Subscribers: vsk, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D48383 llvm-svn: 336163
* [Support] Fix llvm::unique_function when building with GCC 4.9 byChandler Carruth2018-07-032-0/+78
| | | | | | | | | | | | | | | | | | | introducing llvm::trivially_{copy,move}_constructible type traits. This uses a completely portable implementation of these traits provided by Richard Smith. You can see it on compiler explorer in all its glory: https://godbolt.org/g/QEDZjW I have transcribed it, clang-formatted it, added some comments, and made the tests fit into a unittest file. I have also switched llvm::unique_function over to use these new, much more portable traits. =D Hopefully this will fix the build bot breakage from my prior commit. llvm-svn: 336161
* [ADT] Add llvm::unique_function which is like std::function butChandler Carruth2018-07-022-0/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | | | supporting move-only closures. Most of the core optimizations for std::function are here plus a potentially novel one that detects trivially movable and destroyable functors and implements those with fewer indirections. This is especially useful as we start trying to add concurrency primitives as those often end up with move-only types (futures, promises, etc) and wanting them to work through lambdas. As further work, we could add better support for things like const-qualified operator()s to support more algorithms, and r-value ref qualified operator()s to model call-once. None of that is here though. We can also provide our own llvm::function that has some of the optimizations used in this class, but with copy semantics instead of move semantics. This is motivated by increasing usage of things like executors and the task queue where it is useful to embed move-only types like a std::promise within a type erased function. That isn't possible without this version of a type erased function. Differential Revision: https://reviews.llvm.org/D48349 llvm-svn: 336156
* Revert "[Dominators] Add the DomTreeUpdater class"Jakub Kuderski2018-07-022-694/+0
| | | | | | | | Temporary revert because of a failing test on some buildbots. This reverts commit r336114. llvm-svn: 336117
* [Dominators] Add the DomTreeUpdater classJakub Kuderski2018-07-022-0/+694
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is the first in a series of patches related to the [[ http://lists.llvm.org/pipermail/llvm-dev/2018-June/123883.html | RFC - A new dominator tree updater for LLVM ]]. This patch introduces the DomTreeUpdater class, which provides a cleaner API to perform updates on available dominator trees (none, only DomTree, only PostDomTree, both) using different update strategies (eagerly or lazily) to simplify the updating process. —Prior to the patch— - Directly calling update functions of DominatorTree updates the data structure eagerly while DeferredDominance does updates lazily. - DeferredDominance class cannot be used when a PostDominatorTree also needs to be updated. - Functions receiving DT/DDT need to branch a lot which is currently necessary. - Functions using both DomTree and PostDomTree need to call the update function separately on both trees. - People need to construct an additional DeferredDominance class to use functions only receiving DDT. —After the patch— Patch by Chijun Sima <simachijun@gmail.com>. Reviewers: kuhar, brzycki, dmgreen, grosser, davide Reviewed By: kuhar, brzycki Subscribers: vsk, mgorny, llvm-commits Author: NutshellySima Differential Revision: https://reviews.llvm.org/D48383 llvm-svn: 336114
* [SupportTests] Silence -Wsign-compare warningsBenjamin Kramer2018-06-281-2/+2
| | | | llvm-svn: 335921
* Fix padding with custom character in formatv.Zachary Turner2018-06-281-0/+62
| | | | | | | | | | | The format string for formatv allows to specify a custom padding character instead of the default space. This custom character was parsed correctly, but not passed on to the formatter. Patch by Marcel Köppe Differential Revision: https://reviews.llvm.org/D48140 llvm-svn: 335915
* Add a flag to FileOutputBuffer that allows modification.Zachary Turner2018-06-281-0/+50
| | | | | | | | | | | | | FileOutputBuffer creates a temp file and on commit atomically renames the temp file to the destination file. Sometimes we want to modify an existing file in place, but still have the atomicity guarantee. To do this we can initialize the contents of the temp file from the destination file (if it exists), that way the resulting FileOutputBuffer can have only selective bytes modified. Committing will then atomically replace the destination file as desired. llvm-svn: 335902
* [PhiValues] Adjust unit test to invalidate instructions before deleting themJohn Brawn2018-06-281-1/+1
| | | | | | This should fix a sanitizer buildbot failure. llvm-svn: 335862
* Add a PhiValuesAnalysis pass to calculate the underlying values of phisJohn Brawn2018-06-282-0/+209
| | | | | | | | | | | | This pass is being added in order to make the information available to BasicAA, which can't do caching of this information itself, but possibly this information may be useful for other passes. Incorporates code based on Daniel Berlin's implementation of Tarjan's algorithm. Differential Revision: https://reviews.llvm.org/D47893 llvm-svn: 335857
* Revert "ADT: Move ArrayRef comparison operators into the class"Pavel Labath2018-06-281-4/+0
| | | | | | This reverts commit r335839, because it breaks the MSVC build. llvm-svn: 335844
* ADT: Move ArrayRef comparison operators into the classPavel Labath2018-06-281-0/+4
| | | | | | | | | | | | | | Summary: This allows the implicit ArrayRef conversions to kick in when e.g. comparing ArrayRef to a SmallVector. Reviewers: zturner, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48632 llvm-svn: 335839
* Move some code from PDBFileBuilder to MSFBuilder.Zachary Turner2018-06-271-8/+8
| | | | | | | | The code to emit the pieces of the MSF file were actually in PDBFileBuilder. Move this to MSFBuilder so that we can theoretically emit an MSF without having a PDB file. llvm-svn: 335789
* [ADT] drop_begin: use adl_begin/adl_end. NFC.Michael Kruse2018-06-271-0/+13
| | | | | | | | | | | | | | | | | | | Summary: The instantiation of the drop_begin function template usually fails because the functions begin() and end() do not exist. Only when using on a container from the std namespace (or `llvm::iterator_range`s of something derived from `std::iterator`), they are matched to std::begin() and std::end() due to Koenig-lookup. Explicitly use llvm::adl_begin and llvm::adl_end to make drop_begin applicable to anything iterable (including C-style arrays). A solution for general `llvm::iterator_range`s was already tried in r244620, but got reverted in r244621 due to MSVC not liking it. Reviewers: dblaikie, grosbach, aaron.ballman, ruiu Reviewed By: dblaikie, aaron.ballman Subscribers: aaron.ballman, llvm-commits Differential Revision: https://reviews.llvm.org/D48598 llvm-svn: 335772
* [ValueLattice] Return false if value range did not change in mergeIn.Florian Hahn2018-06-271-8/+21
| | | | llvm-svn: 335729
* Build TaskQueueTest in threads=on builds, fixes regression from r335608.Nico Weber2018-06-271-0/+2
| | | | llvm-svn: 335724
* [ADT] Pass DerivedT from pointe{e,r}_iterator to iterator_adaptor_baseJustin Bogner2018-06-271-0/+14
| | | | | | | These were passing the wrong type into iterator_adaptor_base if T was anything but the default. llvm-svn: 335698
* Rename skipDebugInfo -> skipDebugIntrinsics, NFCVedant Kumar2018-06-261-1/+1
| | | | | | | | | | | | | This addresses post-commit feedback about the name 'skipDebugInfo' being misleading. This name could be interpreted as meaning 'a function that skips instructions with debug locations'. The new name, 'skipDebugIntrinsics', makes it clear that this function only skips debug info intrinsics. Thanks to Adrian Prantl for pointing this out! llvm-svn: 335667
* [ConstantRange] Add support of mul in makeGuaranteedNoWrapRegion.Tim Shen2018-06-261-0/+99
| | | | | | | | | | | | Summary: This is trying to add support for r334428. Reviewers: sanjoy Subscribers: jlebar, hiraditya, bixia, llvm-commits Differential Revision: https://reviews.llvm.org/D48399 llvm-svn: 335646
* Fix LLVM_ENABLE_THREADS=0 builds after r335440.Nico Weber2018-06-261-1/+2
| | | | llvm-svn: 335608
* [llvm-exegesis] Get the BenchmarkRunner from the ExegesisTarget.Clement Courbet2018-06-262-8/+6
| | | | | | | | | | | | | | | Summary: This allows targets to override code generation for some instructions. As an example of override, this also moves ad-hoc instruction filtering for X86 into the X86 ExegesisTarget. Reviewers: gchatelet Subscribers: mgorny, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48587 llvm-svn: 335582
* [ORC] Add a symbolAliases function to the Core APIs.Lang Hames2018-06-261-0/+29
| | | | | | symbolAliases can be used to define symbol aliases within a VSO. llvm-svn: 335565
* [APInt] Add helpers for rounding u/sdivs.Tim Shen2018-06-251-0/+67
| | | | | | | | | | Reviewers: sanjoy, craig.topper Subscribers: jlebar, hiraditya, bixia, llvm-commits Differential Revision: https://reviews.llvm.org/D48498 llvm-svn: 335557
* Fix unsigned/signed comparison failure in unittest.Eric Christopher2018-06-251-1/+1
| | | | llvm-svn: 335547
* [llvm-exegesis][NFC] Remove unnecessary member variables.Clement Courbet2018-06-251-1/+1
| | | | llvm-svn: 335470
* [llvm-exegesis] Generate snippet setup code.Clement Courbet2018-06-253-8/+104
| | | | | | | | | | | | | | | Summary: This ensures that the snippet always sees the same values for registers, making measurements reproducible. This will also allow exploring different values. Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48542 llvm-svn: 335465
* One more build fix for non MSVC compilers.Zachary Turner2018-06-251-6/+6
| | | | llvm-svn: 335443
* Add a TaskQueue that can serialize work on a ThreadPool.Zachary Turner2018-06-252-0/+106
| | | | | | | | | | | | We have ThreadPool, which can execute work asynchronously on N background threads, but sometimes you need to make sure the work is executed asynchronously but also serially. That is, if task B is enqueued after task A, then task B should not begin until task A has completed. This patch adds such a class. Differential Revision: https://reviews.llvm.org/D48240 llvm-svn: 335440
* [WebAssembly] Add WebAssemblyException information analysisHeejin Ahn2018-06-252-0/+567
| | | | | | | | | | | | | | | | | Summary: A WebAssemblyException object contains BBs that belong to a 'catch' part of the try-catch-end structure. Because CFGSort requires all the BBs within a catch part to be sorted together as it does for loops, this pass calculates the nesting structure of catch part of exceptions in a function. Now this assumes the use of Windows EH instructions. Reviewers: dschuff, majnemer Subscribers: jfb, mgorny, sbc100, jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D44134 llvm-svn: 335439
* [llvm-exegesis] Add mechanism to add target-specific passes.Clement Courbet2018-06-201-1/+2
| | | | | | | | | | | | | | Summary: createX86FloatingPointStackifierPass is disabled until we handle TracksLiveness correctly. Reviewers: gchatelet Subscribers: mgorny, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48360 llvm-svn: 335117
* [llvm-exegesis] Fix failing test.Guillaume Chatelet2018-06-201-2/+4
| | | | | | | | | | Reviewers: courbet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48358 llvm-svn: 335115
* [llvm-exegesis] Use a Prototype to defer picking a value for free vars.Guillaume Chatelet2018-06-201-77/+82
| | | | | | | | | | | | Summary: Introducing a Prototype object to capture Variables that must be set but keeps degrees of freedom as Invalid. This allows exploring non constraint variables later on. Reviewers: courbet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D48316 llvm-svn: 335105
* [PatternMatch] Add m_Store pattern match helperSjoerd Meijer2018-06-201-0/+36
| | | | | | Differential Revision: https://reviews.llvm.org/D48279 llvm-svn: 335100
OpenPOWER on IntegriCloud