summaryrefslogtreecommitdiffstats
path: root/llvm/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r305642Ismail Donmez2017-06-181-1/+1
| | | | llvm-svn: 305643
* Test to correct triple for SUSE on ARMv7Ismail Donmez2017-06-181-1/+1
| | | | llvm-svn: 305642
* [CodeView] Fix random access of type names.Zachary Turner2017-06-161-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose we had a type index offsets array with a boundary at type index N. Then you request the name of the type with index N+1, and that name requires the name of index N-1 (think a parameter list, for example). We didn't handle this, and we would print something like (<unknown UDT>, <unknown UDT>). The fix for this is not entirely trivial, and speaks to a larger problem. I think we need to kill TypeDatabase, or at the very least kill TypeDatabaseVisitor. We need a thing that doesn't do any caching whatsoever, just given a type index it can compute the type name "the slow way". The reason for the bug is that we don't have anything like that. Everything goes through the type database, and if we've visited a record, then we're "done". It doesn't know how to do the expensive thing of re-visiting dependent records if they've not yet been visited. What I've done here is more or less copied the code (albeit greatly simplified) from TypeDatabaseVisitor, but wrapped it in an interface that just returns a std::string. The logic of caching the name is now in LazyRandomTypeCollection. Eventually I'd like to move the record database here as well and the visited record bitfield here as well, at which point we can actually just delete TypeDatabase. I don't see any reason for it if a "sequential" collection is just a special case of a random access collection with an empty partial offsets array. Differential Revision: https://reviews.llvm.org/D34297 llvm-svn: 305612
* UnitTests: Followup to 305519Matthias Braun2017-06-152-6/+6
| | | | | | | We have to use ASSERT_XXX instead of EXPECT_XXX if the test cannot continue in the failure case. llvm-svn: 305522
* UnitTests: Replace some if(x)report_fatal_error() with EXPECT_TRUE(!x)Matthias Braun2017-06-152-12/+6
| | | | llvm-svn: 305519
* Added braces to work around gcc warning in googletest: suggest explicit ↵Galina Kistanova2017-06-155-11/+22
| | | | | | braces to avoid ambiguous 'else'. NFC. llvm-svn: 305506
* [formatv] Add the ability to specify a fill character when aligning.Zachary Turner2017-06-151-0/+2
| | | | | | | | | Previously if you used fmt_align(7, Center) you would get the output ' 7 '. It may be desirable for the user to specify the fill character though, for example producing '---7---'. This patch adds that. llvm-svn: 305449
* Don't include TestingSupport in LLVM_LINK_COMPONENTS.Zachary Turner2017-06-143-4/+5
| | | | | | | | Instead use target_link_libraries directly. Thanks to Juergen Ributzka for the suggestion, which fixes an issue when llvm is configured with no targets. llvm-svn: 305421
* Supressed warning: declared ‘static’ but never defined.Galina Kistanova2017-06-141-0/+11
| | | | llvm-svn: 305403
* [gtest] Create a shared include directory for gtest utilities.Zachary Turner2017-06-1413-373/+248
| | | | | | | | | | | | | | | | | | | | | | | Many times unit tests for different libraries would like to use the same helper functions for checking common types of errors. This patch adds a common library with helpers for testing things in Support, and introduces helpers in here for integrating the llvm::Error and llvm::Expected<T> classes with gtest and gmock. Normally, we would just be able to write: EXPECT_THAT(someFunction(), succeeded()); but due to some quirks in llvm::Error's move semantics, gmock doesn't make this easy, so two macros EXPECT_THAT_ERROR() and EXPECT_THAT_EXPECTED() are introduced to gloss over the difficulties. Consider this an exception, and possibly only temporary as we look for ways to improve this. Differential Revision: https://reviews.llvm.org/D33059 llvm-svn: 305395
* Align definition of DW_OP_plus with DWARF spec [3/3]Florian Hahn2017-06-141-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is part of 3 patches that together form a single patch, but must be introduced in stages in order not to break things. The way that LLVM interprets DW_OP_plus in DIExpression nodes is basically that of the DW_OP_plus_uconst operator since LLVM expects an unsigned constant operand. This unnecessarily restricts the DW_OP_plus operator, preventing it from being used to describe the evaluation of runtime values on the expression stack. These patches try to align the semantics of DW_OP_plus and DW_OP_minus with that of the DWARF definition, which pops two elements off the expression stack, performs the operation and pushes the result back on the stack. This is done in three stages: • The first patch (LLVM) adds support for DW_OP_plus_uconst. • The second patch (Clang) contains changes all its uses from DW_OP_plus to DW_OP_plus_uconst. • The third patch (LLVM) changes the semantics of DW_OP_plus and DW_OP_minus to be in line with its DWARF meaning. This patch includes the bitcode upgrade from legacy DIExpressions. Patch by Sander de Smalen. Reviewers: echristo, pcc, aprantl Reviewed By: aprantl Subscribers: fhahn, javed.absar, aprantl, llvm-commits Differential Revision: https://reviews.llvm.org/D33894 llvm-svn: 305386
* Revert r305313 & r305303, self-hosting build-bot isn’t liking it.Frederich Munch2017-06-133-39/+3
| | | | llvm-svn: 305318
* Fix self hosting build-bot failure from r305303 by adjusting ↵Frederich Munch2017-06-131-0/+1
| | | | | | DynamicLibraryTests compile flags. llvm-svn: 305313
* Fix m_[Ord|Unord][FMin|FMax] matchers to correctly match ordering.Craig Topper2017-06-131-16/+61
| | | | | | | | | | | Previously, the matching was done incorrectly for the case where operands for FCmpInst and SelectInst were in opposite order. Patch by Andrei Elovikov. Differential Revision: https://reviews.llvm.org/D33185 llvm-svn: 305308
* Align definition of DW_OP_plus with DWARF spec [1/3]Florian Hahn2017-06-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch is part of 3 patches that together form a single patch, but must be introduced in stages in order not to break things. The way that LLVM interprets DW_OP_plus in DIExpression nodes is basically that of the DW_OP_plus_uconst operator since LLVM expects an unsigned constant operand. This unnecessarily restricts the DW_OP_plus operator, preventing it from being used to describe the evaluation of runtime values on the expression stack. These patches try to align the semantics of DW_OP_plus and DW_OP_minus with that of the DWARF definition, which pops two elements off the expression stack, performs the operation and pushes the result back on the stack. This is done in three stages: • The first patch (LLVM) adds support for DW_OP_plus_uconst. • The second patch (Clang) contains changes all its uses from DW_OP_plus to DW_OP_plus_uconst. • The third patch (LLVM) changes the semantics of DW_OP_plus and DW_OP_minus to be in line with its DWARF meaning. This patch includes the bitcode upgrade from legacy DIExpressions. Patch by Sander de Smalen. Reviewers: pcc, echristo, aprantl Reviewed By: aprantl Subscribers: fhahn, aprantl, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D33892 llvm-svn: 305304
* Force RegisterStandardPasses to construct std::function in the IPO library.Frederich Munch2017-06-133-3/+38
| | | | | | | | | | | | | | Summary: Fixes an issue using RegisterStandardPasses from a statically linked object before PassManagerBuilder::addGlobalExtension is called from a dynamic library. Reviewers: efriedma, theraven Reviewed By: efriedma Subscribers: mehdi_amini, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D33515 llvm-svn: 305303
* [ADT] Don't use __used__ attribute on struct members in unit testFrancis Ricci2017-06-121-10/+10
| | | | | | | On some compilers, __used__ can only be applied to variables or functions. llvm-svn: 305188
* Export the required symbol from DynamicLibraryTestsRoger Ferrer Ibanez2017-06-125-4/+23
| | | | | | | | | | | | | | | | | Running unittests/Support/DynamicLibrary/DynamicLibraryTests fails when LLVM is configured with -DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON, because the test's version script only contains symbols extracted from the static libraries, that the test links with, but not those from the main object/executable itself. The patch moves the one symbol, needed by the test, to a static library. Fixes https://bugs.llvm.org/show_bug.cgi?id=32893 Patch by Momchil Velikov. Differential Revision: https://reviews.llvm.org/D33789 llvm-svn: 305181
* [ADT] Use LLVM_ATTRIBUTE_USED instead of __attribute__ for unit testFrancis Ricci2017-06-111-5/+5
| | | | llvm-svn: 305168
* [ADT] Suppress unused attribute warning in unit testFrancis Ricci2017-06-111-5/+5
| | | | llvm-svn: 305166
* [SmallVector] Reinstate the typedefs.Davide Italiano2017-06-101-0/+3
| | | | | | | | | They're unused with recent versions of libstdc++ but older ones (e.g. libstdc++ 4.9 still requires them). Maybe we should bump the requirements on the minimum version to make GCC 7 happy, but in the meanwhile we need to live with the warning. llvm-svn: 305158
* [SmallVector] Remove unused typedefs, spotted by GCC 7. NFCI.Davide Italiano2017-06-101-3/+0
| | | | llvm-svn: 305157
* [ADT] Make iterable SmallVector template overrides more specificFrancis Ricci2017-06-091-0/+61
| | | | | | | | | | | | | | | | Summary: This prevents the iterator overrides from being selected in the case where non-iterator types are used as arguments, which is of particular importance in cases where other overrides with identical types exist. Reviewers: dblaikie, bkramer, rafael Subscribers: llvm-commits, efriedma Differential Revision: https://reviews.llvm.org/D33919 llvm-svn: 305105
* Allow VarStreamArray to use stateful extractors.Zachary Turner2017-06-091-5/+4
| | | | | | | | | | | Previously extractors tried to be stateless with any additional context information needed in order to parse items being passed in via the extraction method. This led to quite cumbersome implementation challenges and awkwardness of use. This patch brings back support for stateful extractors, making the implementation and usage simpler. llvm-svn: 305093
* GlobalsModRef: Ensure optnone+readonly/readnone attributes are respectedDavid Blaikie2017-06-071-5/+19
| | | | llvm-svn: 304945
* [mssa] Fix case when there is no definition in a block prior to an inserted use.Alina Sbirlea2017-06-071-0/+46
| | | | | | | | | | | | | | | Summary: Check that the first access before one being tested is valid. Before this patch, if there was no definition prior to the Use being tested, the first time Iter was deferenced, it hit the sentinel. Reviewers: dberlin, gbiv Subscribers: sanjoy, Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D33950 llvm-svn: 304926
* Disable all warning for AlignOfTest.cpp.Galina Kistanova2017-06-071-0/+5
| | | | llvm-svn: 304871
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-0711-88/+147
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* GlobalsModRef+OptNone: Don't prove readnone/other properties from an optnone ↵David Blaikie2017-06-062-0/+42
| | | | | | | | | | | | | | | | | | | | function Seems like at least one reasonable interpretation of optnone is that the optimizer never "looks inside" a function. This fix is consistent with that interpretation. Specifically this came up in the situation: f3 calls f2 calls f1 f2 is always_inline f1 is optnone The application of readnone to f1 (& thus to f2) caused the inliner to kill the call to f2 as being trivially dead (without even checking the cost function, as it happens - not sure if that's also a bug). llvm-svn: 304833
* UnitTests: Do not use assert() for error checkingMatthias Braun2017-06-062-7/+12
| | | | | | | | | Use `if (!X) report_fatal_error()` instead of `assert()` for the ad-hoc error handling in two unittests. This reduces unnecessary differences between release and debug builds (motivated by unused variable warnings triggered in release builds). llvm-svn: 304814
* Re-sort #include lines for unittests. This uses a slightly modifiedChandler Carruth2017-06-0694-106/+104
| | | | | | | | | | | | | | | clang-format (https://reviews.llvm.org/D33932) to keep primary headers at the top and handle new utility headers like 'gmock' consistently with other utility headers. No other change was made. I did no manual edits, all of this is clang-format. This should allow other changes to have more clear and focused diffs, and is especially motivated by moving some headers into more focused libraries. llvm-svn: 304786
* Fix an unused variable warning in non-asserts builds.Chandler Carruth2017-06-061-0/+1
| | | | llvm-svn: 304778
* Add a dominanance check interface that uses caching for instructions within ↵Xin Tong2017-06-062-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | same basic block. Summary: This problem stems from the fact that instructions are allocated using new in LLVM, i.e. there is no relationship that can be derived by just looking at the pointer value. This interface dispatches to appropriate dominance check given 2 instructions, i.e. in case the instructions are in the same basic block, ordered basicblock (with instruction numbering and caching) are used. Otherwise, dominator tree is used. This is a preparation patch for https://reviews.llvm.org/D32720 Reviewers: dberlin, hfinkel, davide Subscribers: davide, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D33380 llvm-svn: 304764
* CodeGen: Refactor MIR parsingMatthias Braun2017-06-062-11/+10
| | | | | | | | | | | | When parsing .mir files immediately construct the MachineFunctions and put them into MachineModuleInfo. This allows us to get rid of the delayed construction (and delayed error reporting) through the MachineFunctionInitialzier interface. Differential Revision: https://reviews.llvm.org/D33809 llvm-svn: 304758
* Handle non-unique edges in edge-dominanceAdam Nemet2017-06-051-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | This removes a quadratic behavior in assert-enabled builds. GVN propagates the equivalence from a condition into the blocks guarded by the condition. E.g. for 'if (a == 7) { ... }', 'a' will be replaced in the block with 7. It does this by replacing all the uses of 'a' that are dominated by the true edge. For a switch with N cases and U uses of the value, this will mean N * U calls to 'dominates'. Asserting isSingleEdge in 'dominates' make this N^2 * U because this function checks for the uniqueness of the edge. I.e. traverses each edge between the SwitchInst's block and the cases. The change removes the assert and makes 'dominates' works correctly in the presence of non-unique edges. This brings build time down by an order of magnitude for an input that has ~10k cases in a switch statement. Differential Revision: https://reviews.llvm.org/D33584 llvm-svn: 304721
* Close DynamicLibraries in reverse order they were opened.Frederich Munch2017-06-054-35/+88
| | | | | | | | | | | | | | Summary: Matches C++ destruction ordering better and fixes possible problems of loaded libraries having inter-dependencies. Reviewers: efriedma, v.g.vassilev, chapuni Reviewed By: efriedma Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D33652 llvm-svn: 304720
* [ConstantRange] Add another truncate unittest for wrapped set staying a ↵Craig Topper2017-06-041-0/+4
| | | | | | wrapped set. llvm-svn: 304695
* [ConstantRange] Add a few more truncate unittests.Craig Topper2017-06-041-0/+12
| | | | llvm-svn: 304694
* [ConstantRange] Add missing result check to the ConstantRange::truncate test.Craig Topper2017-06-041-0/+1
| | | | llvm-svn: 304693
* Fixed warning: must specify at least one argument for '...' parameter.Galina Kistanova2017-06-041-1/+1
| | | | llvm-svn: 304677
* Fixed warning: must specify at least one argument for '...' parameter.Galina Kistanova2017-06-042-2/+2
| | | | llvm-svn: 304676
* ADT: handle special case of ARM environment for SUSESaleem Abdulrasool2017-06-031-0/+5
| | | | | | | SUSE treats "gnueabi" as "gnueabihf" so make sure that we normalise the environment. llvm-svn: 304670
* [PDB] Fix use after free.Zachary Turner2017-06-031-35/+70
| | | | | | | | | | | | | | | | | | | | | | | Previously MappedBlockStream owned its own BumpPtrAllocator that it would allocate from when a read crossed a block boundary. This way it could still return the user a contiguous buffer of the requested size. However, It's not uncommon to open a stream, read some stuff, close it, and then save the information for later. After all, since the entire file is mapped into memory, the data should always be available as long as the file is open. Of course, the exception to this is when the data isn't *in* the file, but rather in some buffer that we temporarily allocated to present this contiguous view. And this buffer would get destroyed as soon as the strema was closed. The fix here is to force the user to specify the allocator, this way it can provide an allocator that has whatever lifetime it chooses. Differential Revision: https://reviews.llvm.org/D33858 llvm-svn: 304623
* Tidy up a bit of r304516, use SmallVector::assign rather than for loopDavid Blaikie2017-06-021-0/+10
| | | | | | | | | | | | | | | | This might give a few better opportunities to optimize these to memcpy rather than loops - also a few minor cleanups (StringRef-izing, templating (to avoid std::function indirection), etc). The SmallVector::assign(iter, iter) could be improved with the use of SFINAE, but the (iter, iter) ctor and append(iter, iter) need it to and don't have it - so, workaround it for now rather than bothering with the added complexity. (also, as noted in the added FIXME, these assign ops could potentially be optimized better at least for non-trivially-copyable types) llvm-svn: 304566
* [OrderedBasicBlock] Return false for comesBefore(A, A)Benjamin Kramer2017-06-022-2/+61
| | | | | | | So far it would return true for the first uncached query, then cached queries return false. llvm-svn: 304545
* Reapply "[Cloning] Take another pass at properly cloning debug info"Keno Fischer2017-06-011-1/+1
| | | | | | | | This was rL304226, reverted in 304228 due to a clang assertion failure on the build bots. That problem should have been addressed by clang commit rL304470. llvm-svn: 304488
* Make mcpu=generic the default for armv7-a and armv8-a.Kristof Beyls2017-06-011-2/+2
| | | | | | | As discussed in http://lists.llvm.org/pipermail/llvm-dev/2017-May/113525.html llvm-svn: 304390
* Avoid a UB pointer overflow in the ArrayRef unit testVedant Kumar2017-05-311-15/+15
| | | | | | | | | | | | The intent of the test is to check that array lengths greater than UINT_MAX work properly. Change the test to stress that scenario, without triggering pointer overflow UB. Caught by a WIP pointer overflow checker in clang. Differential Revision: https://reviews.llvm.org/D33149 llvm-svn: 304353
* Fix assertion when merging multiple empty AttributeListsReid Kleckner2017-05-311-0/+7
| | | | | | | | Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D33627 llvm-svn: 304300
* Revert "[Cloning] Take another pass at properly cloning debug info"Keno Fischer2017-05-301-1/+1
| | | | | | At least one build bot is complaining. Will investigate after lunch. llvm-svn: 304228
OpenPOWER on IntegriCloud