summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SampleProfile/syntax.ll
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Temporarily Revert "Add basic loop fusion pass.""Eric Christopher2019-04-171-0/+29
| | | | | | | | The reversion apparently deleted the test/Transforms directory. Will be re-reverting again. llvm-svn: 358552
* Temporarily Revert "Add basic loop fusion pass."Eric Christopher2019-04-171-29/+0
| | | | | | | | As it's causing some bot failures (and per request from kbarton). This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda. llvm-svn: 358546
* [PM] Port the Sample FDO to new PM (part-2)Xinliang David Li2016-05-271-0/+9
| | | | llvm-svn: 271072
* [llvm-profdata] Add check for text profile formats and improve error ↵Nathan Slingerland2015-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reporting (2nd try) Summary: This change addresses two possible instances of user error / confusion when merging sampled profile data. Previously any input that didn't match the raw or processed instrumented format would automatically be interpreted as instrumented profile text format data. No error would be reported during the merge. Example: If foo-sampled.profdata and bar-sampled.profdata are binary sampled profiles: Old behavior: $ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -output foobar-sampled.profdata $ llvm-profdata show -sample foobar-sampled.profdata error: foobar-sampled.profdata:1: Expected 'mangled_name:NUM:NUM', found lprofi This change adds basic checks for valid input data when assuming text input. It also makes error messages related to file format validity more specific about the assumbed profile data type. New behavior: $ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -o foobar-sampled.profdata error: foo.profdata: Unrecognized instrumentation profile encoding format Perhaps you forgot to use the -sample option? Reviewers: bogner, davidxl, dnovillo Subscribers: davidxl, llvm-commits Differential Revision: http://reviews.llvm.org/D14558 llvm-svn: 253009
* llvm/test/Transforms/SampleProfile/syntax.ll: Relax MISSING-FILE not toNAKAMURA Takumi2014-10-301-1/+1
| | | | | | check locale-aware message catalog. llvm-svn: 220934
* Add profile writing capabilities for sampling profiles.Diego Novillo2014-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch finishes up support for handling sampling profiles in both text and binary formats. The new binary format uses uleb128 encoding to represent numeric values. This makes profiles files about 25% smaller. The profile writer class can write profiles in the existing text and the new binary format. In subsequent patches, I will add the capability to read (and perhaps write) profiles in the gcov format used by GCC. Additionally, I will be adding support in llvm-profdata to manipulate sampling profiles. There was a bit of refactoring needed to separate some code that was in the reader files, but is actually common to both the reader and writer. The new test checks that reading the same profile encoded as text or raw, produces the same results. Reviewers: bogner, dexonsmith Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6000 llvm-svn: 220915
* Change error to warning when a profile cannot be found.Diego Novillo2014-10-221-2/+2
| | | | | | | | When the profile for a function cannot be applied, we use to emit an error. This seems extreme. The compiler can continue, it's just that the optimization opportunities won't include profile information. llvm-svn: 220386
* Tolerate unmangled names in sample profiles.Diego Novillo2014-03-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The compiler does not always generate linkage names. If a function has been inlined and its body elided, its linkage name may not be generated. When the binary executes, the profiler will use its unmangled name when attributing samples. This results in unmangled names in the input profile. We are currently failing hard when this happens. However, in this case all that happens is that we fail to attribute samples to the inlined function. While this means fewer optimization opportunities, it should not cause a compilation failure. This patch accepts all valid function names, regardless of whether they were mangled or not. Reviewers: chandlerc CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3087 llvm-svn: 204142
* llvm/test/Transforms/SampleProfile/syntax.ll: Suppress checking the message ↵NAKAMURA Takumi2014-03-151-1/+1
| | | | | | catalog in ENOENT. It is locale-dependent on Windows. llvm-svn: 203997
* Use DiagnosticInfo facility.Diego Novillo2014-03-141-7/+7
| | | | | | | | | | | | | | | | | | Summary: The sample profiler pass emits several error messages. Instead of just aborting the compiler with report_fatal_error, we can emit better messages using DiagnosticInfo. This adds a new sub-class of DiagnosticInfo to handle the sample profiler. Reviewers: chandlerc, qcolombet CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3086 llvm-svn: 203976
* Use discriminator information in sample profiles.Diego Novillo2014-03-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When the sample profiles include discriminator information, use the discriminator values to distinguish instruction weights in different basic blocks. This modifies the BodySamples mapping to map <line, discriminator> pairs to weights. Instructions on the same line but different blocks, will use different discriminator values. This, in turn, means that the blocks may have different weights. Other changes in this patch: - Add tests for positive values of line offset, discriminator and samples. - Change data types from uint32_t to unsigned and int and do additional validation. Reviewers: chandlerc CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2857 llvm-svn: 203508
* llvm/test/Transforms/SampleProfile/syntax.ll: Eliminate locale-sensitive ↵NAKAMURA Takumi2014-01-111-1/+1
| | | | | | message check. llvm-svn: 199000
* Extend and simplify the sample profile input file.Diego Novillo2014-01-101-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1- Use the line_iterator class to read profile files. 2- Allow comments in profile file. Lines starting with '#' are completely ignored while reading the profile. 3- Add parsing support for discriminators and indirect call samples. Our external profiler can emit more profile information that we are currently not handling. This patch does not add new functionality to support this information, but it allows profile files to provide it. I will add actual support later on (for at least one of these features, I need support for DWARF discriminators in Clang). A sample line may contain the following additional information: Discriminator. This is used if the sampled program was compiled with DWARF discriminator support (http://wiki.dwarfstd.org/index.php?title=Path_Discriminators). This is currently only emitted by GCC and we just ignore it. Potential call targets and samples. If present, this line contains a call instruction. This models both direct and indirect calls. Each called target is listed together with the number of samples. For example, 130: 7 foo:3 bar:2 baz:7 The above means that at relative line offset 130 there is a call instruction that calls one of foo(), bar() and baz(). With baz() being the relatively more frequent call target. Differential Revision: http://llvm-reviews.chandlerc.com/D2355 4- Simplify format of profile input file. This implements earlier suggestions to simplify the format of the sample profile file. The symbol table is not necessary and function profiles do not need to know the number of samples in advance. Differential Revision: http://llvm-reviews.chandlerc.com/D2419 llvm-svn: 198973
* Propagation of profile samples through the CFG.Diego Novillo2014-01-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a propagation heuristic to convert instruction samples into branch weights. It implements a similar heuristic to the one implemented by Dehao Chen on GCC. The propagation proceeds in 3 phases: 1- Assignment of block weights. All the basic blocks in the function are initial assigned the same weight as their most frequently executed instruction. 2- Creation of equivalence classes. Since samples may be missing from blocks, we can fill in the gaps by setting the weights of all the blocks in the same equivalence class to the same weight. To compute the concept of equivalence, we use dominance and loop information. Two blocks B1 and B2 are in the same equivalence class if B1 dominates B2, B2 post-dominates B1 and both are in the same loop. 3- Propagation of block weights into edges. This uses a simple propagation heuristic. The following rules are applied to every block B in the CFG: - If B has a single predecessor/successor, then the weight of that edge is the weight of the block. - If all the edges are known except one, and the weight of the block is already known, the weight of the unknown edge will be the weight of the block minus the sum of all the known edges. If the sum of all the known edges is larger than B's weight, we set the unknown edge weight to zero. - If there is a self-referential edge, and the weight of the block is known, the weight for that edge is set to the weight of the block minus the weight of the other incoming edges to that block (if known). Since this propagation is not guaranteed to finalize for every CFG, we only allow it to proceed for a limited number of iterations (controlled by -sample-profile-max-propagate-iterations). It currently uses the same GCC default of 100. Before propagation starts, the pass builds (for each block) a list of unique predecessors and successors. This is necessary to handle identical edges in multiway branches. Since we visit all blocks and all edges of the CFG, it is cleaner to build these lists once at the start of the pass. Finally, the patch fixes the computation of relative line locations. The profiler emits lines relative to the function header. To discover it, we traverse the compilation unit looking for the subprogram corresponding to the function. The line number of that subprogram is the line where the function begins. That becomes line zero for all the relative locations. llvm-svn: 198972
* llvm/test/Transforms/SampleProfile/syntax.ll: Relax an expression, not to ↵NAKAMURA Takumi2013-12-031-1/+1
| | | | | | check locale-dependent message. llvm-svn: 196195
* Add tests for profile sample file parsing.Diego Novillo2013-12-021-0/+17
The profile file parser needed some tests for its parsing actions. This adds tests for each of the error messages emitted by the parser. llvm-svn: 196106
OpenPOWER on IntegriCloud