summaryrefslogtreecommitdiff
path: root/unittests
AgeCommit message (Collapse)AuthorFilesLines
2015-12-21fix leak in a test, make the sanitizer bot greenKostya Serebryany1-1/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256179 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-19ThreadPool unittests: do not hold mutex when calling condition_variable:notify()Mehdi Amini1-11/+11
From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256111 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-19Improve InstrProfSymtab test coverageXinliang David Li1-0/+27
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256099 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-19[unittests] ThreadPool: Remove redundant loop, NFCVedant Kumar1-4/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256097 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-19[unittests] ThreadPool: Guard updates to MainThreadReadyVedant Kumar1-12/+16
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256096 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-19[PGO] Add hash to name mapping in InstrProfSymtabXinliang David Li1-0/+24
Creator and lookup interfaces are added to this symtab class. The new interfaces will be used by InstrProf Readers and writer. A unit test is also added for the new APIs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256092 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-19ThreadPool unittest: reimplement concurrency test, deterministically this time.Mehdi Amini1-5/+36
Follow-up to r256056. From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256087 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18Remove possibility of failures to due race in ThreadPool unittestTeresa Johnson1-22/+0
Remove all checks that required main thread to run faster than tasks in ThreadPool, and yields which are now unnecessary. This should fix some bot failures. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256056 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18Rewrite the TrailingObjects template to provide two new features:James Y Knight1-4/+34
- Automatic alignment of the base type for the alignment requirements of the trailing types. - Support for an arbitrary numbers of trailing types, instead of only 1 or 2, by using a variadic template implementation. Upcoming commits to clang will take advantage of both of these features. Differential Revision: http://reviews.llvm.org/D12439 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256054 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18Drop support for dematerializing.Rafael Espindola1-38/+0
It was only used on lib/Linker and the use was "dead" since it was used on a function the IRMover had just moved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256019 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18Reorganize the C API headers to improve build times.Eric Christopher3-0/+3
Type specific declarations have been moved to Type.h and error handling routines have been moved to ErrorHandling.h. Both are included in Core.h so nothing should change for projects directly including the headers, but transitive dependencies may be affected. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255965 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-18BranchProbabilityTest.cpp: Suppress warnings. [-Wsign-compare]NAKAMURA Takumi1-3/+3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255940 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-17[BranchProbability] Remove the restriction that known and unknown ↵Cong Hou1-0/+31
probabilities cannot coexist when being normalized. The current BranchProbability::normalizeProbabilities() forbids known and unknown probabilities to coexist in the list. This was once used to help capture probability exceptions but has caused some reported build failures (https://llvm.org/bugs/show_bug.cgi?id=25838). This patch removes this restriction by evenly distributing the complement of the sum of all known probabilities to unknown ones. We could still treat this as an abnormal behavior, but it is better to emit warnings in our future profile validator. Differential revision: http://reviews.llvm.org/D15548 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255934 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16Change linkInModule to take a std::unique_ptr.Rafael Espindola1-8/+36
Passing in a std::unique_ptr should help find errors when the module is used after being linked into another module. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255842 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16[PGO] Handle and report overflow during profile merge for all types of dataNathan Slingerland2-29/+68
Summary: Surface counter overflow when merging profile data. Merging still occurs on overflow but counts saturate to the maximum representable value. Overflow is reported to the user. Reviewers: davidxl, dnovillo, silvas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15547 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255825 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15[llvm-profdata] Add support for weighted merge of profile data (2nd try)Nathan Slingerland1-2/+27
Summary: This change adds support for specifying a weight when merging profile data with the llvm-profdata tool. Weights are specified by using the --weighted-input=<weight>,<filename> option. Input files not specified with this option (normal positional list after options) are given a default weight of 1. Adding support for arbitrary weighting of input profile data allows for relative importance to be placed on the input data from multiple training runs. Both sampled and instrumented profiles are supported. Reviewers: davidxl, dnovillo, bogner, silvas Subscribers: silvas, davidxl, llvm-commits Differential Revision: http://reviews.llvm.org/D15306 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255659 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15Mark ThreadPool unittests as unsupported on PowerPC64Mehdi Amini1-0/+4
Bots are crashing unexpectingly, see: https://llvm.org/bugs/show_bug.cgi?id=25829 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255633 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15ThreadPool unittest: add a rough mechanism to mark UNSUPPORTED on a given ↵Mehdi Amini1-5/+53
platform From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255632 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15Replace the unit test of BranchProbability::normalizeEdgeWeights() with ↵Cong Hou1-29/+25
BranchProbability::normalizeProbabilities(). BranchProbability::normalizeEdgeWeights() is going to be retired soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255618 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15Fix template parameter pack handling in ThreadPoolTeresa Johnson1-0/+14
Fixes passing of template parameter pack via std::forward and add unittest. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255617 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15Add a C++11 ThreadPool implementation in LLVMMehdi Amini2-0/+92
This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual task can be synchronize using the returned future, or the client can block on the full queue completion. In case LLVM is configured with Threading disabled, it falls back to sequential execution using std::async with launch:deferred. This is intended to support parallelism for ThinLTO processing in linker plugin, but is generic enough for any other uses. This is a recommit of r255444 ; trying to workaround a bug in the MSVC 2013 standard library. I think I was hit by: http://connect.microsoft.com/VisualStudio/feedbackdetail/view/791185/std-packaged-task-t-where-t-is-void-or-a-reference-class-are-not-movable Recommit of r255589, trying to please g++ as well. Differential Revision: http://reviews.llvm.org/D15464 From: mehdi_amini <mehdi_amini@91177308-0d34-0410-b5e6-96231b3b80d8> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255593 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15Revert "Add a C++11 ThreadPool implementation in LLVM"Mehdi Amini2-92/+0
This reverts commit r255589. Breaks g++ From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255591 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-15Add a C++11 ThreadPool implementation in LLVMMehdi Amini2-0/+92
This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual task can be synchronize using the returned future, or the client can block on the full queue completion. In case LLVM is configured with Threading disabled, it falls back to sequential execution using std::async with launch:deferred. This is intended to support parallelism for ThinLTO processing in linker plugin, but is generic enough for any other uses. This is a recommit of r255444 ; trying to workaround a bug in the MSVC 2013 standard library. I think I was hit by: http://connect.microsoft.com/VisualStudio/feedbackdetail/view/791185/std-packaged-task-t-where-t-is-void-or-a-reference-class-are-not-movable Differential Revision: http://reviews.llvm.org/D15464 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255589 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14Use diagnostic handler in the LLVMContextRafael Espindola1-6/+13
This patch converts code that has access to a LLVMContext to not take a diagnostic handler. This has a few advantages * It is easier to use a consistent diagnostic handler in a single program. * Less clutter since we are not passing a handler around. It does make it a bit awkward to implement some C APIs that return a diagnostic string. I will propose new versions of these APIs and deprecate the current ones. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255571 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14add fast-math-flags to 'call' instructions (PR21290)Sanjay Patel1-1/+21
This patch adds optional fast-math-flags (the same that apply to fmul/fadd/fsub/fdiv/frem/fcmp) to call instructions in IR. Follow-up patches would use these flags in LibCallSimplifier, add support to clang, and extend FMF to the DAG for calls. Motivating example: %y = fmul fast float %x, %x %z = tail call float @sqrtf(float %y) We'd like to be able to optimize sqrt(x*x) into fabs(x). We do this today using a function-wide attribute for unsafe-math, but we really want to trigger on the instructions themselves: %z = tail call fast float @sqrtf(float %y) because in an LTO build it's possible that calls with fast semantics have been inlined into a function with non-fast semantics. The code changes and tests are based on the recent commits that added "notail": http://reviews.llvm.org/rL252368 and added FMF to fcmp: http://reviews.llvm.org/rL241901 Differential Revision: http://reviews.llvm.org/D14707 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255555 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-14[ConstantFold] Fix bitcast to gep constant folding transform.David Majnemer1-0/+17
Make sure to check that the destination type is sized. A check was present but was incorrectly checking the source type instead. Patch by Amaury SECHET! Differential Revision: http://reviews.llvm.org/D15264 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255536 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-13Revert r255444.Nico Weber2-92/+0
It doesn't build on Windows and broke the Windows LLD and LLDB bots: http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/27693/steps/build_Lld/logs/stdio http://lab.llvm.org:8011/builders/lldb-x86-windows-msvc/builds/13468/steps/build/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255446 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-12Add a C++11 ThreadPool implementation in LLVMMehdi Amini2-0/+92
This is a very simple implementation of a thread pool using C++11 thread. It accepts any std::function<void()> for asynchronous execution. Individual task can be synchronize using the returned future, or the client can block on the full queue completion. In case LLVM is configured with Threading disabled, it falls back to sequential execution using std::async with launch:deferred. This is intended to support parallelism for ThinLTO processing in linker plugin, but is generic enough for any other uses. Differential Revision: http://reviews.llvm.org/D15464 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255444 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-10[ProfileData] Add unit test infrastructure for sample profile reader/writerNathan Slingerland2-0/+103
Summary: Adds support for in-memory round-trip of sample profile data along with basic round trip unit tests. This will also make it easier to include unit tests for future changes to sample profiling. Reviewers: davidxl, dnovillo, silvas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15211 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255264 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-10Macro debug info support in LLVM IRAmjad Aboud1-2/+13
Introduced DIMacro and DIMacroFile debug info metadata in the LLVM IR to support macros. Differential Revision: http://reviews.llvm.org/D14687 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255245 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-09IR: Make ConstantDataArray::getFP actually return a ConstantDataArrayJustin Bogner1-0/+23
The ConstantDataArray::getFP(LLVMContext &, ArrayRef<uint16_t>) overload has had a typo in it since it was written, where it will create a Vector instead of an Array. This obviously doesn't work at all, but it turns out that until r254991 there weren't actually any callers of this overload. Fix the typo and add some test coverage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255157 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-09[Support] Change SaturatingAdd()/SaturatingMultiply() to use pointer for ↵Nathan Slingerland1-17/+17
returning overflow state Summary: Improve SaturatingAdd()/SaturatingMultiply() to use bool * to optionally return overflow result. This should make it clearer that the value is returned at callsites and reduces the size of the implementation. Reviewers: davidxl, silvas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15219 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255128 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-08Return a std::unique_ptr from CloneModule. NFC.Rafael Espindola1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255078 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-08IR: Allow vectors of halfs to be ConstantDataVectorsJustin Bogner1-0/+28
Currently, vectors of halfs end up as ConstantVectors, but there isn't a good reason they can't be ConstantDataVectors. This should save some memory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254991 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-07[Orc] Removing traces of takeOwnershipOfBuffers left after r251560.Lang Hames1-27/+0
Patch by Joshua Gerrard. Thanks Joshua! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254919 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-07[ThinLTO] Support cloning of temporary DILocation metadataTeresa Johnson1-0/+8
This is needed to support linking of module-level metadata as a postpass after function importing, where we will be leaving temporary metadata on imported instructions until the postpass metadata import. Also added unittest. Split from D14838. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254914 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-06[Orc] Rename IndirectStubsManagerBase to IndirectStubsManager.Lang Hames1-1/+1
No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254885 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04[Orc] Move some code up into the JITCompileCallbackManager base class. NFC.Lang Hames1-10/+2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254778 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04Always pass a diagnostic handler to the linker.Rafael Espindola1-3/+5
Before this patch the diagnostic handler was optional. If it was not passed, the one in the LLVMContext was used. That is probably not a pattern we want to follow. If each area has an optional callback, there is a sea of callbacks and it is hard to follow which one is called. Doing this also found cases where the callback is a nice addition, like testing that no errors or warnings are reported. The other option is to always use the diagnostic handler in the LLVMContext. That has a few problems * To implement the C API we would have to set the diag handler and then set it back to the original value. * Code that creates the context might be far away from code that wants the diagnostics. I do have a patch that implements the second option and will send that as an RFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254777 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04[Orc] Rename JITCompileCallbackManagerBase to JITCompileCallbackManager.Lang Hames1-2/+2
This class is turning into a useful interface, rather than an implementation detail, so I'm dropping the 'Base' suffix. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254693 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04Revert "[llvm-profdata] Add support for weighted merge of profile data"Nathan Slingerland1-20/+0
This reverts commit b7250858d96b8ce567681214273ac0e62713c661. Reverting in order to investigate Windows test failure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254687 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-04[llvm-profdata] Add support for weighted merge of profile dataNathan Slingerland1-0/+20
This change adds support for an optional weight when merging profile data with the llvm-profdata tool. Weights are specified by adding an option ':<weight>' suffix to the input file names. Adding support for arbitrary weighting of input profile data allows for relative importance to be placed on the input data from multiple training runs. Both sampled and instrumented profiles are supported. Reviewers: dnovillo, bogner, davidxl Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14547 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254669 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-02[llvm-profdata] Change instr prof counter overflow to saturate rather than ↵Nathan Slingerland1-1/+4
discard Summary: This changes overflow handling during instrumentation profile merge. Rathar than throwing away records that would result in counter overflow, merged counts are instead clamped to the maximum representable value. A warning about counter overflow is still surfaced to the user as before. Reviewers: dnovillo, davidxl, silvas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14893 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254525 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01Use references now that it is natural to do so.Rafael Espindola1-6/+5
The linker never takes ownership of a module or changes which module it is refering to, making it natural to use references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254449 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01Use nullptr (NFC)Xinliang David Li1-1/+1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254447 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01[Verifier] Improve error for cross-module refsKeno Fischer1-0/+47
By including the module name in the error message. This makes the error message much more useful and saves a trip to the debugger. Reviewers: dexonsmith Subscribers: dexonsmith, llvm-commits Differential Revision: http://reviews.llvm.org/D14473 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254437 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-28[PGO] Allow value profile writer interface to allocated target buffer Xinliang David Li1-1/+1
Raw profile writer needs to write all data of one kind in one continuous block, so the buffer needs to be pre-allocated and passed to the writer method in pieces for function profile data. The change adds the support for raw value data writing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254219 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-25[PGO] Implement ValueProfiling Closure interfaces for runtime value profile dataXinliang David Li1-0/+92
This is one of the many steps to commonize value profiling support between profile runtime and compiler/llvm tools. After this change, profiler runtime now can share the same C APIs to do VP serialization/deseriazation with LLVM host tools (and produces value data in identical format between indexed and raw profile). It is not yet enabled in profiler runtime yet. Also added a unit test case to test runtime profile data serialization/deserialization interfaces implemented using common closure code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254110 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23[Support] Add optional argument to SaturatingAdd() and SaturatingMultiply() ↵Nathan Slingerland1-1/+50
to indicate that overflow occurred Summary: Adds the ability for callers to detect when saturation occurred on the result of saturating addition/multiplication. Reviewers: davidxl, silvas, rsmith Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14931 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253921 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23[Support] Fix SaturatingMultiply<T>() to be correct (and fast), Re-enable ↵Nathan Slingerland1-0/+48
Unit Tests Summary: This change fixes the SaturatingMultiply<T>() function template to not cause undefined behavior with T=uint16_t. Thanks to Richard Smith's contribution, it also no longer requires an integer division. Patch by Richard Smith. Reviewers: silvas, davidxl Subscribers: rsmith, davidxl, llvm-commits Differential Revision: http://reviews.llvm.org/D14845 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253870 91177308-0d34-0410-b5e6-96231b3b80d8