summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader
Commit message (Collapse)AuthorAgeFilesLines
...
* Add support for metadata attachments for global variables.Peter Collingbourne2016-05-311-9/+30
| | | | | | | | | | This patch adds an IR, assembly and bitcode representation for metadata attachments for globals. Future patches will port existing features to use these new attachments. Differential Revision: http://reviews.llvm.org/D20074 llvm-svn: 271348
* Remove some 'const' specifiers that do nothing but prevent moving the argument.Benjamin Kramer2016-05-291-1/+1
| | | | | | | Found by clang-tidy's misc-move-const-arg. While there drop some obsolete c_str() calls. llvm-svn: 271181
* Apply clang-tidy's misc-move-constructor-init throughout LLVM.Benjamin Kramer2016-05-271-2/+3
| | | | | | No functionality change intended, maybe a tiny performance improvement. llvm-svn: 270997
* Objective-C Class Properties: Autoupgrade "Class Properties" module flag.Manman Ren2016-05-251-0/+2
| | | | | | | | | | When we have "Image Info Version" module flag but don't have "Class Properties" module flag, set "Class Properties" module flag to 0, so we can correctly emit errors when one module has the flag set and another module does not. rdar://26469641 llvm-svn: 270791
* Add FIXMEs to all derived classes of std::error_category.Peter Collingbourne2016-05-241-0/+3
| | | | | | | | This helps make clear that we're moving away from std::error_code. Differential Revision: http://reviews.llvm.org/D20592 llvm-svn: 270604
* Implement a safer bitcode upgrade for DISubprogram.Adrian Prantl2016-05-061-5/+7
| | | | | | | | | | | | | | | | | | The bitcode upgrade I added for DISubprogram in r266446 was based on the assumption that the CU node for the subprogram was already materialized by the time the DISubprogram is visited. This assumption may not hold true as future versions of LLVM may decide to write out bitcode in a different order. This patch corrects this by introducing a versioning bit next to the distinct flag to unambiguously differentiate the new from the old record layouts. Note for people stabilizing LLVM out-of-tree: This patch introduces a bitcode incompatibility with llvm trunk revisions from r266446 — this commit. (But D19987 will ensure that it degrades gracefully). http://reviews.llvm.org/D20004 rdar://problem/26074194 llvm-svn: 268816
* [ThinLTO] Remove missed piece of lazy summary reading support (NFC)Teresa Johnson2016-05-051-48/+0
| | | | | | Missed in r267097. llvm-svn: 268597
* [ThinLTO] Use valueid instead of bitcode offsets in combined index fileTeresa Johnson2016-04-271-56/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With the removal of support for lazy parsing of combined index summary records (e.g. r267344), we no longer need to include the summary record bitcode offset in the VST entries for definitions. Change the combined index format to be similar to the per-module index format in using value ids to cross-reference from the summary record to the VST entry (rather than the summary record bitcode offset to cross-reference in the other direction). The visible changes are: 1) Add the value id to the combined summary records 2) Remove the summary offset from the combined VST records, which has the following effects: - No longer need the VST_CODE_COMBINED_GVDEFENTRY record, as all combined index VST entries now only contain the value id and corresponding GUID. - No longer have duplicate VST entries in the case where there are multiple definitions of a symbol (e.g. weak/linkonce), as they all have the same value id and GUID. An implication of #2 above is that in order to hook up an alias to the correct aliasee based on the value id of the aliasee recorded in the combined index alias record, we need to scan the entries in the index for that GUID to find the one from the same module (i.e. the case where there are multiple entries for the aliasee). But the reader no longer has to maintain a special map to hook up the alias/aliasee. Reviewers: joker.eph Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D19481 llvm-svn: 267712
* BitcodeReader: Delay metadata parsing until reading a function bodyDuncan P. N. Exon Smith2016-04-241-3/+7
| | | | | | | | | | | | There's hardly any functionality change here. Instead of calling materializeMetadata on the first call to materialize(GlobalValue*), wait until the first one that's actually going to do something. Noticed by inspection; I don't have a concrete case where this makes a difference. Added an assertion in materializeMetadata to be sure this (or a future change) doesn't delay materializeMetadata after function-level metadata. llvm-svn: 267345
* [ThinLTO] Remove GlobalValueInfo class from indexTeresa Johnson2016-04-241-50/+34
| | | | | | | | | | | | | | | | Summary: Remove the GlobalValueInfo and change the ModuleSummaryIndex to directly reference summary objects. The info structure was there to support lazy parsing of the combined index summary objects, which is no longer needed and not supported. Reviewers: joker.eph Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D19462 llvm-svn: 267344
* BitcodeReader: Fix some holes in upgrade from r267296Duncan P. N. Exon Smith2016-04-241-8/+22
| | | | | | | | | | | | | | Add tests for some missing cases to bitcode upgrade in r267296. - DICompositeType with an 'elements:' field, which will cause it to be involved in a cycle after the upgrade. - A DIDerivedType that references a class in 'extraData:'. I updated test/Bitcode/dityperefs-3.8.ll with the missing cases and regenerated test/Bitcode/dityperefs-3.8.ll.bc. llvm-svn: 267332
* Add "hasSection" flag in the SummaryMehdi Amini2016-04-241-1/+3
| | | | | | | | | | | Reviewers: tejohnson Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19405 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267329
* Reorganize GlobalValueSummary with a "Flags" bitfield.Mehdi Amini2016-04-241-24/+38
| | | | | | | | | | Right now it only contains the LinkageType, but will be extended with "hasSection", "isOptSize", "hasInlineAssembly", etc. Differential Revision: http://reviews.llvm.org/D19404 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267319
* Add a version field in the bitcode for the summaryMehdi Amini2016-04-241-1/+14
| | | | | | | Differential Revision: http://reviews.llvm.org/D19456 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267318
* Store and emit original name in combined indexMehdi Amini2016-04-231-25/+63
| | | | | | | | | | | | | | | | | | | Summary: As discussed in D18298, some local globals can't be renamed/promoted (because they have a section, or because they are referenced from inline assembly). To be able to detect naming collision, we need to keep around the "GUID" using their original name without taking the linkage into account. Reviewers: tejohnson Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D19454 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267304
* BitcodeReader: Avoid std::vector with non-movable types from r267296Duncan P. N. Exon Smith2016-04-231-1/+1
| | | | | | | | | | r267298 didn't quite fix the build errors. Use SmallVector instead of std::vector, the latter of which I think is trying to maintain a strong exception safety guarantee. http://lab.llvm.org:8011/builders/lldb-amd64-ninja-freebsd11/builds/6228 llvm-svn: 267299
* BitcodeReader: Avoid non-moving std::piecewise_construct from r267296Duncan P. N. Exon Smith2016-04-231-3/+3
| | | | | | | | | Not exactly sure why the host tries to use a copy constructor here, but it's easy enough to work around it. http://lab.llvm.org:8011/builders/lldb-amd64-ninja-freebsd11/builds/6227 llvm-svn: 267298
* DebugInfo: Remove MDString-based type referencesDuncan P. N. Exon Smith2016-04-231-23/+130
| | | | | | | | | | | | | | | | | | | | | | | | Eliminate DITypeIdentifierMap and make DITypeRef a thin wrapper around DIType*. It is no longer legal to refer to a DICompositeType by its 'identifier:', and DIBuilder no longer retains all types with an 'identifier:' automatically. Aside from the bitcode upgrade, this is mainly removing logic to resolve an MDString-based reference to an actualy DIType. The commits leading up to this have made the implicit type map in DICompileUnit's 'retainedTypes:' field superfluous. This does not remove DITypeRef, DIScopeRef, DINodeRef, and DITypeRefArray, or stop using them in DI-related metadata. Although as of this commit they aren't serving a useful purpose, there are patchces under review to reuse them for CodeView support. The tests in LLVM were updated with deref-typerefs.sh, which is attached to the thread "[RFC] Lazy-loading of debug info metadata": http://lists.llvm.org/pipermail/llvm-dev/2016-April/098318.html llvm-svn: 267296
* Avoid MSVC failure with default arguments in lambdas from r267270Duncan P. N. Exon Smith2016-04-231-7/+10
| | | | | | http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11700 llvm-svn: 267277
* Avoid ternery statement to please g++ after r267270, NFCDuncan P. N. Exon Smith2016-04-231-1/+3
| | | | | | http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/36074 llvm-svn: 267272
* BitcodeReader: Avoid referencing unresolved nodes from distinct onesDuncan P. N. Exon Smith2016-04-231-6/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each reference to an unresolved MDNode is expensive, since the RAUW support in MDNode uses a separate allocation and side map. Since a distinct MDNode doesn't require its operands on creation (unlike uniuqed nodes, there's no need to check for structural equivalence), use nullptr for any of its unresolved operands. Besides reducing the burden on MDNode maps, this can avoid allocating temporary MDNodes in the first place. We need some way to track operands. Invent DistinctMDOperandPlaceholder for this purpose, which is a Metadata subclass that holds an ID and points at its single user. DistinctMDOperandPlaceholder::replaceUseWith is just like RAUW, but its name highlights that there is only ever exactly one use. There is no support for moving (or, obviously, copying) these. Move support would be possible but expensive; leaving it unimplemented prevents user error. In the BitcodeReader I originally considered allocating on a BumpPtrAllocator and keeping a vector of pointers to them, and then I realized that std::deque implements exactly this. A couple of obvious follow-ups: - Change ValueEnumerator to emit distinct nodes first to take more advantage of this optimization. (How convenient... I think I might have a couple of patches for this.) - Change DIBuilder and its consumers (like CGDebugInfo in clang) to use something like this when constructing debug info in the first place. llvm-svn: 267270
* BitcodeReader: Consistently use IsDistinct, NFCDuncan P. N. Exon Smith2016-04-231-33/+52
| | | | | | | | Consistently use the IsDistinct variable and start relying on it in GET_OR_DISTINCT. This change has NFC, but prepares for using IsDistinct to optimize the behaviour of the getMD() and getMDOrNull() helpers. llvm-svn: 267268
* BitcodeReader: Use getMD/getMDOrNull helpers consistently, almost NFCDuncan P. N. Exon Smith2016-04-231-10/+5
| | | | | | | | | | The only functionality change was removing an error check from the BitcodeReader (and an assertion from DILocation::getImpl) that is already caught by Verifier::visitDILocation. The Verifier is a better place for this anyway, and being inconsistent with other subclasses of MDNode isn't serving anyone. llvm-svn: 267267
* [ThinLTO] Remove unused/incomplete lazy summary reading support (NFC)Teresa Johnson2016-04-221-63/+11
| | | | | | | | | | | | | | This removes the interfaces added (and not yet complete) to support lazy reading of summaries. This support is not expected to be needed since we are moving to a model where the full index is only being traversed in the thin link step, instead of the back ends. (The second part of this that I plan to do next is remove the GlobalValueInfo from the ModuleSummaryIndex - it was mostly needed to support lazy parsing of summaries. The index can instead reference the summary structures directly.) llvm-svn: 267097
* IR: Use SmallVector instead of std::vector of TrackingMDRefDuncan P. N. Exon Smith2016-04-201-1/+6
| | | | | | | | | | Don't use std::vector<TrackingMDRef>, since (at least in some versions of libc++) std::vector apparently copies values on grow operations instead of moving them. Found this when I was temporarily deleting the copy constructor for TrackingMDRef to investigate a performance bottleneck. llvm-svn: 266909
* IR: Enable debug info type ODR uniquing for forward declsDuncan P. N. Exon Smith2016-04-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Add a new method, DICompositeType::buildODRType, that will create or mutate the DICompositeType for a given ODR identifier, and use it in LLParser and BitcodeReader instead of DICompositeType::getODRType. The logic is as follows: - If there's no node, create one with the given arguments. - Else, if the current node is a forward declaration and the new arguments would create a definition, mutate the node to match the new arguments. - Else, return the old node. This adds a missing feature supported by the current DITypeIdentifierMap (which I'm slowly making redudant). The only remaining difference is that the DITypeIdentifierMap has a "the-last-one-wins" rule, whereas DICompositeType::buildODRType has a "the-first-one-wins" rule. For now I'm leaving behind DICompositeType::getODRType since it has obvious, low-level semantics that are convenient for unit testing. llvm-svn: 266786
* IR: getOrInsertODRUniquedType => DICompositeType::getODRType, NFCDuncan P. N. Exon Smith2016-04-191-16/+27
| | | | | | | | | | | | | | Lift the API for debug info ODR type uniquing up a layer. Instead of clients managing the map directly on the LLVMContext, add a static method to DICompositeType called getODRType and handle the map in the background. Also adds DICompositeType::getODRTypeIfExists, so far just for convenience in the unit tests. This simplifies the logic in LLParser and BitcodeReader. Because of argument spam there are actually a few more lines of code now; I'll see if I come up with a reasonable way to clean that up. llvm-svn: 266742
* IR: Require DICompositeType for ODR uniquing type mapDuncan P. N. Exon Smith2016-04-191-2/+2
| | | | | | | | Tighten up the API for debug info ODR type uniquing in LLVMContext. The only reason to allow other DIType subclasses is to make the unit tests prettier :/. llvm-svn: 266737
* IR: Rename API for enabling ODR uniquing of DITypes, NFCDuncan P. N. Exon Smith2016-04-191-1/+1
| | | | | | | | | | | As per David's review, rename everything in the new API for ODR type uniquing of debug info. ensureDITypeMap => enableDebugTypeODRUniquing destroyDITypeMap => disableDebugTypeODRUniquing hasDITypeMap => isODRUniquingDebugTypes llvm-svn: 266713
* IR: Use an explicit map for debug info type uniquingDuncan P. N. Exon Smith2016-04-171-10/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than relying on the structural equivalence of DICompositeType to merge type definitions, use an explicit map on the LLVMContext that LLParser and BitcodeReader consult when constructing new nodes. Each non-forward-declaration DICompositeType with a non-empty 'identifier:' field is stored/loaded from the type map, and the first definiton will "win". This map is opt-in: clients that expect ODR types from different modules to be merged must call LLVMContext::ensureDITypeMap. - Clients that just happen to load more than one Module in the same LLVMContext won't magically merge types. - Clients (like LTO) that want to continue to merge types based on ODR identifiers should opt-in immediately. I have updated LTOCodeGenerator.cpp, the two "linking" spots in gold-plugin.cpp, and llvm-link (unless -disable-debug-info-type-map) to set this. With this in place, it will be straightforward to remove the DITypeRef concept (i.e., referencing types by their 'identifier:' string rather than pointing at them directly). llvm-svn: 266549
* ThinLTO: Make aliases explicit in the summaryMehdi Amini2016-04-161-0/+51
| | | | | | | | | | | To be able to work accurately on the reference graph when taking decision about internalizing, promoting, renaming, etc. We need to have the alias information explicit. Differential Revision: http://reviews.llvm.org/D18836 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266517
* [PR27284] Reverse the ownership between DICompileUnit and DISubprogram.Adrian Prantl2016-04-151-16/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently each Function points to a DISubprogram and DISubprogram has a scope field. For member functions the scope is a DICompositeType. DIScopes point to the DICompileUnit to facilitate type uniquing. Distinct DISubprograms (with isDefinition: true) are not part of the type hierarchy and cannot be uniqued. This change removes the subprograms list from DICompileUnit and instead adds a pointer to the owning compile unit to distinct DISubprograms. This would make it easy for ThinLTO to strip unneeded DISubprograms and their transitively referenced debug info. Motivation ---------- Materializing DISubprograms is currently the most expensive operation when doing a ThinLTO build of clang. We want the DISubprogram to be stored in a separate Bitcode block (or the same block as the function body) so we can avoid having to expensively deserialize all DISubprograms together with the global metadata. If a function has been inlined into another subprogram we need to store a reference the block containing the inlined subprogram. Attached to https://llvm.org/bugs/show_bug.cgi?id=27284 is a python script that updates LLVM IR testcases to the new format. http://reviews.llvm.org/D19034 <rdar://problem/25256815> llvm-svn: 266446
* Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini2016-04-141-3/+2
| | | | | | | | | | | At the same time, fixes InstructionsTest::CastInst unittest: yes you can leave the IR in an invalid state and exit when you don't destroy the context (like the global one), no longer now. This is the first part of http://reviews.llvm.org/D19094 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266379
* Revert "Make aliases explicit in the summary"Mehdi Amini2016-04-131-51/+0
| | | | | | | | | Inadvertently commited... This reverts commit e618ec93786d99df2ddf280ad2d5e02f5516cecf. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266215
* Make aliases explicit in the summaryMehdi Amini2016-04-131-0/+51
| | | | | | | | | | | | | | | | Summary: To be able to work accurately on the reference graph when taking decision about internalizing, promoting, renaming, etc. We need to have the alias information explicit. Reviewers: tejohnson Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18836 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266214
* Add the allocsize attribute to LLVM.George Burgess IV2016-04-121-0/+4
| | | | | | | | | | | | | | | | `allocsize` is a function attribute that allows users to request that LLVM treat arbitrary functions as allocation functions. This patch makes LLVM accept the `allocsize` attribute, and makes `@llvm.objectsize` recognize said attribute. The review for this was split into two patches for ease of reviewing: D18974 and D14933. As promised on the revisions, I'm landing both patches as a single commit. Differential Revision: http://reviews.llvm.org/D14933 llvm-svn: 266032
* [GCC] Attribute ifunc support in llvmDmitry Polukhin2016-04-071-3/+6
| | | | | | | | | | | This patch add support for GCC attribute((ifunc("resolver"))) for targets that use ELF as object file format. In general ifunc is a special kind of function alias with type @gnu_indirect_function. Patch for Clang http://reviews.llvm.org/D15524 Differential Revision: http://reviews.llvm.org/D15525 llvm-svn: 265667
* NFC: make AtomicOrdering an enum classJF Bastien2016-04-061-17/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In the context of http://wg21.link/lwg2445 C++ uses the concept of 'stronger' ordering but doesn't define it properly. This should be fixed in C++17 barring a small question that's still open. The code currently plays fast and loose with the AtomicOrdering enum. Using an enum class is one step towards tightening things. I later also want to tighten related enums, such as clang's AtomicOrderingKind (which should be shared with LLVM as a 'C++ ABI' enum). This change touches a few lines of code which can be improved later, I'd like to keep it as NFC for now as it's already quite complex. I have related changes for clang. As a follow-up I'll add: bool operator<(AtomicOrdering, AtomicOrdering) = delete; bool operator>(AtomicOrdering, AtomicOrdering) = delete; bool operator<=(AtomicOrdering, AtomicOrdering) = delete; bool operator>=(AtomicOrdering, AtomicOrdering) = delete; This is separate so that clang and LLVM changes don't need to be in sync. Reviewers: jyknight, reames Subscribers: jyknight, llvm-commits Differential Revision: http://reviews.llvm.org/D18775 llvm-svn: 265602
* [IFUNC] Use GlobalIndirectSymbol when aliases and ifuncs have something similarDmitry Polukhin2016-04-051-19/+26
| | | | | | | | | | | Second part extracted from http://reviews.llvm.org/D15525 Use GlobalIndirectSymbol in all cases when aliases and ifuncs have something in common. Differential Revision: http://reviews.llvm.org/D18754 llvm-svn: 265382
* [ThinLTO] Refactor some common code into getGlobalValueInfo method (NFC)Teresa Johnson2016-04-051-12/+2
| | | | | | | | Refactor common code that queries the ModuleSummaryIndex for a value's GlobalValueInfo struct into getGlobalValueInfo helper methods, which will also be used by D18763. llvm-svn: 265370
* [ThinLTO] Add option to dump value name to GUID mappingTeresa Johnson2016-04-041-5/+17
| | | | | | | | | | | | | | | Summary: Useful for debugging since we lose this correlation after the permodule summary/VST is read and until we later materialize source modules in the function importer. Reviewers: joker.eph Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D18555 llvm-svn: 265327
* BitcodeReader: Check for unresolved function metadataDuncan P. N. Exon Smith2016-04-021-2/+12
| | | | | | | | | | | | | | A follow-up commit will start using function metadata blocks more heavily. This commit adds some error checking to confirm that metadata is fully resolved before (and after) materializing each function. This is valid even when reading very old bitcode from before the metadata/value split. The global metadata block always came before the function blocks. However, in case somehow this causes a regression (i.e., an old LLVM did produce such bitcode after all) I'm committing separately. llvm-svn: 265223
* Create a typedef GlobalValue::GUID for uint64_t and RAUW (NFC)Mehdi Amini2016-04-021-13/+14
| | | | | | | | | | | | | Summary: This should make the code more readable, especially all the map declarations. Reviewers: tejohnson Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18721 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 265215
* Swift Calling Convention: add swifterror attribute.Manman Ren2016-04-011-3/+7
| | | | | | | | | | | | A ``swifterror`` attribute can be applied to a function parameter or an AllocaInst. This commit does not include any target-specific change. The target-specific optimization will come as a follow-up patch. Differential Revision: http://reviews.llvm.org/D18092 llvm-svn: 265189
* Add a module Hash in the bitcode and the combined index, implementing a kind ↵Mehdi Amini2016-04-011-10/+44
| | | | | | | | | | | | | of "build-id" This is intended to be used for ThinLTO incremental build. Differential Revision: http://reviews.llvm.org/D18213 This is a recommit of r265095 after fixing the Windows issues. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 265111
* Revert "Add support for computing SHA1 in LLVM"Mehdi Amini2016-04-011-44/+10
| | | | | | | | This reverts commit r265096, r265095, and r265094. Windows build is broken, and the validation does not pass. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 265102
* Add a module Hash in the bitcode and the combined index, implementing a kind ↵Mehdi Amini2016-04-011-10/+44
| | | | | | | | | | | of "build-id" This is intended to be used for ThinLTO incremental build. Differential Revision: http://reviews.llvm.org/D18213 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 265095
* BitcodeReader: Fix weird whitespace, NFCDuncan P. N. Exon Smith2016-03-301-1/+1
| | | | llvm-svn: 264822
* [ThinLTO] Remove post-pass metadata linking supportTeresa Johnson2016-03-291-38/+0
| | | | | | | | | | | Since we have moved to a model where functions are imported in bulk from each source module after making summary-based importing decisions, there is no longer a need to link metadata as a postpass, and all users have been removed. This essentially reverts r255909 and follow-on fixes. llvm-svn: 264763
* Swift Calling Convention: add swiftself attribute.Manman Ren2016-03-291-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D17866 llvm-svn: 264754
OpenPOWER on IntegriCloud