summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Remarks
Commit message (Collapse)AuthorAgeFilesLines
* [Remarks] Allow empty temporary remark filesFrancis Visoiu Mistrih2019-11-221-0/+5
| | | | | | | When parsing bitstream remarks, allow external remark files to be empty, which means there are no remarks to be parsed. In the same way, dsymutil should not produce a remark file.
* [cmake] Explicitly mark libraries defined in lib/ as "Component Libraries"Tom Stellard2019-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Most libraries are defined in the lib/ directory but there are also a few libraries defined in tools/ e.g. libLLVM, libLTO. I'm defining "Component Libraries" as libraries defined in lib/ that may be included in libLLVM.so. Explicitly marking the libraries in lib/ as component libraries allows us to remove some fragile checks that attempt to differentiate between lib/ libraries and tools/ libraires: 1. In tools/llvm-shlib, because llvm_map_components_to_libnames(LIB_NAMES "all") returned a list of all libraries defined in the whole project, there was custom code needed to filter out libraries defined in tools/, none of which should be included in libLLVM.so. This code assumed that any library defined as static was from lib/ and everything else should be excluded. With this change, llvm_map_components_to_libnames(LIB_NAMES, "all") only returns libraries that have been added to the LLVM_COMPONENT_LIBS global cmake property, so this custom filtering logic can be removed. Doing this also fixes the build with BUILD_SHARED_LIBS=ON and LLVM_BUILD_LLVM_DYLIB=ON. 2. There was some code in llvm_add_library that assumed that libraries defined in lib/ would not have LLVM_LINK_COMPONENTS or ARG_LINK_COMPONENTS set. This is only true because libraries defined lib lib/ use LLVMBuild.txt and don't set these values. This code has been fixed now to check if the library has been explicitly marked as a component library, which should now make it easier to remove LLVMBuild at some point in the future. I have tested this patch on Windows, MacOS and Linux with release builds and the following combinations of CMake options: - "" (No options) - -DLLVM_BUILD_LLVM_DYLIB=ON - -DLLVM_LINK_LLVM_DYLIB=ON - -DBUILD_SHARED_LIBS=ON - -DBUILD_SHARED_LIBS=ON -DLLVM_BUILD_LLVM_DYLIB=ON - -DBUILD_SHARED_LIBS=ON -DLLVM_LINK_LLVM_DYLIB=ON Reviewers: beanz, smeenai, compnerd, phosek Reviewed By: beanz Subscribers: wuzish, jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, mgorny, mehdi_amini, sbc100, jgravelle-google, hiraditya, aheejin, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, PkmX, jocewei, jsji, dang, Jim, lenary, s.egerton, pzheng, sameer.abuasal, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70179
* Remarks - fix static analyzer warnings. NFCI.Simon Pilgrim2019-11-092-8/+9
| | | | | | | - Fix uninitialized variable warnings. - Reuse BitstreamEntry iterator to avoid Wshadow warning. - Match declaration + definition arg names in BitstreamRemarkParser::processCommonMeta - Make BitstreamRemarkParser(StringRef) constructor explicit
* Remarks - fix shadow variable warnings. NFCI.Simon Pilgrim2019-11-092-14/+16
| | | | Avoid conflict with llvm::remarks::Magic global variable.
* [Remarks] Add support for linking remarksFrancis Visoiu Mistrih2019-10-313-0/+142
| | | | | | | | | | | | | | | | | Remarks are usually emitted per-TU, and for generating a standalone remark file that can be shipped with the linked binary we need some kind of tool to merge everything together. The remarks::RemarkLinker class takes care of this and: * Deduplicates remarks * Filters remarks with no debug location * Merges string tables from all the entries As an output, it provides an iterator range that can be used to serialize the remarks to a file. Differential Revision: https://reviews.llvm.org/D69141
* [Remarks] Add support for prepending a path to external filesFrancis Visoiu Mistrih2019-10-165-17/+39
| | | | | | | | | This helps with testing and debugging for paths that are assumed absolute. It also uses a FileError to provide the file path it's trying to open. llvm-svn: 375008
* [Remarks] Pass StringBlockValue as StringRef.Florian Hahn2019-10-071-1/+1
| | | | | | | | | | | | | | | After changing the remark serialization, we now pass StringRefs to the serializer. We should use StringRef for StringBlockVal, to avoid creating temporary objects, which then cause StringBlockVal.Value to point to invalid memory. Reviewers: thegameg, anemet Reviewed By: thegameg Differential Revision: https://reviews.llvm.org/D68571 llvm-svn: 373923
* [Remarks] Allow remarks::Format::YAML to take a string tableFrancis Visoiu Mistrih2019-09-164-26/+41
| | | | | | | It should be allowed to take a string table in case all the strings in the remarks point there, but it shouldn't use it during serialization. llvm-svn: 372042
* Fix MSVC "not all control paths return a value" warning. NFCI.Simon Pilgrim2019-09-091-0/+1
| | | | llvm-svn: 371454
* [Remarks] Fix warning for uint8_t < 0 comparisonFrancis Visoiu Mistrih2019-09-091-4/+4
| | | | | | http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/19109/steps/build-stage1-compiler/logs/stdio llvm-svn: 371443
* [Remarks] Add parser for bitstream remarksFrancis Visoiu Mistrih2019-09-095-7/+681
| | | | | | | | | | | | | | | | | | | | | | | | | | The bitstream remark serializer landed in r367372. This adds a bitstream remark parser that parser bitstream remark files to llvm::remarks::Remark objects through the RemarkParser interface. A few interesting things to point out: * There are parsing helpers to parse the different types of blocks * The main parsing helper allows us to parse remark metadata and open an external file containing the encoded remarks * This adds a dependency from the Remarks library to the BitstreamReader library * The testing strategy is to create a remark entry through YAML, parse it, serialize it to bitstream, parse that back and compare the objects. * There are close to no tests for malformed bitstream remarks, due to the lack of textual format for the bitstream format. * This adds a new C API for parsing bitstream remarks: LLVMRemarkParserCreateBitstream. * This bumps the REMARKS_API_VERSION to 1. Differential Revision: https://reviews.llvm.org/D67134 llvm-svn: 371429
* [Remarks] Add support for internalizing a remark in a string tableFrancis Visoiu Mistrih2019-09-061-0/+17
| | | | | | | | | | In order to keep remarks around, we need to make them tied to a string table. Users then can delete the parser and rely on the string table to keep the memory of the strings alive and deduplicated. llvm-svn: 371233
* [Remarks] Don't serialize metadata if a string table is not usedFrancis Visoiu Mistrih2019-09-051-9/+14
| | | | | | | For YAML remarks with no string table, the mode should not affect the output. llvm-svn: 371106
* Do a sweep of symbol internalization. NFC.Benjamin Kramer2019-08-231-0/+2
| | | | llvm-svn: 369803
* [llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-155-13/+13
| | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
* Reland: [Remarks] Add an LLVM-bitstream-based remark serializerFrancis Visoiu Mistrih2019-07-317-4/+407
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new serializer, using a binary format based on the LLVM bitstream format. This format provides a way to serialize the remarks in two modes: 1) Separate mode: the metadata is separate from the remark entries. 2) Standalone mode: the metadata and the remark entries are in the same file. The format contains: * a meta block: container version, container type, string table, external file path, remark version * a remark block: type, remark name, pass name, function name, debug file, debug line, debug column, hotness, arguments (key, value, debug file, debug line, debug column) A string table is required for this format, which will be dumped in the meta block to be consumed before parsing the remark blocks. On clang itself, we noticed a size reduction of 13.4x compared to YAML, and a compile-time reduction of between 1.7% and 3.5% on CTMark. Differential Revision: https://reviews.llvm.org/D63466 Original llvm-svn: 367364 Revert llvm-svn: 367370 llvm-svn: 367372
* Revert "[Remarks] Add an LLVM-bitstream-based remark serializer"Francis Visoiu Mistrih2019-07-317-403/+4
| | | | | | | | This reverts commit r367364. Breaks some bots: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-gn/builds/3161/steps/annotate/logs/stdio llvm-svn: 367370
* [Remarks] Add an LLVM-bitstream-based remark serializerFrancis Visoiu Mistrih2019-07-307-4/+403
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new serializer, using a binary format based on the LLVM bitstream format. This format provides a way to serialize the remarks in two modes: 1) Separate mode: the metadata is separate from the remark entries. 2) Standalone mode: the metadata and the remark entries are in the same file. The format contains: * a meta block: container version, container type, string table, external file path, remark version * a remark block: type, remark name, pass name, function name, debug file, debug line, debug column, hotness, arguments (key, value, debug file, debug line, debug column) A string table is required for this format, which will be dumped in the meta block to be consumed before parsing the remark blocks. On clang itself, we noticed a size reduction of 13.4x compared to YAML, and a compile-time reduction of between 1.7% and 3.5% on CTMark. Differential Revision: https://reviews.llvm.org/D63466 llvm-svn: 367364
* [Remarks] Add two serialization modes for remarks: separate and standaloneFrancis Visoiu Mistrih2019-07-302-8/+19
| | | | | | | | | | The default mode is separate, where the metadata is serialized separately from the remarks. Another mode is the standalone mode, where the metadata is serialized before the remarks, on the same stream. llvm-svn: 367328
* [Remarks] Update error message format stringFrancis Visoiu Mistrih2019-07-291-4/+4
| | | | | | | All the clang-cmake-armv{7,8} bots are failing this test. This is an attempt to fix this. llvm-svn: 367243
* [Remarks] Silence Wreturn-type warningFrancis Visoiu Mistrih2019-07-261-0/+1
| | | | | | Shows up here: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/27771/steps/annotate/logs/stdio. llvm-svn: 367162
* Reland: [Remarks] Support parsing remark metadata in the YAML remark parserFrancis Visoiu Mistrih2019-07-263-0/+129
| | | | | | | | | | | | | | | | This adds support to the yaml remark parser to be able to parse remarks directly from the metadata. This supports parsing separate metadata and following the external file with the associated metadata, and also a standalone file containing metadata + remarks all together. Original llvm-svn: 367148 Revert llvm-svn: 367151 This has a fix for gcc builds. llvm-svn: 367155
* Revert "[Remarks] Support parsing remark metadata in the YAML remark parser"Francis Visoiu Mistrih2019-07-263-129/+0
| | | | | | | | | This reverts r367148. Seems to fail on http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/27768. llvm-svn: 367151
* [Remarks] Support parsing remark metadata in the YAML remark parserFrancis Visoiu Mistrih2019-07-263-0/+129
| | | | | | | | | | | This adds support to the yaml remark parser to be able to parse remarks directly from the metadata. This supports parsing separate metadata and following the external file with the associated metadata, and also a standalone file containing metadata + remarks all together. llvm-svn: 367148
* Reland: [Remarks] Add support for serializing metadata for every remark streamerFrancis Visoiu Mistrih2019-07-261-0/+65
| | | | | | | | | | | | This allows every serializer format to implement metaSerializer() and return the corresponding meta serializer. Original llvm-svn: 366946 Reverted llvm-svn: 367004 This fixes the unit tests on Windows bots. llvm-svn: 367078
* Revert rL366946 : [Remarks] Add support for serializing metadata for every ↵Simon Pilgrim2019-07-251-65/+0
| | | | | | | | | | | | | | remark streamer This allows every serializer format to implement metaSerializer() and return the corresponding meta serializer. ........ Fix windows build bots http://lab.llvm.org:8011/builders/llvm-clang-x86_64-win-fast http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win llvm-svn: 367004
* [Remarks][NFC] Rename remarks::Parser to remarks::RemarkParserFrancis Visoiu Mistrih2019-07-253-8/+8
| | | | llvm-svn: 366965
* [Remarks] Add support for serializing metadata for every remark streamerFrancis Visoiu Mistrih2019-07-241-0/+65
| | | | | | | This allows every serializer format to implement metaSerializer() and return the corresponding meta serializer. llvm-svn: 366946
* [Remarks][NFC] Rename remarks::Serializer to remarks::RemarkSerializerFrancis Visoiu Mistrih2019-07-242-11/+11
| | | | llvm-svn: 366939
* [Remarks] Simplify the creation of remark serializersFrancis Visoiu Mistrih2019-07-243-1/+50
| | | | | | | Introduce two new functions to create a serializer, and add support for more combinations to the YAMLStrTabSerializer. llvm-svn: 366919
* [Remark] Suppress the "-Wreturn-type" compiler warning, NFCHaojian Wu2019-07-241-0/+2
| | | | llvm-svn: 366874
* [Remarks] String tables should be move-onlyFrancis Visoiu Mistrih2019-07-234-13/+22
| | | | | | | | Copying them is expensive. This allows the tables to be moved around at lower cost, and allows a remarks::StringTable to be constructed from a remarks::ParsedStringTable. llvm-svn: 366864
* [Remarks] Introduce a new format: yaml-strtabFrancis Visoiu Mistrih2019-07-235-33/+75
| | | | | | | | | This exposes better support to use a string table with a format through an actual new remark::Format, called yaml-strtab. This can now be used with -fsave-optimization-record=yaml-strtab. llvm-svn: 366849
* [Remarks][NFC] Move the YAML serializer to its own headerFrancis Visoiu Mistrih2019-07-231-1/+1
| | | | llvm-svn: 366842
* [Remarks] Add unit tests for YAML serializationFrancis Visoiu Mistrih2019-07-231-3/+0
| | | | | | Add tests for both the string table and non string table case. llvm-svn: 366832
* Fix -Wreturn-type warning. NFC.Michael Liao2019-07-161-0/+1
| | | | llvm-svn: 366251
* [Remarks] Simplify and refactor the RemarkParser interfaceFrancis Visoiu Mistrih2019-07-165-405/+334
| | | | | | | | | | | | | | | | | | | | Before, everything was based on some kind of type erased parser implementation which container a lot of boilerplate code when multiple formats were to be supported. This simplifies it by: * the remark now owns its arguments * *always* returning an error from the implementation side * working around the way the YAML parser reports errors: catch them through callbacks and re-insert them in a proper llvm::Error * add a CParser wrapper that is used when implementing the C API to avoid cluttering the C++ API with useless state * LLVMRemarkParserGetNext now returns an object that needs to be released to avoid leaking resources * add a new API to dispose of a remark entry: LLVMRemarkEntryDispose llvm-svn: 366217
* [Remarks][NFC] Combine ParserFormat and SerializerFormatFrancis Visoiu Mistrih2019-07-165-19/+53
| | | | | | It's useless to have both. llvm-svn: 366216
* [Remarks] Add cl::Hidden to -remarks-yaml-string-tableFrancis Visoiu Mistrih2019-07-101-2/+3
| | | | | | It was showing up in a lot of unrelated tools. llvm-svn: 365647
* Fix MSVC "not all control paths return a value" warnings. NFCI.Simon Pilgrim2019-07-041-4/+2
| | | | llvm-svn: 365119
* [Remarks] Silence gcc warning by catching unhandled values in switchesMikael Holmen2019-07-041-0/+4
| | | | | | | | | | | | | | | | | | | Without this fix gcc (7.4) complains with ../lib/Remarks/RemarkParser.cpp: In function 'std::unique_ptr<llvm::remarks::ParserImpl> formatToParserImpl(llvm::remarks::ParserFormat, llvm::StringRef)': ../lib/Remarks/RemarkParser.cpp:29:1: error: control reaches end of non-void function [-Werror=return-type] } ^ ../lib/Remarks/RemarkParser.cpp: In function 'std::unique_ptr<llvm::remarks::ParserImpl> formatToParserImpl(llvm::remarks::ParserFormat, llvm::StringRef, const llvm::remarks::ParsedStringTable&)': ../lib/Remarks/RemarkParser.cpp:38:1: error: control reaches end of non-void function [-Werror=return-type] } ^ The Format enum currently only contains the value YAML which is indeed already handled in the switches, but gcc complains anyway. Adding a default case with an llvm_unreachable silences gcc. llvm-svn: 365118
* [Remarks] Require an explicit format to the parserFrancis Visoiu Mistrih2019-07-043-11/+31
| | | | | | | | | Make the parser require an explicit format. This allows new formats to be easily added by following YAML as an example. llvm-svn: 365102
* [Remarks][NFC] Move the string table parsing out of the parser constructorFrancis Visoiu Mistrih2019-07-043-12/+11
| | | | | | Make the parser take an already-parsed string table. llvm-svn: 365101
* [Remarks] Fix usage of enum classFrancis Visoiu Mistrih2019-05-301-1/+1
| | | | | | | | Breaks the build on some compilers: http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/9720/steps/build%20stage%201/logs/stdio llvm-svn: 362165
* [Remarks][NFC] Move the serialization to lib/RemarksFrancis Visoiu Mistrih2019-05-302-0/+167
| | | | | | | | | | | | Separate the remark serialization to YAML from the LLVM Diagnostics. This adds a new serialization abstraction: remarks::Serializer. It's completely independent from lib/IR and it provides an easy way to replace YAML by providing a new remarks::Serializer. Differential Revision: https://reviews.llvm.org/D62632 llvm-svn: 362160
* [Remarks] Add string deduplication using a string tableFrancis Visoiu Mistrih2019-04-245-6/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add support for uniquing strings in the remark streamer and emitting the string table in the remarks section. * Add parsing support for the string table in the RemarkParser. From this remark: ``` --- !Missed Pass: inline Name: NoDefinition DebugLoc: { File: 'test-suite/SingleSource/UnitTests/2002-04-17-PrintfChar.c', Line: 7, Column: 3 } Function: printArgsNoRet Args: - Callee: printf - String: ' will not be inlined into ' - Caller: printArgsNoRet DebugLoc: { File: 'test-suite/SingleSource/UnitTests/2002-04-17-PrintfChar.c', Line: 6, Column: 0 } - String: ' because its definition is unavailable' ... ``` to: ``` --- !Missed Pass: 0 Name: 1 DebugLoc: { File: 3, Line: 7, Column: 3 } Function: 2 Args: - Callee: 4 - String: 5 - Caller: 2 DebugLoc: { File: 3, Line: 6, Column: 0 } - String: 6 ... ``` And the string table in the .remarks/__remarks section containing: ``` inline\0NoDefinition\0printArgsNoRet\0 test-suite/SingleSource/UnitTests/2002-04-17-PrintfChar.c\0printf\0 will not be inlined into \0 because its definition is unavailable\0 ``` This is mostly supposed to be used for testing purposes, but it gives us a 2x reduction in the remark size, and is an incremental change for the updates to the remarks file format. Differential Revision: https://reviews.llvm.org/D60227 llvm-svn: 359050
* [Remarks] Fix mismatched delete due to missing virtual destructorJordan Rupprecht2019-03-201-0/+4
| | | | | | This fixes an asan failure introduced in r356519. llvm-svn: 356583
* Retry to add workaround to build scoped enums with VS2015. NFCI.Douglas Yung2019-03-201-1/+1
| | | | | | We need this as we still have internal build bots on VS2015. llvm-svn: 356534
* Revert "Add workaround to build scoped enums with VS2015. NFCI."Douglas Yung2019-03-201-1/+1
| | | | | | | | This reverts commit 6080a6fb1949a2bdf053245d6062c7bf58dae7a6 (r356532). Clang does not accept this syntax, so reverting this until I can find something that works across all compilers. llvm-svn: 356533
* Add workaround to build scoped enums with VS2015. NFCI.Douglas Yung2019-03-201-1/+1
| | | | | | We need this as we still have internal build bots on VS2015. llvm-svn: 356532
OpenPOWER on IntegriCloud