summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
* [Clang][Driver] In -fintegrated-cc1 mode, avoid crashing on exit after a ↵Alexandre Ganea2020-03-131-0/+4
| | | | | | | | | | | | compiler crash After a crash catched by the CrashRecoveryContext, this patch prevents from accessing dangling pointers in TimerGroup structures before the clang tool exits. Previously, the default TimerGroup had internal linked lists which were still pointing to old Timer or TimerGroup instances, which lived in stack frames released by the CrashRecoveryContext. Fixes PR45164. Differential Revision: https://reviews.llvm.org/D76099 (cherry picked from commit 28ad9fc20823678881baa0d723834b88ea9e8e3a)
* Revert abb00753 "build: reduce CMake handling for zlib" (PR44780)Hans Wennborg2020-03-033-29/+8
| | | | | | | | | | | | | and follow-ups: a2ca1c2d "build: disable zlib by default on Windows" 2181bf40 "[CMake] Link against ZLIB::ZLIB" 1079c68a "Attempt to fix ZLIB CMake logic on Windows" This changed the output of llvm-config --system-libs, and more importantly it broke stand-alone builds. Instead of piling on more fix attempts, let's revert this to reduce the risk of more breakages. (cherry picked from commit 916be8fd6a0a0feea4cefcbeb0c22c65848d7a2e)
* Attempt to fix ZLIB CMake logic on WindowsReid Kleckner2020-03-021-2/+4
| | | | | | CMake doesn't seem to like it when you regex search for "^". (cherry picked from commit 1079c68aa0fdb14d270a31c0df49a2afc5ed2485)
* [CMake] Link against ZLIB::ZLIBPetr Hosek2020-03-021-3/+22
| | | | | | | | This is the imported target that find_package(ZLIB) defines. Differential Revision: https://reviews.llvm.org/D74176 (cherry picked from commit 2181bf40d87165ff4c208b46b135be823eef5c55)
* llvm-ar: Fix MinGW compilationHans Wennborg2020-02-2814-256/+13
| | | | | | | | | | | | | | | | llvm-ar is using CompareStringOrdinal which is available only starting with Windows Vista (WINVER 0x600). Fix this by hoising WindowsSupport.h, which sets _WIN32_WINNT to 0x0601, up to llvm/include/llvm/Support and use it in llvm-ar. Patch by Cristian Adam! Differential revision: https://reviews.llvm.org/D74599 (cherry picked from commit 01f9abbb50b11dd26b9ccb7cb565cc955d2b9c74) This is for https://bugs.llvm.org/show_bug.cgi?id=44907
* Fix MSVC build with C++ EH enabledReid Kleckner2020-02-121-1/+1
| | | | | | | | | | | | | | | | | Mark the CrashRecoveryContextImpl constructor noexcept, so that MSVC won't emit an unwind helper to clean up the allocation from `new` if the constructor throws an exception. Otherwise, MSVC complains: llvm\lib\Support\CrashRecoveryContext.cpp(220): error C2712: \ Cannot use __try in functions that require object unwinding The other simple fix would be to wrap `new` in a static helper or lambda. Users have reported that Tensorflow builds LLVM with /EHsc. (cherry picked from commit a349c09162a8260bdf691c4f7ab72a16c33975f6)
* [Clang][Driver] After default -fintegrated-cc1, make ↵Alexandre Ganea2020-02-123-7/+36
| | | | | | | | | | | | | llvm::report_fatal_error() generate preprocessed source + reproducer.sh again. Added a test for #pragma clang __debug llvm_fatal_error to test for the original issue. Added llvm::sys::Process::Exit() and replaced ::exit() in places where it was appropriate. This new function would call the current CrashRecoveryContext if one is running on the same thread; or call ::exit() otherwise. Fixes PR44705. Differential Revision: https://reviews.llvm.org/D73742 (cherry picked from commit faace365088a2a3a4cb1050a9facfc34a7a56577)
* [Support] Don't modify the current EH context during stack unwindingReid Kleckner2020-02-111-1/+7
| | | | | | | | | | | | | Copy it instead. Otherwise, key registers (such as RBP) may get zeroed out by the stack unwinder. Fixes CrashRecoveryTest.DumpStackCleanup with MSVC in release builds. Reviewed By: stella.stamenova Differential Revision: https://reviews.llvm.org/D73809 (cherry picked from commit b074acb82f7e75a189fa7933b09627241b166121)
* [Support] When using SEH, create a impl instance for CrashRecoveryContext. NFCI.Alexandre Ganea2020-02-101-25/+35
| | | | | | | | | | Previously, the SEH codepath in CrashRecoveryContext didn't create a CrashRecoveryContextImpl. The other codepaths (VEH and Unix) were creating it. When running with -fintegrated-cc1, this is needed to handle exit() as a jump to CrashRecoveryContext's exception filter, through a call to RaiseException. In that situation, we need a user-defined exception code, which is later interpreted as an exit() by the exception filter. This in turn needs to set RetCode accordingly, *inside* the exception filter, and *before* calling HandleCrash(). Differential Revision: https://reviews.llvm.org/D74078 (cherry picked from commit 2a3fa0fc5cd7d3398c0293915b0e569eaa0be24b)
* [Clang] Remove unused #pragma clang __debug handle_crashAlexandre Ganea2020-02-101-8/+0
| | | | | | | | | As discussed in D70568, remove this because it isn't used anywhere, and I think it's better to go through real crashes for testing (#pragma clang __debug crash). Also remove the support function llvm::CrashRecoveryContext::HandleCrash() which was added at the same time by @ddunbar. Differential Revision: https://reviews.llvm.org/D74063 (cherry picked from commit 8ecde3ac34bbb5a8d53d8ec5cd32867658646df1)
* Make llvm::crc32() work also for input sizes larger than 32 bits.Hans Wennborg2020-02-061-1/+9
| | | | | | | | | | | | The problem was noticed by the Chrome OS toolchain folks (crbug.com/1048445) because llvm-objcopy --add-gnu-debuglink would insert the wrong checksum when processing a binary larger than 4 GB. That use case regressed in 1e1e3ba2526 when we started using llvm::crc32() in more places. Differential revision: https://reviews.llvm.org/D74039 (cherry picked from commit 6c4a8bc0a9f6a466d90d542bef66d69550c1b041)
* Work around PR44697 in CrashRecoveryContextHans Wennborg2020-01-291-0/+7
| | | | (cherry picked from commit 31e07692d7f2b383bd64c63cd2b5c35b6503cf3a)
* [NFC] Fix compilation of CrashRecoveryContext.cpp on mingwMarkus Böck2020-01-121-1/+2
| | | | | | Patch by Markus Böck. Differential Revision: https://reviews.llvm.org/D72564
* [Support] Optionally call signal handlers when a function wrapped by the the ↵Alexandre Ganea2020-01-113-53/+85
| | | | | | | | | CrashRecoveryContext fails This patch allows for handling a failure inside a CrashRecoveryContext in the same way as the global exception/signal handler. A failure will have the same side-effect, such as cleanup of temporarty file, printing callstack, calling relevant signal handlers, and finally returning an exception code. This is an optional feature, disabled by default. This is a support patch for D69825. Differential Revision: https://reviews.llvm.org/D70568
* [LockFileManager] Make default waitForUnlock timeout a parameter, NFCVedant Kumar2020-01-101-4/+2
| | | | Patch by Xi Ge!
* [Support] ThreadPoolExecutor fixes for Windows/MinGWAndrew Ng2020-01-101-18/+64
| | | | | | | | | | | | | | | | | | | | | Changed ThreadPoolExecutor to no longer use detached threads and instead to join threads on destruction. This is to prevent intermittent crashing on Windows when doing a normal full exit, e.g. via exit(). Changed ThreadPoolExecutor to be a ManagedStatic so that it can be stopped on llvm_shutdown(). Without this, it would only be stopped in the destructor when doing a full exit. This is required to avoid intermittent crashing on Windows due to a race condition between the ThreadPoolExecutor starting up threads and the process doing a fast exit, e.g. via _exit(). The Windows crashes appear to only occur with the MSVC static runtimes and are more frequent with the debug static runtime. These changes also prevent intermittent deadlocks on exit with the MinGW runtime. Differential Revision: https://reviews.llvm.org/D70447
* [Support][NFC] Make some helper functions "static" in Memory.incBruno Ricci2020-01-092-11/+3
|
* [NFC,format] Sort switch cases alphabeticallySimon Moll2020-01-091-133/+133
| | | | | | | | | This patch brings the switch cases of `llvm/lib/Support/Triple.cpp` back into alphabetical order. This was noted during the the review of https://reviews.llvm.org/D69103 Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D72452
* [ARM][MVE] MVE-I should not be disabled by -mfpu=noneMomchil Velikov2020-01-091-2/+0
| | | | | | | | | | | | | | | Architecturally, it's allowed to have MVE-I without an FPU, thus -mfpu=none should not disable MVE-I, or moves to/from FP-registers. This patch removes `+/-fpregs` from features unconditionally added to target feature list, depending on FPU and moves the logic to Clang driver, where the negative form (`-fpregs`) is conditionally added to the target features list for the cases of `-mfloat-abi=soft`, or `-mfpu=none` without either `+mve` or `+mve.fp`. Only the negative form is added by the driver, the positive one is derived from other features in the backend. Differential Revision: https://reviews.llvm.org/D71843
* [VE] Target stub for NEC SX-AuroraKazushi (Jam) Marukawa2020-01-091-0/+11
| | | | | | | | | Summary: This patch registers the 've' target: the NEC SX-Aurora TSUBASA Vector Engine. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D69103
* [APFloat] Fix checked error assert failuresEhud Katz2020-01-092-8/+5
| | | | | | | | | | | `APFLoat::convertFromString` returns `Expected` result, which must be "checked" if the LLVM_ENABLE_ABI_BREAKING_CHECKS preprocessor flag is set. To mark an `Expected` result as "checked" we must consume the `Error` within. In many cases, we are only interested in knowing if an error occured, without the need to examine the error info. This is achieved, easily, with the `errorToBool()` API.
* [PowerPC]: Add powerpcspe target triple subarch componentJustin Hibbits2020-01-081-1/+4
| | | | | | | | | | Summary: This allows the use of '-target powerpcspe-unknown-linux-gnu' or 'powerpcspe-unknown-freebsd' to be used, instead of '-target powerpc-unknown-linux-gnu -mspe'. Reviewed By: dim Differential Revision: https://reviews.llvm.org/D72014
* [PowerPC][Triple] Use elfv2 on freebsd>=13 and linux-muslFangrui Song2020-01-071-4/+0
| | | | | | | | | | | | | | | | | | | Summary: Every powerpc64le platform uses elfv2. For powerpc64, the environments "elfv1" and "elfv2" were added for FreeBSD ELFv1->ELFv2 migration in D61950. FreeBSD developers have decided to use OS versions to select ABI, and no one is relying on the environments. Also use elfv2 on powerpc64-linux-musl. Users can always use -mabi=elfv1 and -mabi=elfv2 to override the default ABI. Reviewed By: adalava Differential Revision: https://reviews.llvm.org/D72352
* Fix issues reported by -Wrange-loop-analysis when building with latest Clang ↵Alexandre Ganea2020-01-071-1/+1
| | | | | | (trunk). NFC. Fixes warning: loop variable 'E' of type 'const llvm::StringRef' creates a copy from type 'const llvm::StringRef' [-Wrange-loop-analysis]
* [APFloat] Fix out of scope usage of a pointer to local variableEhud Katz2020-01-071-3/+7
|
* [APFloat] Fix fusedMultiplyAdd when `this` equals to `Addend`Ehud Katz2020-01-071-9/+12
| | | | | | | | | | | | | Up until now, the arguments to `fusedMultiplyAdd` are passed by reference. We must save the `Addend` value on the beginning of the function, before we modify `this`, as they may be the same reference. To fix this, we now pass the `addend` parameter of `multiplySignificand` by value (instead of by-ref), and have a default value of zero. Fix PR44051. Differential Revision: https://reviews.llvm.org/D70422
* [FileCheck] Remove FileCheck prefix in APIThomas Preud'homme2020-01-062-231/+204
| | | | | | | | | | | | | | | | | | Summary: When FileCheck was made a library, types in the public API were renamed to add a FileCheck prefix, such as Pattern to FileCheckPattern. Many types were moved into a private interface and thus don't need this prefix anymore. This commit removes those unneeded prefixes. Reviewers: jhenderson, jdenny, probinson, grimar, arichardson, rnk Reviewed By: jhenderson Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72186
* [APFloat] Fix compilation warningsEhud Katz2020-01-062-2/+4
|
* [APFloat] Add recoverable string parsing errors to APFloatEhud Katz2020-01-062-60/+103
| | | | | | Implementing the APFloat part in PR4745. Differential Revision: https://reviews.llvm.org/D69770
* build: reduce CMake handling for zlibSaleem Abdulrasool2020-01-023-6/+6
| | | | | | | | | | | | | Rather than handling zlib handling manually, use `find_package` from CMake to find zlib properly. Use this to normalize the `LLVM_ENABLE_ZLIB`, `HAVE_ZLIB`, `HAVE_ZLIB_H`. Furthermore, require zlib if `LLVM_ENABLE_ZLIB` is set to `YES`, which requires the distributor to explicitly select whether zlib is enabled or not. This simplifies the CMake handling and usage in the rest of the tooling. This restores 68a235d07f9e7049c7eb0c8091f37e385327ac28, e6c7ed6d2164a0659fd9f6ee44f1375d301e3cad. The problem with the windows bot is a need for clearing the cache.
* Revert "build: reduce CMake handling for zlib"James Henderson2020-01-023-4/+7
| | | | | | | This reverts commit 68a235d07f9e7049c7eb0c8091f37e385327ac28. This commit broke the clang-x64-windows-msvc build bot and a follow-up commit did not fix it. Reverting to fix the bot.
* Revert "build: make `LLVM_ENABLE_ZLIB` a tri-bool for users"James Henderson2020-01-021-4/+1
| | | | | | | This reverts commit e6c7ed6d2164a0659fd9f6ee44f1375d301e3cad. This commit was an attempt to fix the build bots, but it still left the clang-x64-windows-msvc bot in a broken state.
* build: make `LLVM_ENABLE_ZLIB` a tri-bool for usersSaleem Abdulrasool2020-01-011-1/+4
| | | | | | Treat the flag `LLVM_ENABLE_ZLIB` as a tri-bool, `FORCE_ON` being `ON`, and `ON` being an auto-detect. This is needed as many of the builders enable the flag without having zlib available.
* build: reduce CMake handling for zlibSaleem Abdulrasool2020-01-013-7/+4
| | | | | | | | | Rather than handling zlib handling manually, use `find_package` from CMake to find zlib properly. Use this to normalize the `LLVM_ENABLE_ZLIB`, `HAVE_ZLIB`, `HAVE_ZLIB_H`. Furthermore, require zlib if `LLVM_ENABLE_ZLIB` is set to `YES`, which requires the distributor to explicitly select whether zlib is enabled or not. This simplifies the CMake handling and usage in the rest of the tooling.
* [polly][Support] Un-break polly testsAlexandre Ganea2020-01-011-1/+1
| | | | | | Previously, the polly unit tests were stuck in a infinite loop. There was an edge case in StringRef::count() introduced by 9f6b13e5cce96066d7262d224c971d93c2724795, where an empty 'Str' would cause the function to never exit. Also fixed usage in polly.
* [NFC] Fixes -Wrange-loop-analysis warningsMark de Wever2020-01-012-8/+8
| | | | | | This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D71857
* [Support] Fix behavior of StringRef::count with overlapping occurrences, add ↵Johannes Doerfert2019-12-241-2/+7
| | | | | | | | | | | | | | | | | | tests Summary: Fix the behavior of StringRef::count(StringRef) to not count overlapping occurrences, as is stated in the documentation. Fixes bug https://bugs.llvm.org/show_bug.cgi?id=44072 I added Krzysztof Parzyszek to review this change because a use of this function in HexagonInstrInfo::getInlineAsmLength might depend on the overlapping-behavior. I don't have enough domain knowledge to tell if this change could break anything there. All other uses of this method in LLVM (besides the unit tests) only use single-character search strings. In those cases, search occurrences can not overlap anyway. Patch by Benno (@Bensge) Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D70585
* Revert "[Support] Extend TimeProfiler to support multiple threads"Russell Gallop2019-12-241-81/+17
| | | | | | | and "[Support] Try to fix bot failure after 8ddcd1dc26" This reverts commits f70f180148 and 8ddcd1dc26 as this was breaking the MacOS build, which doesn't support thread_local.
* Fix LLVM tool --version build mode printing for MSVCReid Kleckner2019-12-231-1/+23
| | | | | | | | | | | | | | | LLVM tools such as llc print "DEBUG build" or "Optimized build" when passed --version. Before this change, this was implemented by checking for the __OPTIMIZE__ GCC macro. MSVC does not define this macro. For MSVC, control this behavior with _DEBUG instead. It doesn't have precisely the same meaning, but in most configurations, it will do the right thing. Fixes PR17752 Reviewed by: MaskRay Differential Revision: https://reviews.llvm.org/D71817
* [CommandLine] Add template instantiations of cl::parser for long and long long.River Riddle2019-12-191-0/+24
| | | | | | | | This allows cl::opt<int64_t>. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D71729
* Fix more VFS tests on WindowsAdrian McCarthy2019-12-181-10/+33
| | | | | | | | | | | | Since VFS paths can be in either Posix or Windows style, we have to use a more flexible definition of "absolute" path. The key here is that FileSystem::makeAbsolute is now virtual, and the RedirectingFileSystem override checks for either concept of absolute before trying to make the path absolute by combining it with the current directory. Differential Revision: https://reviews.llvm.org/D70701
* llvm-cxxmap: fix support for remapping non-mangled names.Richard Smith2019-12-181-6/+22
| | | | | | | Remappings involving extern "C" names were already supported in the context of <local-name>s, but this support didn't work for remapping the complete mangling itself. (Eg, we would remap X<foo> but not foo itself, if foo is an extern "C" function.)
* Revert "[Support] Fix time trace multi threaded support with ↵Russell Gallop2019-12-171-1/+2
| | | | | | | | | LLVM_ENABLE_THREADS=OFF" This reverts commit 2bbcf156acc157377e814fbb1828a9fe89367ea2. This was failing on systems which use __thread such as http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/30851
* [Support] Fix time trace multi threaded support with LLVM_ENABLE_THREADS=OFFRussell Gallop2019-12-171-2/+1
| | | | | | | Following on from 8ddcd1dc26ba, which added the support. As pointed out on D71059 this does not build on some systems with LLVM_ENABLE_THREADS=OFF. Differential Revision: https://reviews.llvm.org/D71548
* [Support] Try to fix bot failure after 8ddcd1dc26Russell Gallop2019-12-121-0/+1
| | | | http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/41755
* [Support] Extend TimeProfiler to support multiple threadsRussell Gallop2019-12-121-17/+80
| | | | | | | | | | | | | | This makes TimeTraceProfilerInstance thread local. Added timeTraceProfilerFinishThread() which moves the thread local instance to a global vector of instances. timeTraceProfilerWrite() then writes recorded data from all instances. Threads are identified based on their thread ids. Totals are reported with artificial thread ids higher than the real ones. Replaced raw pointer for TimeTraceProfilerInstance with unique_ptr. Differential Revision: https://reviews.llvm.org/D71059
* [Support] Add TimeTraceScope constructor without detail argRussell Gallop2019-12-111-1/+3
| | | | | | | This simplifies code where no extra details are required Also don't write out detail when it is empty. Differential Revision: https://reviews.llvm.org/D71347
* [Signal] Allow one-shot SIGPIPE handler to be reachedVedant Kumar2019-12-041-5/+5
| | | | | | | As SIGPIPE is no longer in the IntSigs array, handle SIGPIPE before handling any interrupt signals. Thanks to Alexandre Ganea for pointing out the issue here.
* Reapply "[llvm][Support] Take in CurrentDirectory as a parameter in ↵Kadir Cetinkaya2019-12-041-28/+46
| | | | | | ExpandResponseFiles" Attemps to fix windows buildbots.
* Revert "[llvm][Support] Take in CurrentDirectory as a parameter in ↵Kadir Cetinkaya2019-12-041-46/+28
| | | | | | ExpandResponseFiles" This reverts commit 75656005dbc8866e1888932a68a830b0df403560.
OpenPOWER on IntegriCloud