summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* [ADT] Teach alignment helpers to work correctly for abstract classes.Chandler Carruth2015-12-291-0/+20
| | | | | | | | | | | | This is necessary to use them as part of pointer traits and is generally useful. I've added unit test coverage to isolate and ensure this works correctly. I'll watch the build bots to try to see if any compilers can't tolerate this bit of magic (and much credit goes to Richard Smith for coming up with this magical production!) but give a shout if you see issues. llvm-svn: 256553
* [TrailingObjects] Dynamically realign under-aligned trailing objects.James Y Knight2015-12-291-0/+17
| | | | | | | | | | | | | | Previously, the code enforced non-decreasing alignment of each trailing type. However, it's easy enough to allow for realignment as needed, and thus avoid the developer having to think about the possiblilities for alignment requirements on all architectures. (E.g. on Linux/x86, a struct with an int64 member is 4-byte aligned, while on other 32-bit archs -- and even with other OSes on x86 -- it has 8-byte alignment. This sort of thing is irritating to have to manually deal with.) llvm-svn: 256533
* Unbreak LLVM_ENABLE_THREADS=OFF builds.Nico Weber2015-12-231-3/+19
| | | | llvm-svn: 256308
* [unittest] Use Support/thread.h instead of <thread> (second try)Vedant Kumar2015-12-221-1/+1
| | | | llvm-svn: 256292
* [unittest] Use Support/Thread.h instead of <thread> to fix the Windows buildVedant Kumar2015-12-221-1/+1
| | | | llvm-svn: 256290
* [Support] Allow multiple paired calls to {start,stop}Timer()Vedant Kumar2015-12-222-0/+50
| | | | | | | Differential Revision: http://reviews.llvm.org/D15619 Reviewed-by: rafael llvm-svn: 256258
* fix leak in a test, make the sanitizer bot greenKostya Serebryany2015-12-211-1/+2
| | | | llvm-svn: 256179
* ThreadPool unittests: do not hold mutex when calling condition_variable:notify()Mehdi Amini2015-12-191-11/+11
| | | | | From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 256111
* [unittests] ThreadPool: Remove redundant loop, NFCVedant Kumar2015-12-191-4/+2
| | | | llvm-svn: 256097
* [unittests] ThreadPool: Guard updates to MainThreadReadyVedant Kumar2015-12-191-12/+16
| | | | llvm-svn: 256096
* ThreadPool unittest: reimplement concurrency test, deterministically this time.Mehdi Amini2015-12-191-5/+36
| | | | | | | Follow-up to r256056. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 256087
* Remove possibility of failures to due race in ThreadPool unittestTeresa Johnson2015-12-181-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. llvm-svn: 256056
* Rewrite the TrailingObjects template to provide two new features:James Y Knight2015-12-181-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 llvm-svn: 256054
* BranchProbabilityTest.cpp: Suppress warnings. [-Wsign-compare]NAKAMURA Takumi2015-12-181-3/+3
| | | | llvm-svn: 255940
* [BranchProbability] Remove the restriction that known and unknown ↵Cong Hou2015-12-171-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 llvm-svn: 255934
* Mark ThreadPool unittests as unsupported on PowerPC64Mehdi Amini2015-12-151-0/+4
| | | | | | | Bots are crashing unexpectingly, see: https://llvm.org/bugs/show_bug.cgi?id=25829 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 255633
* ThreadPool unittest: add a rough mechanism to mark UNSUPPORTED on a given ↵Mehdi Amini2015-12-151-5/+53
| | | | | | | platform From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 255632
* Replace the unit test of BranchProbability::normalizeEdgeWeights() with ↵Cong Hou2015-12-151-29/+25
| | | | | | | | BranchProbability::normalizeProbabilities(). BranchProbability::normalizeEdgeWeights() is going to be retired soon. llvm-svn: 255618
* Fix template parameter pack handling in ThreadPoolTeresa Johnson2015-12-151-0/+14
| | | | | | | Fixes passing of template parameter pack via std::forward and add unittest. llvm-svn: 255617
* Add a C++11 ThreadPool implementation in LLVMMehdi Amini2015-12-152-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> llvm-svn: 255593
* Revert "Add a C++11 ThreadPool implementation in LLVM"Mehdi Amini2015-12-152-92/+0
| | | | | | | This reverts commit r255589. Breaks g++ From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 255591
* Add a C++11 ThreadPool implementation in LLVMMehdi Amini2015-12-152-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> llvm-svn: 255589
* Revert r255444.Nico Weber2015-12-132-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 llvm-svn: 255446
* Add a C++11 ThreadPool implementation in LLVMMehdi Amini2015-12-122-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> llvm-svn: 255444
* [Support] Change SaturatingAdd()/SaturatingMultiply() to use pointer for ↵Nathan Slingerland2015-12-091-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 llvm-svn: 255128
* [Support] Add optional argument to SaturatingAdd() and SaturatingMultiply() ↵Nathan Slingerland2015-11-231-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 llvm-svn: 253921
* [Support] Fix SaturatingMultiply<T>() to be correct (and fast), Re-enable ↵Nathan Slingerland2015-11-231-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 llvm-svn: 253870
* Revert the revert 253497 and 253539 - These commits aren't the cause of the ↵Daniel Sanders2015-11-201-0/+17
| | | | | | | | clang-cmake-mips failures. Sorry for the noise. llvm-svn: 253662
* Revert 253497 and 253539 to try to fix clang-cmake-mips buildbot.Daniel Sanders2015-11-201-17/+0
| | | | | | | | | | It caused link errors of the form: InstrProfiling.c:(.text.__llvm_profile_instrument_target+0x1c0): undefined reference to `__sync_fetch_and_add_8' We had a network outage at the time of the commit so the first build to show a problem is http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/10827 llvm-svn: 253656
* [Support] Disable SaturatingMultiply() unit test while investigatingNathan Slingerland2015-11-191-19/+0
| | | | | | | | Ubsan detected undefined behavior in the MathExtras SaturatingMultiply test. This change disables the test while it is being investigated. llvm-svn: 253539
* [llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions (2nd try)Nathan Slingerland2015-11-181-0/+36
| | | | | | | | | | | | | Summary: This change adds MathExtras helper functions for handling unsigned, saturating addition and multiplication. It also updates the instrumentation and sample profile merge implementations to use them. Reviewers: dnovillo, bogner, davidxl Subscribers: davidxl, llvm-commits Differential Revision: http://reviews.llvm.org/D14720 llvm-svn: 253497
* Revert "[llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions"Nathan Slingerland2015-11-181-48/+0
| | | | | | Not ready for merge. llvm-svn: 253415
* [llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper FunctionsNathan Slingerland2015-11-181-0/+48
| | | | | | | | | | | | | | | Summary: This change adds MathExtras helper functions for handling unsigned, saturating addition and multiplication. It also updates the instrumentation and sample profile merge implementations to use them. No functional changes. Reviewers: dnovillo, bogner, davidxl Subscribers: davidxl, llvm-commits Differential Revision: http://reviews.llvm.org/D14720 llvm-svn: 253412
* Remove excess white spaceRafael Espindola2015-11-181-6/+0
| | | | llvm-svn: 253408
* Fix -Wunused-function in a non-Win32 buildDavid Blaikie2015-11-171-1/+1
| | | | llvm-svn: 253373
* StringRef-ify some Option APIsDavid Blaikie2015-11-171-6/+6
| | | | | | | | Patch by Eugene Kosov! Differential Revision: http://reviews.llvm.org/D14711 llvm-svn: 253360
* [Support] Tweak path::system_temp_directory() on Windows.Pawel Bylica2015-11-171-0/+70
| | | | | | | | | | | | | | | | | Summary: This patch changes the behavior of path::system_temp_directory() on Windows to be closer to GetTempPath Windows API call. Enforces path separator to be the native one, makes path absolute, etc. GetTempPath is not used directly because of limitations/implementation bugs on Windows 7. Windows specific unit tests are added. Most of them runs in separated process with modified environment variables. This change fixes FileSystemTest.CreateDir unittest that had been failing when run from Unix-like shell on Windows (Unix-like path separator (/) used in env variables). Reviewers: chapuni, rafael, aaron.ballman Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D14231 llvm-svn: 253345
* Add MemoryBufferRef(MemoryBuffer&) constructor.Rafael Espindola2015-11-171-0/+9
| | | | | | patch by Jonathan Anderson! llvm-svn: 253311
* Windows-specific test for sys::path::remove_dots.Mike Aizatsky2015-11-091-0/+13
| | | | | | Differential Revision: http://reviews.llvm.org/D14503 llvm-svn: 252504
* Moving FileManager::removeDotPaths to llvm::sys::path::remove_dotsMike Aizatsky2015-11-091-0/+20
| | | | | | Differential Revision: http://reviews.llvm.org/D14393 llvm-svn: 252499
* Revert r252366: [Support] Use GetTempDir to get the temporary dir path on ↵Pawel Bylica2015-11-061-70/+0
| | | | | | Windows. llvm-svn: 252367
* [Support] Use GetTempDir to get the temporary dir path on Windows.Pawel Bylica2015-11-061-0/+70
| | | | | | | | | | | | | | | Summary: In general GetTempDir follows the same logic as the replaced code: checks env variables TMP, TEMP, USERPROFILE in order. However, it also perform other checks like making separators native (\), making the path absolute, etc. This change fixes FileSystemTest.CreateDir unittest that had been failing when run from Unix-like shell on Windows (Unix-like path separator (/) used in env variables). Reviewers: chapuni, rafael, aaron.ballman Subscribers: rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D14231 llvm-svn: 252366
* Fix unit tests on Windows: handle env vars with non-ASCII chars.Pawel Bylica2015-11-041-38/+70
| | | | | | | | | | | | Summary: On Windows we have to take UTF16 encoded env vars and convert them to UTF8. This patch fixes CopyEnvironment helper function used by process unit tests. Reviewers: yaron.keren Subscribers: yaron.keren, llvm-commits Differential Revision: http://reviews.llvm.org/D14278 llvm-svn: 252039
* [Support] Extend sys::path with user_cache_directory function.Pawel Bylica2015-11-021-0/+29
| | | | | | | | | | | | | | | | | | | | Summary: The new function sys::path::user_cache_directory tries to discover a directory suitable for cache storage for current system user. On Windows and Darwin it returns a path to system-specific user cache directory. On Linux it follows XDG Base Directory Specification, what is: - use non-empty $XDG_CACHE_HOME env var, - use $HOME/.cache. Reviewers: chapuni, aaron.ballman, rafael Subscribers: rafael, aaron.ballman, llvm-commits Differential Revision: http://reviews.llvm.org/D13801 llvm-svn: 251784
* Fix path::home_directory() unit test.Pawel Bylica2015-10-161-8/+12
| | | | | | It turns out that constructing std::string from null pointer is not the very best idea. llvm-svn: 250506
* SupportTests::HomeDirectory: Don't try tests when $HOME is undefined.NAKAMURA Takumi2015-10-161-6/+9
| | | | | | Lit sanitizes env vars. $HOME is not exported in Lit tests. llvm-svn: 250505
* Reformat.NAKAMURA Takumi2015-10-161-1/+1
| | | | llvm-svn: 250504
* Use Windows Vista API to get the user's home directoryPawel Bylica2015-10-161-9/+13
| | | | | | | | | | | | Summary: This patch replaces usage of deprecated SHGetFolderPathW with SHGetKnownFolderPath. The usage of SHGetKnownFolderPath is wrapped to allow queries for other "known" folders in the near future. Reviewers: aaron.ballman, gbedwell Subscribers: chapuni, llvm-commits Differential Revision: http://reviews.llvm.org/D13753 llvm-svn: 250501
* Recommit r250345, it was reverted in r250366 to investigate a bot failure.Manman Ren2015-10-151-0/+41
| | | | | | Our internal bot is still red after r250366. llvm-svn: 250415
* Temporarily revert r250345 to sort out bot failure.Manman Ren2015-10-151-41/+0
| | | | | | | | | | | | | | With r250345 and r250343, we start to observe the following failure when bootstrap clang with lto and pgo: PHI node entries do not match predecessors! %.sroa.029.3.i = phi %"class.llvm::SDNode.13298"* [ null, %30953 ], [ null, %31017 ], [ null, %30998 ], [ null, %_ZN4llvm8dyn_castINS_14ConstantSDNodeENS_7SDValueEEENS_10cast_rettyIT_T0_E8ret_typeERS5_.exit.i.1804 ], [ null, %30975 ], [ null, %30991 ], [ null, %_ZNK4llvm3EVT13getScalarTypeEv.exit.i.1812 ], [ %..sroa.029.0.i, %_ZN4llvm11SmallVectorIiLj8EED1Ev.exit.i.1826 ], !dbg !451895 label %30998 label %_ZNK4llvm3EVTeqES0_.exit19.thread.i LLVM ERROR: Broken function found, compilation aborted! I will re-commit this if the bot does not recover. llvm-svn: 250366
OpenPOWER on IntegriCloud