summaryrefslogtreecommitdiffstats
path: root/llvm/unittests
Commit message (Collapse)AuthorAgeFilesLines
...
* [Error] Reintroduce type validation in createFileError()Alexandre Ganea2018-09-071-0/+3
| | | | | | | | This prevents from using ErrorSuccess as an argument to createFileError(). Differential Revision: https://reviews.llvm.org/D51490 llvm-svn: 341689
* Revert "[XRay] Add a BlockVerifier visitor for FDR Records"Dean Michael Berris2018-09-072-141/+0
| | | | | | This reverts commit r341628. llvm-svn: 341631
* [XRay] Add a BlockVerifier visitor for FDR RecordsDean Michael Berris2018-09-072-0/+141
| | | | | | | | | | | | | | | | | | | Summary: This patch implements a `BlockVerifier` type which enforces the invariants of the log structure of FDR mode logs on a per-block basis. This ensures that the data we encounter from an FDR mode log semantically correct (i.e. that records follow the documented "grammar" for FDR mode log records). This is another part of the refactoring of D50441. Reviewers: mboerger, eizan Subscribers: mgorny, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D51723 llvm-svn: 341628
* Quick fix for -DBUILD_SHARED_LIBS=on build after rL341502Fangrui Song2018-09-061-3/+5
| | | | | | | | libLLVMTestingSupport.so references a symbol in utils/unittest/UnitTestMain/TestMain.cpp (a layering issue) and will cause a link error because of -Wl,-z,defs (cmake/modules/HandleLLVMOptions.cmake) Waiting zturner for a better fix. llvm-svn: 341580
* [ORC] Make RuntimeDyldObjectLinkingLayer2 take memory managers by unique_ptr.Lang Hames2018-09-061-185/+5
| | | | | | | | | | | | The existing memory manager API can not be shared between objects when linking concurrently (since there is no way to know which concurrent allocations were performed on behalf of which object, and hence which allocations would be safe to finalize when finalizeMemory is called). For now, we can work around this by requiring a new memory manager for each object. This change only affects the concurrent version of the ORC APIs. llvm-svn: 341579
* Move init code in AArch64SelectionDAGTest to SetUpTestCase (NFC)Scott Linder2018-09-061-11/+5
| | | | llvm-svn: 341574
* Fix a warning.Zachary Turner2018-09-061-1/+1
| | | | llvm-svn: 341561
* [XRay] Add a BlockIndexer visitor for FDR Records.Dean Michael Berris2018-09-062-0/+84
| | | | | | | | | | | | | | | | | | | | | | | Summary: This change adds a `BlockIndexer` type which maintains pointers to records that belong to the same process+thread pairs. The indexing happens with order of appearance of records as they are visited. This version of the indexer currently only supports FDR version 3 logs, which contain `BufferExtent` records. We will add support for v2 and v1 logs in follow-up patches. This is another part of D50441. Reviewers: eizan, kpw, mboerger Reviewed By: mboerger Subscribers: mboerger, mgorny, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D51673 llvm-svn: 341518
* [PDB] Refactor the PDB symbol classes to fix a reuse bug.Zachary Turner2018-09-053-0/+129
| | | | | | | | | | | | | | | | | | | | The way DIA SDK works is that when you request a symbol, it gets assigned an internal identifier that is unique for the life of the session. You can then use this identifier to get back the same symbol, with all of the same internal state that it had before, even if you "destroyed" the original copy of the object you had. This didn't work properly in our native implementation, and if you destroyed an object for a particular symbol, then requested the same symbol again, it would get assigned a new ID and you'd get a fresh copy of the object. In order to fix this some refactoring had to happen to properly reuse cached objects. Some unittests are added to verify that symbol reuse is taking place, making use of the new unittest input feature. llvm-svn: 341503
* Add support for unittest inputs.Zachary Turner2018-09-051-0/+1
| | | | | | | | | | | | | | | | | | | | | Occasionally it is useful to have unittest which take inputs. While we normally try to have this test be more of a lit test we occasionally don't have tools that can exercise the code in the right way to test certain things. LLDB has been using this style of unit test for a while, particularly with regards to how it tests core dump and minidump file parsing. Recently i needed this as well for the case where we want to test that some of the PDB reading code works correctly. It needs to exercise the code in a way that is not covered by any dumper and would be impractical to implement in one of the dumpers, but requires a valid PDB file. Since this is now needed by more than one project, it makes sense to have this be a generally supported thing that unit tests can do, and we just encourage people to use this sparingly. Differential Revision: https://reviews.llvm.org/D51561 llvm-svn: 341502
* Remove some unnecessary constructor arguments.Lang Hames2018-09-052-8/+8
| | | | | | | ExecutionSession defaults to creating a new shared pool if none is provided, so explicitly passing one in is unnecessary. llvm-svn: 341494
* [XRay] Use a function to return a constantDean Michael Berris2018-09-051-20/+14
| | | | | | | | | | We do this instead of using static constexpr char arrays because MSVC 2015 cannot handle the constant initialisation of those along with the out-of-line storage declaration. This is a follow-up to D51672. llvm-svn: 341479
* [XRay] Use `const` instead of `constexpr` in storage declarationDean Michael Berris2018-09-051-9/+9
| | | | | | | | | This should make MSVC happy with the storage provided for static constexpr character arrays out-of-line. Follow-up to D51672. llvm-svn: 341477
* [XRay] Add a RecordPrinter visitor for FDR RecordsDean Michael Berris2018-09-052-1/+178
| | | | | | | | | | | | | | | | | Summary: This change adds a `RecordPrinter` type which does some basic text serialization of the FDR record instances. This is one component of the tool we're building to dump the records from an FDR mode log as-is. This is a small part of D50441. Reviewers: eizan, kpw Subscribers: mgorny, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D51672 llvm-svn: 341447
* [Codegen] Fix test added in rL341380: AArch64SelectionDAGTest needs to link ↵Jordan Rupprecht2018-09-041-0/+1
| | | | | | against Analysis lib. llvm-svn: 341397
* [CodeGen] Fix remaining zext() assertions in SelectionDAGScott Linder2018-09-042-0/+171
| | | | | | | | Fix remaining cases not committed in https://reviews.llvm.org/D49574 Differential Revision: https://reviews.llvm.org/D50659 llvm-svn: 341380
* Revert r341329 due to MSAN errorBrian Gesiak2018-09-032-5/+0
| | | | | | | Pushing https://reviews.llvm.org/rL341329 revealed an MSAN error. Revert it so that we can fix the error. llvm-svn: 341333
* Re-push "[Option] Fix PR37006 prefix choice in findNearest"Brian Gesiak2018-09-032-0/+5
| | | | | | | | | | | | | | | | | | | | Summary: Original changeset (https://reviews.llvm.org/D46776) by @modocache. It was reverted after the PS4 bot failed. The issue has been determined to be with the way the PS4 SDK handles this particular option. https://reviews.llvm.org/D50410 removes this test, so we can push this again. Patch by Arnaud Coomans! Reviewers: cfe-commits, modocache Reviewed By: modocache Differential Revision: https://reviews.llvm.org/D50515 llvm-svn: 341329
* Add header guards to some headers that are missing themArgyrios Kyrtzidis2018-09-032-3/+8
| | | | | | | Also adjust some of dsymutil's headers to put the header guards at the top, otherwise the compiler will not recognize them as header guards. llvm-svn: 341323
* Rename a few unittests/.../Foo.cpp files to FooTest.cppNico Weber2018-09-0312-10/+10
| | | | | | | | | The convention for unit test sources is that they're called FooTest.cpp. No behavior change. https://reviews.llvm.org/D51579 llvm-svn: 341313
* [ORC] Tidy up JITSymbolFlags to remove the need for some explicit static_casts.Lang Hames2018-09-022-6/+3
| | | | | | | | Removes the implicit conversion to the underlying type for JITSymbolFlags::FlagNames and replaces it with some bitwise and comparison operators. llvm-svn: 341282
* [XRay] Use correct type for PID recordsDean Michael Berris2018-08-311-14/+13
| | | | | | | | | Previously we've been reading and writing the wrong types which only worked in little endian implementations. This time we're writing the same typed values the runtime is using, and reading them appropriately as well. llvm-svn: 341241
* Tests: fix tests encoding specific hash values for 32-bit systems.Tim Northover2018-08-311-54/+1
| | | | | | | I changed the seed slightly, but forgot to run the tests on a 32-bit system, so tests which hard-code a specific hash value started breaking. llvm-svn: 341240
* [XRay] Improve test matching granularity (NFC)Dean Michael Berris2018-08-311-30/+30
| | | | | | | Simplify matchers for unittest to better isolate which differences there are that we're finding in failures. llvm-svn: 341237
* [XRay] Make the FDRTraceWriter Endian-awareDean Michael Berris2018-08-312-4/+4
| | | | | | | | | Before this patch, the FDRTraceWriter would not take endianness into account when writing data into the output stream. This is a follow-up to D51289 and D51210. llvm-svn: 341223
* [XRay] Attempt to fix failure on WindowsDean Michael Berris2018-08-311-0/+9
| | | | | | | | Original version of the code relied on implementation-defined order of bitfields. Follow-up on D51210. llvm-svn: 341194
* [XRay] FDRProducerConsumerTest: unbreak (gcc?) buildRoman Lebedev2018-08-311-3/+3
| | | | | | | | | | | | | /build/llvm/unittests/XRay/FDRProducerConsumerTest.cpp:90:27: error: declaration of ‘std::unique_ptr<llvm::xray::Record> llvm::xray::{anonymous}::RoundTripTest<T>::Record’ [-fpermissive] std::unique_ptr<Record> Record; ^~~~~~ In file included from /build/llvm/include/llvm/XRay/FDRLogBuilder.h:12, from /build/llvm/unittests/XRay/FDRProducerConsumerTest.cpp:15: /build/llvm/include/llvm/XRay/FDRRecords.h:28:7: error: changes meaning of ‘Record’ from ‘class llvm::xray::Record’ [-fpermissive] class Record { ^~~~~~ llvm-svn: 341189
* [XRay] FDR Record Producer/Consumer ImplementationDean Michael Berris2018-08-312-0/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch defines two new base types called `RecordProducer` and `RecordConsumer` which have default implementations for convenience (particularly for testing). A `RecordProducer` implementation has one member function called `produce()` which serves as a factory constructor for `Record` instances. This code exercises the `RecordInitializer` code path in the implementation for `FileBasedRecordProducer`. A `RecordConsumer` has a single member function called `consume(...)` which, as the name implies, consumes instances of `std::unique_ptr<Record>`. We have two implementations, one of which is used in the test to generate a vector of `std::unique_ptr<Record>` similar to how the `LogBuilder` implementation works. We introduce a test in `FDRProducerConsumerTest` which ensures that records we write through the `FDRTraceWriter` can be loaded by the `FileBasedRecordProducer`. The record(s) loaded this way are written again through the `FDRTraceWriter` into a separate string, which we then compare. This ensures that the read-in bytes to create the `Record` instances in memory can be replicated when written out through the `FDRTraceWriter`. This change depends on D51210 and is part of the refactoring of D50441 into smaller, more focused changes. Reviewers: eizan, kpw Subscribers: mgorny, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D51289 llvm-svn: 341180
* [ORC] Remove a stray debugging output line left in a unit test.Lang Hames2018-08-311-1/+0
| | | | llvm-svn: 341155
* [ORC] Add utilities to RTDyldObjectLinkingLayer2 to simplify symbol flagLang Hames2018-08-311-0/+123
| | | | | | | | | | | | | | | | | | | | | | | management and materialization responsibility registration. The setOverrideObjectFlagsWithResponsibilityFlags method instructs RTDyldObjectlinkingLayer2 to override the symbol flags produced by RuntimeDyld with the flags provided by the MaterializationResponsibility instance. This can be used to enable symbol visibility (hidden/exported) for COFF object files, which do not currently support the SF_Exported flag. The setAutoClaimResponsibilityForObjectSymbols method instructs RTDyldObjectLinkingLayer2 to claim responsibility for any symbols provided by a given object file that were not already in the MaterializationResponsibility instance. Setting this flag allows higher-level program representations (e.g. LLVM IR) to be added based on only a subset of the symbols they provide, without having to write intervening layers to scan and add the additional symbols. This trades diagnostic quality for convenience however: If all symbols are enumerated up-front then clashes can be detected and reported early. If this option is set, clashes for the additional symbols may not be detected until late, and detection may depend on the flow of control through JIT'd code. llvm-svn: 341154
* [IR] add shuffle queries for identity extend/extract Sanjay Patel2018-08-301-0/+72
| | | | | | | | | | | | | | | This was one of the potential follow-ups suggested in D48236, and these will be used to make matching the patterns in PR38691 cleaner: https://bugs.llvm.org/show_bug.cgi?id=38691 About the vocabulary: in the DAG, these would be concat_vector with an undef operand or extract_subvector. Alternate names are discussed in the review, but I think these are familiar/good enough to proceed. Once we have uses of them in code, we might adjust if there are better options. https://reviews.llvm.org/D51392 llvm-svn: 341075
* More build fix for r341064.Alexandre Ganea2018-08-301-1/+1
| | | | llvm-svn: 341070
* [Error] Add FileError helper; upgrade StringError behaviorAlexandre Ganea2018-08-301-1/+111
| | | | | | | | | | | | | | | | FileError is meant to encapsulate both an Error and a file name/path. It should be used in cases where an Error occurs deep down the call chain, and we want to return it to the caller along with the file name. StringError was updated to display the error messages in different ways. These can be: 1. display the error_code message, and convert to the same error_code (ECError behavior) 2. display an arbitrary string, and convert to a provided error_code (current StringError behavior) 3. display both an error_code message and a string, in this order; and convert to the same error_code These behaviors can be triggered depending on the constructor. The goal is to use StringError as a base class, when a library needs to provide a explicit Error type. Differential Revision: https://reviews.llvm.org/D50807 llvm-svn: 341064
* [XRay] FDRTraceWriter and FDR Trace LoadingDean Michael Berris2018-08-302-1/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first step in the larger refactoring and reduction of D50441. This step in the process does the following: - Introduces more granular types of `Record`s representing the many kinds of records written/read by the Flight Data Recorder (FDR) mode `Trace` loading function(s). - Introduces an abstract `RecordVisitor` type meant to handle the processing of the various `Record` derived types. This `RecordVisitor` has two implementations in this patch: `RecordInitializer` and `FDRTraceWriter`. - We also introduce a convenience interface for building a collection of `Record` instances called a `LogBuilder`. This allows us to generate sequences of `Record` instances manually (used in unit tests but useful otherwise). - The`FDRTraceWriter` class implements the `RecordVisitor` interface and handles the writing of metadata records to a `raw_ostream`. We demonstrate that in the unit test, we can generate in-memory FDR mode traces using the specific `Record` derived types, which we load through the `loadTrace(...)` function yielding valid `Trace` objects. This patch introduces the required types and concepts for us to start replacing the logic implemented in the `loadFDRLog` function to use the more granular types. In subsequent patches, we will introduce more visitor implementations which isolate the verification, printing, indexing, production/consumption, and finally the conversion of the FDR mode logs. The overarching goal of these changes is to make handling FDR mode logs better tested, more understandable, more extensible, and more systematic. This will also allow us to better represent the execution trace, as we improve the fidelity of the events we represent in an XRay `Trace` object, which we intend to do after FDR mode log processing is in better shape. Reviewers: eizan Reviewed By: eizan Subscribers: mgorny, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D51210 llvm-svn: 341029
* [NFC] Move OrderedInstructions and InstructionPrecedenceTracking to AnalysisMax Kazantsev2018-08-303-2/+2
| | | | | | | | These classes don't make any changes to IR and have no reason to be in Transform/Utils. This patch moves them to Analysis folder. This will allow us reusing these classes in some analyzes, like MustExecute. llvm-svn: 341015
* [XRay][llvm] Load XRay ProfilesDean Michael Berris2018-08-302-0/+269
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change implements the profile loading functionality in LLVM to support XRay's profiling mode in compiler-rt. We introduce a type named `llvm::xray::Profile` which allows building a profile representation. We can load an XRay profile from a file to build Profile instances, or do it manually through the Profile type's API. The intent is to get the `llvm-xray` tool to generate `Profile` instances and use that as the common abstraction through which all conversion and analysis can be done. In the future we can generate `Profile` instances from `Trace` instances as well, through conversion functions. Some of the key operations supported by the `Profile` API are: - Path interning (`Profile::internPath(...)`) which returns a unique path identifier. - Block appending (`Profile::addBlock(...)`) to add thread-associated profile information. - Path ID to Path lookup (`Profile::expandPath(...)`) to look up a PathID and return the original interned path. - Block iteration. A 'Path' in this context represents the function call stack in leaf-to-root order. This is represented as a path in an internally managed prefix tree in the `Profile` instance. Having a handle (PathID) to identify the unique Paths we encounter for a particular Profile allows us to reduce the amount of memory required to associate profile data to a particular Path. This is the first of a series of patches to migrate the `llvm-stacks` tool towards using a single profile representation. Depends on D48653. Reviewers: kpw, eizan Reviewed By: kpw Subscribers: kpw, thakis, mgorny, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D48370 llvm-svn: 341012
* [DebugCounters] Fix DebugCounterTest when running all SupportTestsAlexandre Ganea2018-08-291-3/+2
| | | | | | | | Previously, the DebugCounterTest was failing because CommandLineTest.GetCommandLineArguments was clearing all the global singletons. Differential Revision: https://reviews.llvm.org/D51423 llvm-svn: 340935
* [GISel]: Add legalization support for Widening UADDO/USUBOAditya Nandakumar2018-08-291-0/+75
| | | | | | | | | | | https://reviews.llvm.org/D51384 Added code in LegalizerHelper to widen UADDO/USUBO along with unit tests. Reviewed by volkan. llvm-svn: 340892
* [ORC] Replace lookupFlags in JITSymbolResolver with getResponsibilitySet.Lang Hames2018-08-283-83/+88
| | | | | | | | | | | | | | The new method name/behavior more closely models the way it was being used. It also fixes an assertion that can occur when using the new ORC Core APIs, where flags alone don't necessarily provide enough context to decide whether the caller is responsible for materializing a given symbol (which was always the reason this API existed). The default implementation of getResponsibilitySet uses lookupFlags to determine responsibility as before, so existing JITSymbolResolvers should continue to work. llvm-svn: 340874
* [ADT] ImmutableList no longer requires elements to be copy constructibleKristof Umann2018-08-281-0/+43
| | | | | | | | | | | ImmutableList used to require elements to have a copy constructor for no good reason, this patch aims to fix this. It also required but did not enforce its elements to be trivially destructible, so a new static_assert is added to guard against misuse. Differential Revision: https://reviews.llvm.org/D49985 llvm-svn: 340824
* [ORC] Add unit tests for the new RTDyldObjectLinkingLayer2 class.Lang Hames2018-08-272-0/+283
| | | | | | | The new unit tests match the old ones, which will remain in tree until the old RTDyldObjectLinkingLayer is removed. llvm-svn: 340786
* [WebAssembly] Added default stack-only instruction mode for MC.Wouter van Oortmerssen2018-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Made it convert from register to stack based instructions, and removed the registers. Fixes to related code that was expecting register based instructions. Added the correct testing flag to all tests, depending on what the format they were expecting so far. Translated one test to stack format as example: reg-stackify-stack.ll tested: llvm-lit -v `find test -name WebAssembly` unittests/MC/* Reviewers: dschuff, sunfish Subscribers: sbc100, jgravelle-google, eraman, aheejin, llvm-commits, jfb Differential Revision: https://reviews.llvm.org/D51241 llvm-svn: 340750
* [ORC] Remove a workaround for systems lacking 8-byte atomics.Lang Hames2018-08-261-5/+0
| | | | | | | SymbolStringPool ref counts are now size_t, rather than uint64_t, so I do not think this is necessary any more. llvm-svn: 340704
* Replace fancy use of initializer lists with simple functions that returnChandler Carruth2018-08-261-194/+208
| | | | | | | | | | vectors, and move this test code into an anonymous namespace. Hoping that this will avoid hitting an MSVC bug that causes it to crash and burn pretty spectacularly. Also, this degree of clever use of initializer lists seems somewhat questionable in general. ;] llvm-svn: 340702
* [IR] Replace `isa<TerminatorInst>` with `isTerminator()`.Chandler Carruth2018-08-261-1/+1
| | | | | | | | | | | | This is a bit awkward in a handful of places where we didn't even have an instruction and now we have to see if we can build one. But on the whole, this seems like a win and at worst a reasonable cost for removing `TerminatorInst`. All of this is part of the removal of `TerminatorInst` from the `Instruction` type hierarchy. llvm-svn: 340701
* This patch adds support to LLVM for writing HermitCore ↵Eric Christopher2018-08-251-0/+6
| | | | | | | | | | | (https://hermitcore.org) ELF binaries. HermitCore is a POSIX-compatible kernel for running a single application in an isolated environment to get maximum performance and predictable runtime behavior. It can either be used bare-metal on hardware or a VM (Unikernel) or side by side to an existing Linux system (Multikernel). Due to the latter feature, HermitCore binaries are marked with ELFOSABI_STANDALONE to let the Linux ELF loader distinguish them from regular Unix/Linux binaries and load them using the HermitCore "proxy" tool. Patch by Colin Finck! llvm-svn: 340675
* Prevent DILocation::getMergedLocation() from creating invalid metadata.Adrian Prantl2018-08-241-0/+78
| | | | | | | | | | | | | | | | The function's new implementation from r340583 had a bug in it that could cause an invalid scope to be generated when merging two DILocations with no common ancestor scope. This patch detects this situation and picks the scope of the first location. This is not perfect, because the scope is misleading, but on the other hand, this will be a line 0 location. rdar://problem/43687474 Differential Revision: https://reviews.llvm.org/D51238 llvm-svn: 340672
* Allow demangler's node allocator to fail, and bail out of the entireRichard Smith2018-08-241-4/+35
| | | | | | | | | | | | | | | | demangling process when it does. Use this to support a "lookup" query for the mangling canonicalizer that does not create new nodes. This could also be used to implement demangling with a fixed-size temporary storage buffer. Reviewers: erik.pilkington Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D51003 llvm-svn: 340670
* Add data structure to form equivalence classes of mangled names.Richard Smith2018-08-242-0/+316
| | | | | | | | | | | | | | | Summary: Given a set of equivalent name fragments, this mechanism determines whether two mangled names are equivalent. The intent is to use this for fuzzy matching of profile data against the program after certain refactorings are performed. Reviewers: erik.pilkington, dlj Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D50935 llvm-svn: 340663
* [MemorySSA] Fix def optimization handlingGeorge Burgess IV2018-08-231-0/+128
| | | | | | | | | | | | | | | | | | | | | | In order for more complex updates of MSSA to happen (e.g. those in D45299), MemoryDefs need to be actual `Use`s of what they're optimized to. This patch makes that happen. In addition, this patch changes our optimization behavior for Defs slightly: we'll now consider a Def optimization invalid if the MemoryAccess it's optimized to changes. That we weren't doing this before was a bug, but given that we were tracking these with a WeakVH before, it was sort of difficult for that to matter. We're already have both of these behaviors for MemoryUses. The difference is that a MemoryUse's defining access is always its optimized access, and defining accesses are always `Use`s (in the LLVM sense). Nothing exploded when testing a stage3 clang+llvm locally, so... This also includes the test-case promised in r340461. llvm-svn: 340577
OpenPOWER on IntegriCloud