summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ProfileData/SampleProfTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [SampleFDO] Add profile remapping support for profile on-demand loading usedWei Mi2019-10-181-30/+53
| | | | | | | | | | | | | | | | | | | | by ExtBinary format profile Profile on-demand loading was added for ExtBinary format profile in rL374233, but currently profile on-demand loading doesn't work well with profile remapping. The patch adds the support. Suppose a function in the current module has outline instance in the profile. The function name in the module is different from the name of the outline instance, but remapper knows the two names are equal. When loading profile on-demand, the outline instance has to be loaded with remapper's help. At the same time SampleProfileReaderItaniumRemapper is changed from a proxy of SampleProfileReader to a helper member in SampleProfileReader. Differential Revision: https://reviews.llvm.org/D68901 llvm-svn: 375295
* [SampleFDO] Add indexing for function profiles so they can be loaded on demandWei Mi2019-10-091-8/+28
| | | | | | | | | | | | | | | | | | | | | | | | in ExtBinary format Currently for Text, Binary and ExtBinary format profiles, when we compile a module with samplefdo, even if there is no function showing up in the profile, we have to load all the function profiles from the profile input. That is a waste of compile time. CompactBinary format profile has already had the support of loading function profiles on demand. In this patch, we add the support to load profile on demand for ExtBinary format. It will work no matter the sections in ExtBinary format profile are compressed or not. Experiment shows it reduces the time to compile a server benchmark by 30%. When profile remapping and loading function profiles on demand are both used, extra work needs to be done so that the loading on demand process will take the name remapping into consideration. It will be addressed in a follow-up patch. Differential Revision: https://reviews.llvm.org/D68601 llvm-svn: 374233
* [SampleFDO] Add profile symbol list section to discriminate function beingWei Mi2019-08-311-0/+14
| | | | | | | | | | | | | | | | | | | cold versus function being newly added. This is the second half of https://reviews.llvm.org/D66374. Profile symbol list is the collection of function symbols showing up in the binary which generates the current profile. It is used to discriminate function being cold versus function being newly added. Profile symbol list is only added for profile with ExtBinary format. During profile use compilation, when profile-sample-accurate is enabled, a function without profile will be regarded as cold only when it is contained in that list. Differential Revision: https://reviews.llvm.org/D66766 llvm-svn: 370563
* [ADT] Make StringRef(const char*) constexprBenjamin Kramer2019-08-261-1/+0
| | | | | | | | | | This should let us get rid of StringLiteral in the long term and avoid chasing accidental StringRef globals once and for all. This requires C++14, I godbolted it on every compiler I know we support so I hope there won't be much fallout. llvm-svn: 369961
* [SampleFDO] Add ExtBinary format to support extension of binary profile.Wei Mi2019-08-231-0/+8
| | | | | | | | | | | | This is a patch split from https://reviews.llvm.org/D66374. It tries to add a new format of profile called ExtBinary. The format adds a section header table to the profile and organize the profile in sections, so the future extension like adding a new section or extending an existing section will be easier while keeping backward compatiblity feasible. Differential Revision: https://reviews.llvm.org/D66513 llvm-svn: 369798
* Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song2019-08-051-1/+1
| | | | | | F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
* [SampleFDO] add suffix elision control for fcn namesThan McIntosh2019-03-141-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add hooks for determining the policy used to decide whether/how to chop off symbol 'suffixes' when locating a given function in a sample profile. Prior to this change, any function symbols of the form "X.Y" were elided/truncated into just "X" when looking up things in a sample profile data file. With this change, the policy on suffixes can be changed by adding a new attribute "sample-profile-suffix-elision-policy" to the function: this attribute can have the value "all" (the default), "selected", or "none". A value of "all" preserves the previous behavior (chop off everything after the first "." character, then treat that as the symbol name). A value of "selected" chops off only the rightmost ".llvm.XXXX" suffix (where "XXX" is any string not containing a "." char). A value of "none" indicates that names should be left as is. Subscribers: jdoerfert, wmi, mtrofin, danielcdh, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58832 llvm-svn: 356146
* [PGO] Context sensitive PGO (part 2)Rong Xu2019-02-281-2/+2
| | | | | | | | | | | Part 2 of CSPGO changes (mostly related to ProfileSummary). Note that I use a default parameter in setProfileSummary() and getSummary(). This is to break the dependency in clang. I will make the parameter explicit after changing clang in a separated patch. Differential Revision: https://reviews.llvm.org/D54175 llvm-svn: 355131
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Fix gcc7 -Wdangling-else warning. NFCI.Simon Pilgrim2018-12-201-2/+4
| | | | llvm-svn: 349760
* Fix use-after-free with profile remapping.Richard Smith2018-12-191-0/+4
| | | | | | | | We need to keep the underlying profile reader alive as long as the profile data, because the profile data may contain StringRefs referring to strings in the reader's name table. llvm-svn: 349600
* Support for remapping profile data when symbols change, for sample-basedRichard Smith2018-10-101-19/+40
| | | | | | | | | | | | profiling. Reviewers: davidxl, tejohnson, dlj, erik.pilkington Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D51248 llvm-svn: 344187
* Use createTemporaryFile in SampleProfTestAlexander Kornienko2018-09-171-3/+5
| | | | | | | | Create a temporary file in the system temporary directory instead of creating a file in the current directory, which may be not writable. (Fix for an issue introduced in r342283.) llvm-svn: 342386
* Fix filesystem race issue in SampleProfTest introduced in rL342283.Wei Mi2018-09-151-11/+9
| | | | | | | | | Before this fix, multiple invocations of testRoundTrip will create multiple writers which share the same file as output destination. That could introduce filesystem race issue when multiple subtests are executed concurrently. This patch assign writers with different files as their output destinations. llvm-svn: 342301
* [SampleFDO] Add FunctionOffsetTable in compact binary format profile.Wei Mi2018-09-141-6/+14
| | | | | | | | | | | | The patch saves a function offset table which maps function name index to the offset of its function profile to the start of the binary profile. By using the function offset table, for those function profiles which will not be used when compiling a module, the profile reader does't have to read them. For profile size around 10~20M, it saves ~10% compile time. Differential Revision: https://reviews.llvm.org/D51863 llvm-svn: 342283
* [NFC] Change sample profile format enum name SPF_Raw_Binary to SPF_Binary.Wei Mi2018-06-121-1/+1
| | | | | | | Some out-of-tree targets depend on the enum name SPF_Binary. Keep the name can avoid unnecessary churn to those targets. llvm-svn: 334476
* [SampleFDO] Add a new compact binary format for sample profile.Wei Mi2018-06-111-9/+26
| | | | | | | | | | | | | | Name table occupies a big chunk of size in current binary format sample profile. In order to reduce its size, the patch changes the sample writer/reader to save/restore MD5Hash of names in the name table. Sample annotation phase will also use MD5Hash of name to query samples accordingly. Experiment shows compact binary format can reduce the size of sample profile by 2/3 compared with binary format generally. Differential Revision: https://reviews.llvm.org/D47955 llvm-svn: 334447
* [SampleFDO] Extend SampleProfReader to handle demangled names.Wei Mi2018-03-071-0/+8
| | | | | | | | | | | | | SampleProfReader assumes function names in the profile are all mangled names. However, there are cases that few demangled names are somehow contained in the profile (usually because of debug info problems), which may trigger parsing error in SampleProfReader and cause the whole profile to be unusable. The patch extends SampleProfReader to handle profiles with demangled names, so that those profiles can still be useful. Differential revision: https://reviews.llvm.org/D44161 llvm-svn: 326905
* Remove redundant includes from unittests.Michael Zolotukhin2017-12-131-6/+0
| | | | llvm-svn: 320630
* Re-sort #include lines for unittests. This uses a slightly modifiedChandler Carruth2017-06-061-1/+1
| | | | | | | | | | | | | | | clang-format (https://reviews.llvm.org/D33932) to keep primary headers at the top and handle new utility headers like 'gmock' consistently with other utility headers. No other change was made. I did no manual edits, all of this is clang-format. This should allow other changes to have more clear and focused diffs, and is especially motivated by moving some headers into more focused libraries. llvm-svn: 304786
* Use the range variant of find_if instead of unpacking begin/endDavid Majnemer2016-08-121-6/+4
| | | | | | No functionality change is intended. llvm-svn: 278443
* Remove specializations of ProfileSummaryEaswaran Raman2016-05-191-13/+10
| | | | | | | | This removes the subclasses of ProfileSummary, moves the members of the derived classes to the base class. Differential Revision: http://reviews.llvm.org/D20390 llvm-svn: 270143
* Fix some Clang-tidy modernize and Include What You Use warnings.Eugene Zelenko2016-04-281-4/+18
| | | | | | Differential revision: http://reviews.llvm.org/D19673 llvm-svn: 267910
* Remove every uses of getGlobalContext() in LLVM (but the C API)Mehdi Amini2016-04-141-3/+4
| | | | | | | | | | | 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
* Sample profile summary cleanupEaswaran Raman2016-03-281-1/+1
| | | | | | | | Replace references to MaxHeadSamples with MaxFunctionCount Differential Revision: http://reviews.llvm.org/D18522 llvm-svn: 264686
* Interface to get/set profile summary metadata to moduleEaswaran Raman2016-03-181-0/+13
| | | | | | Differential Revision: http://reviews.llvm.org/D17894 llvm-svn: 263835
* Fix memory leak in tests.Easwaran Raman2016-03-031-0/+1
| | | | llvm-svn: 262674
* Use LineLocation instead of CallsiteLocation to index callsite profile.Dehao Chen2016-03-031-0/+2
| | | | | | | | | | | | Summary: With discriminator, LineLocation can uniquely identify a callsite without the need to specifying callee name. Remove Callee function name from the key, and put it in the value (FunctionSamples). Reviewers: davidxl, dnovillo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D17827 llvm-svn: 262634
* Metadata support for profile summary.Easwaran Raman2016-03-011-24/+37
| | | | | | | | This adds support to convert ProfileSummary object to Metadata and create a ProfileSummary object from metadata. This would allow attaching profile summary information to Module allowing optimization passes to use it. llvm-svn: 262360
* Add profile summary support for sample profile.Easwaran Raman2016-02-191-0/+30
| | | | | | Differential Revision: http://reviews.llvm.org/D17178 llvm-svn: 261304
* [PGO] Handle and report overflow during profile merge for all types of dataNathan Slingerland2015-12-161-0/+30
| | | | | | | | | | | | Summary: Surface counter overflow when merging profile data. Merging still occurs on overflow but counts saturate to the maximum representable value. Overflow is reported to the user. Reviewers: davidxl, dnovillo, silvas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15547 llvm-svn: 255825
* [ProfileData] Add unit test infrastructure for sample profile reader/writerNathan Slingerland2015-12-101-0/+102
Summary: Adds support for in-memory round-trip of sample profile data along with basic round trip unit tests. This will also make it easier to include unit tests for future changes to sample profiling. Reviewers: davidxl, dnovillo, silvas Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15211 llvm-svn: 255264
OpenPOWER on IntegriCloud