summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
Commit message (Collapse)AuthorAgeFilesLines
...
* [ADT] APFloatBase: Prevent collapsing semPPCDoubleDouble and semBogusMichal Gorny2017-01-031-2/+6
| | | | | | | | | | | | | | | | | | | Provide a distinct contents for semBogus and semPPCDoubleDouble in order to prevent compilers from collapsing them to a single memory address, while we heavily rely on every semantic having distinct address. This happens if insecure optimization collapsing identical values is enabled. As a result, APFloats of semBogus are indistinguishable from semPPCDoubleDouble -- and whenever the move constructor is used, the old value beings being incorrectly recognized as a semPPCDoubleDouble. Since the values in semPPCDoubleDouble are not used anywhere, we can easily solve this issue via altering the value of one of the fields and therefore ensuring that the collapse can not occur. Differential Revision: https://reviews.llvm.org/D28112 llvm-svn: 290896
* [SmallPtrSet] Introduce a find primitive and rewrite count/erase in terms of itPhilip Reames2016-12-311-25/+0
| | | | | | | | This was originally motivated by a compile time problem I've since figured out how to solve differently, but the cleanup seemed useful. We had the same logic - which essentially implemented find - in several places. By commoning them out, I can implement find and allow erase to be inlined at the call sites if profitable. Differential Revision: https://reviews.llvm.org/D28183 llvm-svn: 290779
* [ADT] Delete RefCountedBaseVPTR.Justin Lebar2016-12-292-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This class is unnecessary. Its comment indicated that it was a compile error to allocate an instance of a class that inherits from RefCountedBaseVPTR on the stack. This may have been true at one point, but it's not today. Moreover you really do not want to allocate *any* refcounted object on the stack, vptrs or not, so if we did have a way to prevent these objects from being stack-allocated, we'd want to apply it to regular RefCountedBase too, obviating the need for a separate RefCountedBaseVPTR class. It seems that the main way RefCountedBaseVPTR provides safety is by making its subclass's destructor virtual. This may have been helpful at one point, but these days clang will emit an error if you define a class with virtual functions that inherits from RefCountedBase but doesn't have a virtual destructor. Reviewers: compnerd, dblaikie Subscribers: cfe-commits, klimek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D28162 llvm-svn: 290717
* Attempt to fix build bot after r290597Eugene Leviant2016-12-271-0/+3
| | | | llvm-svn: 290602
* Allow setting multiple debug typesEugene Leviant2016-12-271-2/+6
| | | | | | Differential revision: https://reviews.llvm.org/D28109 llvm-svn: 290597
* Add an assertion for cl::opt names: they can't start with '-'Mehdi Amini2016-12-231-0/+1
| | | | llvm-svn: 290467
* Add missing includes on Windows.Zachary Turner2016-12-211-0/+1
| | | | | | | Patch by Andrey Khalyavin Differential Revision: https://reviews.llvm.org/D27915 llvm-svn: 290263
* [APFloat] Remove 'else' after return. NFCTim Shen2016-12-211-13/+15
| | | | | | | | | | Reviewers: kbarton, iteratee, hfinkel, echristo Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D27934 llvm-svn: 290232
* Move GlobPattern class from LLD to llvm/Support.Rui Ueyama2016-12-202-0/+168
| | | | | | | | | | GlobPattern is a class to handle glob pattern matching. Currently only LLD is using that, but technically that feature is not specific to linkers, so in this patch I move that file to LLVM. Differential Revision: https://reviews.llvm.org/D27969 llvm-svn: 290212
* Add support for formatv to llvm::Twine.Zachary Turner2016-12-171-0/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D27835 llvm-svn: 290020
* Include <cstdarg> in PrettyStackTrace.cpp, fixing the bots.Sean Callanan2016-12-141-0/+1
| | | | llvm-svn: 289691
* Prepare PrettyStackTrace for LLDB adoptionSean Callanan2016-12-141-5/+21
| | | | | | | | | | | | This patch fixes the linkage for __crashtracer_info__, making it have the proper mangling (extern "C") and linkage (private extern). It also adds a new PrettyStackTrace type, allowing LLDB to adopt this instead of Host::SetCrashDescriptionWithFormat(). Without this patch, CrashTracer on macOS won't pick up pretty stack traces from any LLVM client. An LLDB commit adopting this API will follow shortly. Differential Revision: https://reviews.llvm.org/D27683 llvm-svn: 289689
* Replace APFloatBase static fltSemantics data members with getter functionsStephan Bergmann2016-12-142-85/+107
| | | | | | | | | | | | | At least the plugin used by the LibreOffice build (<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly uses those members (through inline functions in LLVM/Clang include files in turn using them), but they are not exported by utils/extract_symbols.py on Windows, and accessing data across DLL/EXE boundaries on Windows is generally problematic. Differential Revision: https://reviews.llvm.org/D26671 llvm-svn: 289647
* [ThinLTO] Add an API to trigger file-based API for returning objects to the ↵Mehdi Amini2016-12-142-0/+17
| | | | | | | | | | | | | | | | | | | | linker Summary: The motivation is to support better the -object_path_lto option on Darwin. The linker needs to write down the generate object files on disk for later use by lldb or dsymutil (debug info are not present in the final binary). We're moving this into libLTO so that we can be smarter when a cache is enabled and hard-link when possible instead of duplicating the files. Reviewers: tejohnson, deadalnix, pcc Subscribers: dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D27507 llvm-svn: 289631
* Don't double-initialize cl::opt for iterating in reverse order to uncover ↵Mehdi Amini2016-12-141-1/+1
| | | | | | | | | | | non-determinism in codegen by default Bots are broken and needs to be fixed before having this on by default. The feature was committed in r289619. I tried to disable it in r289624 and failed because it was initialized in two places. llvm-svn: 289626
* [llvm] Iterate SmallPtrSet in reverse order to uncover non-determinism in ↵Mandeep Singh Grang2016-12-141-0/+11
| | | | | | | | | | | | | | | | | | codegen Summary: Given a flag (-mllvm -reverse-iterate) this patch will enable iteration of SmallPtrSet in reverse order. The idea is to compile the same source with and without this flag and expect the code to not change. If there is a difference in codegen then it would mean that the codegen is sensitive to the iteration order of SmallPtrSet. This is enabled only with LLVM_ENABLE_ABI_BREAKING_CHECKS. Reviewers: chandlerc, dexonsmith, mehdi_amini Subscribers: mgorny, emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D26718 llvm-svn: 289619
* [APFloat] Implement PPCDoubleDouble add and subtract.Tim Shen2016-12-121-3/+207
| | | | | | | | | | | | Summary: I looked at libgcc's implementation (which is based on the paper, Software for Doubled-Precision Floating-Point Computations", by Seppo Linnainmaa, ACM TOMS vol 7 no 3, September 1981, pages 272-283.) and made it generic to arbitrary IEEE floats. Differential Revision: https://reviews.llvm.org/D26817 llvm-svn: 289472
* Tweak the core loop in StringRef::find to avoid calling memcmp on everyChandler Carruth2016-12-111-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | iteration. Instead, load the byte at the needle length, compare it directly, and save it to use in the lookup table of lengths we can skip forward. I also added an annotation to expect that the comparison fails so that the loop gets laid out contiguously without the call to memcpy (and the substantial register shuffling that the ABI requires of that call). Finally, because this behaves especially badly with a needle length of one (by calling memcmp with a zero length) special case that to directly call memchr, which is what we should have been doing anyways. This was motivated by the fact that there are a large number of test cases in 'check-llvm' where FileCheck's performance is dominated by calls to StringRef::find (in a release, no-asserts build). I'm working on patches to generally improve matters there, but this alone was worth a 12.5% improvement in one test case where FileCheck spent 92% of its time in this routine. I experimented a bunch with different minor variations on this theme, for example setting the pointer *at* the last byte and indexing backwards for the call to memcmp. That didn't improve anything on this version and seemed more complex. I also tried other things to make the loop flow more nicely and none worked. =/ It is a bit unfortunate, the generated code here remains pretty gross, but I don't see any obvious ways to improve it. At this point, most of my ideas would be really elaborate: 1) While the remainder of the string is long enough, we could load a 16-byte or 32-byte vector at the address of the last byte and use palignr to rotate that and check the first 15- or 31-bytes at the front of the next segment, essentially pre-loading the first several bytes of the next iteration so we could quickly detect a mismatch in those bytes without an additional memory access. Down side would be the code complexity, having a fallback loop, and likely misaligned vector load. Plus it would make the common case of the last byte not matching somewhat slower (need some extraction from a vector). 2) While we have space, we could do an aligned load of a 16- or 32-byte vector that *contains* the end byte, and use any peceding bytes to have a more precise "no" test, and any subsequent bytes could be saved for the next iteration. This remove any unaligned load penalty, but still requires us to pay the overhead of vector extraction for the cases where we didn't need to do anything other than load and compare the last byte. 3) Try to walk from the last byte in a way that is more friendly to cache and/or memory pre-fetcher considering we have to poke the last byte anyways. No idea if any of these are really worth pursuing though. They all seem somewhat unlikely to yield big wins in practice and to be a lot of work and complexity. So I settled here, which at least seems like a strict improvement over the previous version. llvm-svn: 289373
* Re-commit r289184, "Support: Use a 64-bit seek in raw_fd_ostream::seek()." ↵Peter Collingbourne2016-12-091-0/+6
| | | | | | with a configure-time check for lseek64. llvm-svn: 289187
* Revert r289184, we need more configury for Darwin and *BSD.Peter Collingbourne2016-12-091-5/+1
| | | | llvm-svn: 289185
* Support: Use a 64-bit seek in raw_fd_ostream::seek().Peter Collingbourne2016-12-091-1/+5
| | | | llvm-svn: 289184
* Fix the apple build issue caused by r288956Chris Bieneman2016-12-071-1/+1
| | | | | | Should be checking if HAVE_CRASHREPORTERCLIENT_H is defined not relying on it having a value. llvm-svn: 288963
* [DIExpression] Introduce a dedicated DW_OP_LLVM_fragment operationAdrian Prantl2016-12-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | so we can stop using DW_OP_bit_piece with the wrong semantics. The entire back story can be found here: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20161114/405934.html The gist is that in LLVM we've been misinterpreting DW_OP_bit_piece's offset field to mean the offset into the source variable rather than the offset into the location at the top the DWARF expression stack. In order to be able to fix this in a subsequent patch, this patch introduces a dedicated DW_OP_LLVM_fragment operation with the semantics that we used to apply to DW_OP_bit_piece, which is what we actually need while inside of LLVM. This patch is complete with a bitcode upgrade for expressions using the old format. It does not yet fix the DWARF backend to use DW_OP_bit_piece correctly. Implementation note: We discussed several options for implementing this, including reserving a dedicated field in DIExpression for the fragment size and offset, but using an custom operator at the end of the expression works just fine and is more efficient because we then only pay for it when we need it. Differential Revision: https://reviews.llvm.org/D27361 rdar://problem/29335809 llvm-svn: 288683
* Support escaping in TrigramIndex.Ivan Krasin2016-12-021-12/+25
| | | | | | | | | | | | | | | | | | Summary: This is a follow up to r288303, where I have introduced TrigramIndex to speed up SpecialCaseList for the cases when all rules are simple wildcards, like *hello*wor.d*. Here, I add support for escaping, so that it's possible to specify rules like *c\+\+abi*. Reviewers: pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27318 llvm-svn: 288553
* Use trigrams to speed up SpecialCaseList.Ivan Krasin2016-12-013-2/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: it's often the case when the rules in the SpecialCaseList are of the form hel.o*bar. That gives us a chance to build trigram index to quickly discard 99% of inputs without running a full regex. A similar idea was used in Google Code Search as described in the blog post: https://swtch.com/~rsc/regexp/regexp4.html The check is defeated, if there's at least one regex more complicated than that. In this case, all inputs will go through the regex. That said, the real-world rules are often simple or can be simplied. That considerably speeds up compiling Chromium with CFI and UBSan. As measured on Chromium's content_message_generator.cc: before, CFI: 44 s after, CFI: 23 s after, CFI, no blacklist: 23 s (~1% slower, but 3 runs were unable to show the difference) after, regular compilation to bitcode: 23 s Reviewers: pcc Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D27188 llvm-svn: 288303
* [WebAssembly] Add llvm-objdump support for wasm file formatDerek Schuff2016-11-301-0/+2
| | | | | | | | | | | This is the first part of an effort to add wasm binary support across all llvm tools. Patch by Sam Clegg Differential Revision: https://reviews.llvm.org/D26172 llvm-svn: 288251
* [Support] Use HAVE_DLOPEN to guard dlopen(3) usagePavel Labath2016-11-301-2/+2
| | | | | | | | | | | | | | | | Summary: The usage was previously guarded by HAVE_DLFCN. This breaks on Android with LLVM_BUILD_STATIC as the platform does not provide a static version of libdl. Using HAVE_DLOPEN fixes it as the code will only get used if we are actually able to link an executable using dlopen. Reviewers: rafael, beanz Subscribers: tberghammer, danalbert, llvm-commits Differential Revision: https://reviews.llvm.org/D26504 llvm-svn: 288246
* Apply clang-tidy's 'performance-faster-string-find' check to LLVM.Benjamin Kramer2016-11-301-1/+1
| | | | | | No functionality change intended. llvm-svn: 288235
* Fix a linefeed at eof.NAKAMURA Takumi2016-11-291-1/+1
| | | | llvm-svn: 288167
* Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatchMehdi Amini2016-11-281-0/+15
| | | | | | | | | | | | | | | | | | | | The macro LLVM_ENABLE_ABI_BREAKING_CHECKS is moved to a new header abi-breaking.h, from llvm-config.h. Only headers that are using the macro are including this new header. LLVM will define a symbol, either EnableABIBreakingChecks or DisableABIBreakingChecks depending on the configuration setting for LLVM_ABI_BREAKING_CHECKS. The abi-breaking.h header will add weak references to these symbols in every clients that includes this header. This should ensure that a mismatch triggers a link failure (or a load time failure for DSO). On MSVC, the pragma "detect_mismatch" is used instead. Differential Revision: https://reviews.llvm.org/D26876 llvm-svn: 288082
* Improve error handling in YAML parsingMehdi Amini2016-11-282-17/+26
| | | | | | | | | | | | Some scanner errors were not checked and reported by the parser. Fix PR30934. Recommit r288014 after fixing unittest. Patch by: Serge Guelton <serge.guelton@telecom-bretagne.eu> Differential Revision: https://reviews.llvm.org/D26419 llvm-svn: 288071
* [ThreadPool] Rollback recent changes until I figure out the breakage.Davide Italiano2016-11-281-2/+4
| | | | llvm-svn: 288018
* [ThreadPool] Simplify the interface. NFCI.Davide Italiano2016-11-281-4/+2
| | | | | | | The callers don't use the return value. Found by Michael Spencer. llvm-svn: 288016
* Revert "Improve error handling in YAML parsing"Mehdi Amini2016-11-281-11/+9
| | | | | | This reverts commit r288014, the unittest isn't passing llvm-svn: 288015
* Improve error handling in YAML parsingMehdi Amini2016-11-281-9/+11
| | | | | | | | | | | | Some scanner errors were not checked and reported by the parser. Fix PR30934 Patch by: Serge Guelton <serge.guelton@telecom-bretagne.eu> Differential Revision: https://reviews.llvm.org/D26419 llvm-svn: 288014
* Revert "[Triple] Add Facebook vendor"Daniel Berlin2016-11-231-2/+0
| | | | | | | | | | This reverts commit r287684 Objections on the review thread had not been addressed to prior to commit. I asked the committer to revert, but i expect they are gone for the US holiday or something. llvm-svn: 287798
* [MD5] Use write32le instead of spelling it out with shifts.Benjamin Kramer2016-11-231-24/+6
| | | | | | No functionality change intended. llvm-svn: 287757
* Fix builbots.Rui Ueyama2016-11-231-1/+1
| | | | llvm-svn: 287735
* Add convenient functions to compute hashes of byte vectors.Rui Ueyama2016-11-232-0/+20
| | | | | | | | | In many sitautions, you just want to compute a hash for one chunk of data. This patch adds convenient functions for that purpose. Differential Revision: https://reviews.llvm.org/D26988 llvm-svn: 287726
* [Triple] Add Facebook vendorShoaib Meenai2016-11-221-0/+2
| | | | | | | | | Add a compiler vendor for Facebook, to enable future vendor-specific behavior. Differential Revision: https://reviews.llvm.org/D25136 llvm-svn: 287684
* Fix comment typos. NFC.Simon Pilgrim2016-11-201-1/+1
| | | | | | Identified by Pedro Giffuni in PR27636. llvm-svn: 287490
* Fix file name resolution in nested response filesSerge Pavlov2016-11-201-0/+6
| | | | | | | | | | If a response file in construct `@file` was specified by relative name, constructs `@file` nested within it were resolved incorrectly if the flag RelativeNames in call to ExpandResponseFile was set to true. This feature is used in configuration files, tests for it are in respective change (see D24933). llvm-svn: 287482
* Attempt to fix big-endian buildbots.Rui Ueyama2016-11-201-7/+0
| | | | llvm-svn: 287476
* Style fix. NFC.Rui Ueyama2016-11-201-7/+7
| | | | llvm-svn: 287475
* Fix buildbot.Rui Ueyama2016-11-201-2/+2
| | | | llvm-svn: 287474
* SHA1: unroll loop in hashBlock.Rui Ueyama2016-11-201-44/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code is taken from public domain. https://github.com/jsonn/src/blob/trunk/common/lib/libc/hash/sha1/sha1.c I wrote a sha1 command and ran it on my Xeon E5-2680 v2 2.80GHz machine. Here is a result. The new hash function is 37% faster than before. Performance counter stats for './llvm-sha1-old /ssd/build/bin/lld' (10 runs): 6640.503687 task-clock (msec) # 1.001 CPUs utilized ( +- 0.03% ) 54 context-switches # 0.008 K/sec ( +- 5.03% ) 5 cpu-migrations # 0.001 K/sec ( +- 31.73% ) 183,803 page-faults # 0.028 M/sec ( +- 0.00% ) 18,527,954,113 cycles # 2.790 GHz ( +- 0.03% ) 4,993,237,485 stalled-cycles-frontend # 26.95% frontend cycles idle ( +- 0.11% ) <not supported> stalled-cycles-backend 50,217,149,423 instructions # 2.71 insns per cycle # 0.10 stalled cycles per insn ( +- 0.00% ) 6,094,322,337 branches # 917.750 M/sec ( +- 0.00% ) 11,778,239 branch-misses # 0.19% of all branches ( +- 0.01% ) 6.634017401 seconds time elapsed ( +- 0.03% ) Performance counter stats for './llvm-sha1-new /ssd/build/bin/lld' (10 runs): 4167.062720 task-clock (msec) # 1.001 CPUs utilized ( +- 0.02% ) 52 context-switches # 0.012 K/sec ( +- 16.45% ) 7 cpu-migrations # 0.002 K/sec ( +- 32.20% ) 183,804 page-faults # 0.044 M/sec ( +- 0.00% ) 11,626,611,958 cycles # 2.790 GHz ( +- 0.02% ) 4,491,897,976 stalled-cycles-frontend # 38.63% frontend cycles idle ( +- 0.05% ) <not supported> stalled-cycles-backend 24,320,180,617 instructions # 2.09 insns per cycle # 0.18 stalled cycles per insn ( +- 0.00% ) 1,574,674,576 branches # 377.886 M/sec ( +- 0.00% ) 11,769,693 branch-misses # 0.75% of all branches ( +- 0.00% ) 4.163251552 seconds time elapsed ( +- 0.02% ) Differential Revision: https://reviews.llvm.org/D26890 llvm-svn: 287473
* Revert "Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatch"Mehdi Amini2016-11-181-16/+0
| | | | | | This reverts commit r287352, LLDB CI is broken. llvm-svn: 287374
* Statistic/Timer: Include timers in PrintStatisticsJSON().Matthias Braun2016-11-182-27/+67
| | | | | | Differential Revision: https://reviews.llvm.org/D25588 llvm-svn: 287370
* Timer: Track name and description.Matthias Braun2016-11-181-18/+23
| | | | | | | | | | | | | The previously used "names" are rather descriptions (they use multiple words and contain spaces), use short programming language identifier like strings for the "names" which should be used when exporting to machine parseable formats. Also removed a unused TimerGroup from Hexxagon. Differential Revision: https://reviews.llvm.org/D25583 llvm-svn: 287369
* Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatchMehdi Amini2016-11-181-0/+16
| | | | | | | | | | | | | | | | | | | | | Summary: LLVM will define a symbol, either EnableABIBreakingChecks or DisableABIBreakingChecks depending on the configuration setting for LLVM_ABI_BREAKING_CHECKS. The llvm-config.h header will add weak references to these symbols in every clients that includes this header. This should ensure that a mismatch triggers a link failure (or a load time failure for DSO). On MSVC, the pragma "detect_mismatch" is used instead. Reviewers: rnk, jroelofs Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D26841 llvm-svn: 287352
OpenPOWER on IntegriCloud