Commit Graph

7478 Commits

Author SHA1 Message Date
Vedant Kumar
d05e76c71d [Coverage] Delete some copy constructors (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284064 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 22:27:49 +00:00
Teresa Johnson
e0ace4ad68 [ThinLTO] Fix bot failure due to unused variable with NDEBUG
Put variable only used in assert under #ifndef NDEBUG.

This should fix bot failure at
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/28537

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284039 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 20:06:02 +00:00
Teresa Johnson
256d6fed02 [ThinLTO] Don't link module level assembly when importing
Module inline asm was always being linked/concatenated
when running the IRLinker. This is correct for full LTO but not when
we are importing for ThinLTO, as it can result in multiply defined
symbols when the module asm defines a global symbol.

In order to test with llvm-lto2, I had to work around PR30396,
where a symbol that is defined in module assembly but defined in the
LLVM IR appears twice. Added workaround to llvm-lto2 with a FIXME.

Fixes PR30610.

Reviewers: mehdi_amini

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D25359

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284030 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-12 18:39:29 +00:00
Davide Italiano
373988f36a [llvm-link] Fix description of -disable-lazy-loading option
Patch by Will Dietz!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283697 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-09 17:15:04 +00:00
Mehdi Amini
3ffe113e11 Turn cl::values() (for enum) from a vararg function to using C++ variadic template
The core of the change is supposed to be NFC, however it also fixes
what I believe was an undefined behavior when calling:

 va_start(ValueArgs, Desc);

with Desc being a StringRef.

Differential Revision: https://reviews.llvm.org/D25342

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283671 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 19:41:06 +00:00
Mehdi Amini
7fe28f81db ThinLTO: handles modules with empty summaries
We need to add an entry in the combined-index for modules that have
a hash but otherwise empty summary, this is needed so that we can
get the hash for the module.

Also, if no entry is present in the combined index for a module, we
need to skip it when trying to compute a cache entry.

Differential Revision: https://reviews.llvm.org/D25300

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283654 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 04:44:18 +00:00
Zachary Turner
2ce5ded6d2 [pdb] Dump Module Symbols to Yaml.
This is the first step towards round-tripping symbol information,
and thusly being able to write symbol information to a PDB.

This patch writes the symbol information for each compiland to
the Yaml when running in pdb2yaml mode.  There's still some loose
ends, such as what to do about relocations (necessary in order to
print linkage names), how to print enums with friendly names, and
how to give the dumper access to the StringTable, but this is a
good first start.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283641 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 01:12:01 +00:00
Hal Finkel
7b70b8ae64 [llvm-opt-report] Don't leave space for opts that never happen
Because screen space is precious, if an optimization (vectorization, for
example) never happens, don't leave empty space for the associated markers on
every line of the output. This makes the output much more compact, and allows
for the later inclusion of markers for more (although perhaps rare)
optimizations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283626 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 00:26:54 +00:00
Zachary Turner
254b4d2617 Refactor Symbol visitor code.
Type visitor code had already been refactored previously to
decouple the visitor and the visitor callback interface.  This
was necessary for having the flexibility to visit in different
ways (for example, dumping to yaml, reading from yaml, dumping
to ScopedPrinter, etc).

This patch merely implements the same visitation pattern for
symbol records that has already been implemented for type records.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283609 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 21:34:46 +00:00
Mehdi Amini
c16b74e39e Recommit "Use StringRef in LTOModule implementation (NFC)""
This reverts commit r283456 and reapply r282997, with explicitly
zeroing the struct member to workaround a bug in MSVC2013 with
zero-initialization: https://connect.microsoft.com/VisualStudio/feedback/details/802160

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283581 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 19:05:14 +00:00
Hal Finkel
837bcf7984 [llvm-opt-report] Left justify unrolling counts, etc.
In the left part of the reports, we have things like U<number>; if some of
these numbers use more digits than others, we don't want a space in between the
U and the start of the number. Instead, the space should come afterward. This
way it is clear that the number goes with the U and not any other optimization
indicator that might come later on the line.

Tests committed in r283518.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283519 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 02:01:03 +00:00
Hal Finkel
28b12d7747 [llvm-opt-report] Use -no-demangle to disable demangling
As this is intended to be a user-facing option, -no-demangle seems much better
than -demangle=0. Add testing for the option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283516 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-07 01:30:59 +00:00
Michael Ilseman
33fe838cad Revert "Add -strip-nonlinetable-debuginfo capability"
This reverts commit r283473.

Reverted until review is completed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283478 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 18:30:26 +00:00
Michael Ilseman
bda4e020b8 Add -strip-nonlinetable-debuginfo capability
This adds a new function to DebugInfo.cpp that takes an llvm::Module
as input and removes all debug info metadata that is not directly
needed for line tables, thus effectively stripping all type and
variable information from the module.

The primary motivation for this feature was the bitcode work flow
(cf. http://lists.llvm.org/pipermail/llvm-dev/2016-June/100643.html
for more background). This is not wired up yet, but will be in
subsequent patches.  For testing, the new functionality is exposed to
opt with a -strip-nonlinetable-debuginfo option.

The secondary use-case (and one that works right now!) is as a
reduction pass in bugpoint. I added two new bugpoint options
(-disable-strip-debuginfo and -disable-strip-debug-types) to control
the new features. By default it will first attempt to remove all debug
information, then only the type info, and then proceed to hack at any
remaining MDNodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283473 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 17:58:38 +00:00
Mehdi Amini
54de287798 Revert "Use StringRef in LTOModule implementation (NFC)"
This reverts commit r282997, a windows bot is asserting in
one test apparently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283456 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 15:12:22 +00:00
Rafael Espindola
42b70df58d Refactor to use getSectionContentsAsArray.
This centralizes quite a bit of error checking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283454 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 14:47:04 +00:00
Rafael Espindola
605a3d0a40 Refactor duplicated typedefs. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283453 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 14:07:26 +00:00
Sam Kolton
665e97634e [AMDGPU] Disassembler: print label names in branch instructions
Summary: Add AMDGPUSymbolizer for finding names for labels from ELF symbol table.
Initialize MCObjectFileInfo with some default values.

Reviewers: vpykhtin, artem.tamazov, tstellarAMD

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

Differential Revision: https://reviews.llvm.org/D24802

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283450 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 13:46:08 +00:00
Rafael Espindola
493d9f99e8 Use range loop. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283447 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 13:11:12 +00:00
Hal Finkel
7b08fb4456 [llvm-opt-report] Record VF, etc. correctly for multiple opts on one line
When there are multiple optimizations on one line, record the vectorization
factors, etc. correctly (instead of incorrectly substituting default values).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283443 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 11:58:52 +00:00
Hal Finkel
a172b8d4e9 [llvm-opt-report] Print line numbers starting from 1
Line numbers should start from 1, not 2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283440 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-06 11:11:11 +00:00
Hal Finkel
0837bf4c51 [llvm-opt-report] Distinguish inlined contexts when optimizations differ
How code is optimized sometimes, perhaps often, depends on the context into
which it was inlined. This change allows llvm-opt-report to track the
differences between the optimizations performed, or not, in different contexts,
and when these differ, display those differences.

For example, this code:

  $ cat /tmp/q.cpp
  void bar();
  void foo(int n) {
    for (int i = 0; i < n; ++i)
      bar();
  }

  void quack() {
    foo(4);
  }

  void quack2() {
    foo(4);
  }

will now produce this report:

  < /home/hfinkel/src/llvm/test/tools/llvm-opt-report/Inputs/q.cpp
   2         | void bar();
   3         | void foo(int n) {
   [[
    > foo(int):
   4         |   for (int i = 0; i < n; ++i)
    > quack(), quack2():
   4  U4     |   for (int i = 0; i < n; ++i)
   ]]
   5         |     bar();
   6         | }
   7         |
   8         | void quack() {
   9 I       |   foo(4);
  10         | }
  11         |
  12         | void quack2() {
  13 I       |   foo(4);
  14         | }
  15         |

Note that the tool has demangled the function names, and grouped the reports
associated with line 4. This shows that the loop on line 4 was unrolled by a
factor of 4 when inlined into the functions quack() and quack2(), but not in
the function foo(int) itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283402 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 22:25:33 +00:00
Hal Finkel
6af7eec625 Add an llvm-opt-report tool to generate basic source-annotated optimization summaries
LLVM now has the ability to record information from optimization remarks in a
machine-consumable YAML file for later analysis. This can be enabled in opt
(see r282539), and D25225 adds a Clang flag to do the same. This patch adds
llvm-opt-report, a tool to generate basic optimization "listing" files
(annotated sources with information about what optimizations were performed)
from one of these YAML inputs.

D19678 proposed to add this capability directly to Clang, but this more-general
YAML-based infrastructure was the direction we decided upon in that review
thread.

For this optimization report, I focused on making the output as succinct as
possible while providing information on inlining and loop transformations. The
goal here is that the source code should still be easily readable in the
report. My primary inspiration here is the reports generated by Cray's tools
(http://docs.cray.com/books/S-2496-4101/html-S-2496-4101/z1112823641oswald.html).
These reports are highly regarded within the HPC community. Intel's compiler,
for example, also has an optimization-report capability
(https://software.intel.com/sites/default/files/managed/55/b1/new-compiler-optimization-reports.pdf).

  $ cat /tmp/v.c
  void bar();
  void foo() { bar(); }

  void Test(int *res, int *c, int *d, int *p, int n) {
    int i;

  #pragma clang loop vectorize(assume_safety)
    for (i = 0; i < 1600; i++) {
      res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
    }

    for (i = 0; i < 16; i++) {
      res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
    }

    foo();

    foo(); bar(); foo();
  }

D25225 adds -fsave-optimization-record (and
-fsave-optimization-record=filename), and this would be used as follows:

  $ clang -O3 -o /tmp/v.o -c /tmp/v.c -fsave-optimization-record
  $ llvm-opt-report /tmp/v.yaml > /tmp/v.lst
  $ cat /tmp/v.lst

  < /tmp/v.c
   2          | void bar();
   3          | void foo() { bar(); }
   4          |
   5          | void Test(int *res, int *c, int *d, int *p, int n) {
   6          |   int i;
   7          |
   8          | #pragma clang loop vectorize(assume_safety)
   9     V4,2 |   for (i = 0; i < 1600; i++) {
  10          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
  11          |   }
  12          |
  13  U16     |   for (i = 0; i < 16; i++) {
  14          |     res[i] = (p[i] == 0) ? res[i] : res[i] + d[i];
  15          |   }
  16          |
  17 I        |   foo();
  18          |
  19          |   foo(); bar(); foo();
     I        |   ^
     I        |                 ^
  20          | }

Each source line gets a prefix giving the line number, and a few columns for
important optimizations: inlining, loop unrolling and loop vectorization. An
'I' is printed next to a line where a function was inlined, a 'U' next to an
unrolled loop, and 'V' next to a vectorized loop. These are printed on the
relevant code line when that seems unambiguous, or on subsequent lines when
multiple potential options exist (messages, both positive and negative, from
the same optimization with different column numbers are taken to indicate
potential ambiguity). When on subsequent lines, a '^' is output in the relevant
column.

Annotated source for all relevant input files are put into the listing file
(each starting with '<' and then the file name).

You can disable having the unrolling/vectorization factors appear by using the
-s flag.

Differential Revision: https://reviews.llvm.org/D25262

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283398 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-05 22:10:35 +00:00
Rafael Espindola
2638e45e83 Misc improvements to StringTableBuilder.
This patch adds write methods to StringTableBuilder so that it is
easier to change the underlying implementation.

Using the write methods, avoid creating a temporary buffer when using
mmaped output.

It also uses a more compact key in the DenseMap. Overall this produces
a slightly faster lld:

firefox
  master 6.853419709
  patch  6.841968912 1.00167361138x faster
chromium
  master 4.297280174
  patch  4.298712163 1.00033323147x slower
chromium fast
  master 1.802335952
  patch  1.806872459 1.00251701521x slower
the gold plugin
  master 0.3247149
  patch  0.321971644 1.00852017888x faster
clang
  master 0.551279945
  patch  0.543733194 1.01387951128x faster
llvm-as
  master 0.032743458
  patch  0.032143478 1.01866568391x faster
the gold plugin fsds
  master 0.350814247
  patch  0.348571741 1.00643341309x faster
clang fsds
  master 0.6281672
  patch  0.621130222 1.01132931187x faster
llvm-as fsds
  master 0.030168899
  patch  0.029797155 1.01247582194x faster
scylla
  master 3.104222518
  patch  3.059590248 1.01458766252x faster

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283266 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 22:43:25 +00:00
Mike Aizatsky
4c9998f283 [sancov] renamed symcov-report-server to coverage-report-server
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283241 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-04 19:18:23 +00:00
Mike Aizatsky
aa36ef278b [sancov] using env for better portability
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283136 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 19:22:05 +00:00
Zachary Turner
932630880c Rename Error -> ReportError.
Error conflicts with the llvm::Error datatype, creating
ambiguities.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283128 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 18:17:18 +00:00
Rafael Espindola
ee3cdffe7e Revert "Use getSize instead of data().size(). NFC."
This reverts commit r283125.

lld needs to be updated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283127 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 18:01:10 +00:00
Rafael Espindola
1c287c05a6 Use getSize instead of data().size(). NFC.
Also assert isFinalized in getSize(). This just reduces the noise from
another patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283125 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-03 17:49:19 +00:00
Joerg Sonnenberger
a27efcd029 Retire bugpoint's -R. hack.
It got disconnected during the cmake conversion. For Miscompilation.cpp,
it was purely advisory for the user and the ToolRunner.cpp version was
trying to compensate for libs and bins in the same directory, which
hasn't been the case for a very long time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283022 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 07:34:18 +00:00
Mehdi Amini
102077e6f3 Revert "Use StringRef instead of raw pointer in TargetRegistry API (NFC)"
This reverts commit r283017. Creates an infinite loop somehow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283019 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 07:08:23 +00:00
Mehdi Amini
ec52cdee8f Use StringRef instead of raw pointers in MCAsmInfo/MCInstrInfo APIs (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283018 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 06:46:33 +00:00
Mehdi Amini
876fe65d27 Use StringRef instead of raw pointer in TargetRegistry API (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283017 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 06:25:30 +00:00
Mehdi Amini
b7d8ee46b4 Use StringRef in CommandLine Options handling (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283007 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 03:43:20 +00:00
Mehdi Amini
67f335d992 Use StringRef in Pass/PassManager APIs (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283004 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 02:56:57 +00:00
Mehdi Amini
a5deba03e2 Use StringRef in LTOModule implementation (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282997 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-01 01:18:16 +00:00
Davide Italiano
c5efc2c93d [llvm-objdump] Switch to a range loop. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282982 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 23:22:42 +00:00
Rui Ueyama
3f7d1658c9 Do not pass a superblock to PDBFileBuilder.
When we create a PDB file using PDBFileBuilder, the information
in the superblock, such as the size of the resulting file, is not
available.

Previously, PDBFileBuilder::initialize took a superblock assuming
that all the members of the struct are correct. That is useful when
you want to restore the exact information from a YAML file, but
that's probably the only use case in which that is useful.
When we are creating a PDB file on the fly, we have to backfill the
members.

This patch redefines PDBFileBuilder::initialize to take only a
block size. Now all the other members are left as default values,
so that they'll be updated when commit() is called.

Differential Revision: https://reviews.llvm.org/D25108

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282944 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 20:52:12 +00:00
Rui Ueyama
9d24c09035 Pass a filename instead of a msf::WritableStream to PDBFileBuilder::commit.
WritableStream needs the exact file size to open a file, but
until we fix the final layout of a PDB file, we don't know the
size of the file.

This patch changes the parameter type of PDBFileBuilder::commit
to solve that chiecken-and-egg problem. Now the function opens
a file after fixing the layout, so it can create a file with the
exact size.

Differential Revision: https://reviews.llvm.org/D25107

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282940 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 20:34:44 +00:00
Joerg Sonnenberger
4c3dd49f1c HAVE_LINK_R is not the only reason why this needs config.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282923 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-30 20:11:21 +00:00
Mike Aizatsky
dc72d130bb [sancov] introducing symbolized coverage files (.symcov)
Summary:
Answering any meaningful questions about .sancov files requires
accessing symbol information from the corresponding binary.

This change introduces a separate intermediate data structure and
format: symbolized coverage. It contains all symbol information that
is required to answer common queries:
- merging
- coverd/uncovered files and functions
- line status.

Also removing the html report functionality from sancov: generated
HTML files are too huge, and a different approach is required.
Maintaining this half-working approach in the C++ is painful.

Differential Revision: https://reviews.llvm.org/D24947

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282639 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 21:39:28 +00:00
Mike Aizatsky
451a26b1e0 [sancov] a simple .symcov coverage report server
Coverage reports for gigabyte-sized binaries are huge. There's no
practical reason to generate them statically.

Implementing an experiment http coverage report server. The server
loads .symcov file and serves interactive coverage pages.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282637 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 21:27:58 +00:00
Dylan McKay
e62cb24021 [AVR] Allow llvm-objdump to handle AVR ELF files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28 13:15:17 +00:00
Adam Nemet
47c0d49055 Output optimization remarks in YAML
(Re-committed after moving the template specialization under the yaml
namespace.  GCC was complaining about this.)

This allows various presentation of this data using an external tool.
This was first recommended here[1].

As an example, consider this module:

  1 int foo();
  2 int bar();
  3
  4 int baz() {
  5   return foo() + bar();
  6 }

The inliner generates these missed-optimization remarks today (the
hotness information is pulled from PGO):

  remark: /tmp/s.c:5:10: foo will not be inlined into baz (hotness: 30)
  remark: /tmp/s.c:5:18: bar will not be inlined into baz (hotness: 30)

Now with -pass-remarks-output=<yaml-file>, we generate this YAML file:

  --- !Missed
  Pass:            inline
  Name:            NotInlined
  DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 10 }
  Function:        baz
  Hotness:         30
  Args:
    - Callee: foo
    - String:  will not be inlined into
    - Caller: baz
  ...
  --- !Missed
  Pass:            inline
  Name:            NotInlined
  DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 18 }
  Function:        baz
  Hotness:         30
  Args:
    - Callee: bar
    - String:  will not be inlined into
    - Caller: baz
  ...

This is a summary of the high-level decisions:

* There is a new streaming interface to emit optimization remarks.
E.g. for the inliner remark above:

   ORE.emit(DiagnosticInfoOptimizationRemarkMissed(
                DEBUG_TYPE, "NotInlined", &I)
            << NV("Callee", Callee) << " will not be inlined into "
            << NV("Caller", CS.getCaller()) << setIsVerbose());

NV stands for named value and allows the YAML client to process a remark
using its name (NotInlined) and the named arguments (Callee and Caller)
without parsing the text of the message.

Subsequent patches will update ORE users to use the new streaming API.

* I am using YAML I/O for writing the YAML file.  YAML I/O requires you
to specify reading and writing at once but reading is highly non-trivial
for some of the more complex LLVM types.  Since it's not clear that we
(ever) want to use LLVM to parse this YAML file, the code supports and
asserts that we're writing only.

On the other hand, I did experiment that the class hierarchy starting at
DiagnosticInfoOptimizationBase can be mapped back from YAML generated
here (see D24479).

* The YAML stream is stored in the LLVM context.

* In the example, we can probably further specify the IR value used,
i.e. print "Function" rather than "Value".

* As before hotness is computed in the analysis pass instead of
DiganosticInfo.  This avoids the layering problem since BFI is in
Analysis while DiagnosticInfo is in IR.

[1] https://reviews.llvm.org/D19678#419445

Differential Revision: https://reviews.llvm.org/D24587

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282539 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-27 20:55:07 +00:00
Martin Storsjo
66a39342c2 Fix a typo, depricated -> deprecated
Differential Revision: https://reviews.llvm.org/D22849


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282534 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-27 19:45:30 +00:00
Davide Italiano
d370d4d137 [llvm-cxxfilt] Use llvm::outs(). Simplify.
This adds a dependency on Support/. As llvm-cxxfilt will grow
support for options this will be needed anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282523 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-27 18:50:30 +00:00
Adam Nemet
2713e77a55 Revert "Output optimization remarks in YAML"
This reverts commit r282499.

The GCC bots are failing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282503 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-27 16:39:24 +00:00
Adam Nemet
3ecd7534da Output optimization remarks in YAML
This allows various presentation of this data using an external tool.
This was first recommended here[1].

As an example, consider this module:

  1 int foo();
  2 int bar();
  3
  4 int baz() {
  5   return foo() + bar();
  6 }

The inliner generates these missed-optimization remarks today (the
hotness information is pulled from PGO):

  remark: /tmp/s.c:5:10: foo will not be inlined into baz (hotness: 30)
  remark: /tmp/s.c:5:18: bar will not be inlined into baz (hotness: 30)

Now with -pass-remarks-output=<yaml-file>, we generate this YAML file:

  --- !Missed
  Pass:            inline
  Name:            NotInlined
  DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 10 }
  Function:        baz
  Hotness:         30
  Args:
    - Callee: foo
    - String:  will not be inlined into
    - Caller: baz
  ...
  --- !Missed
  Pass:            inline
  Name:            NotInlined
  DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 18 }
  Function:        baz
  Hotness:         30
  Args:
    - Callee: bar
    - String:  will not be inlined into
    - Caller: baz
  ...

This is a summary of the high-level decisions:

* There is a new streaming interface to emit optimization remarks.
E.g. for the inliner remark above:

   ORE.emit(DiagnosticInfoOptimizationRemarkMissed(
                DEBUG_TYPE, "NotInlined", &I)
            << NV("Callee", Callee) << " will not be inlined into "
            << NV("Caller", CS.getCaller()) << setIsVerbose());

NV stands for named value and allows the YAML client to process a remark
using its name (NotInlined) and the named arguments (Callee and Caller)
without parsing the text of the message.

Subsequent patches will update ORE users to use the new streaming API.

* I am using YAML I/O for writing the YAML file.  YAML I/O requires you
to specify reading and writing at once but reading is highly non-trivial
for some of the more complex LLVM types.  Since it's not clear that we
(ever) want to use LLVM to parse this YAML file, the code supports and
asserts that we're writing only.

On the other hand, I did experiment that the class hierarchy starting at
DiagnosticInfoOptimizationBase can be mapped back from YAML generated
here (see D24479).

* The YAML stream is stored in the LLVM context.

* In the example, we can probably further specify the IR value used,
i.e. print "Function" rather than "Value".

* As before hotness is computed in the analysis pass instead of
DiganosticInfo.  This avoids the layering problem since BFI is in
Analysis while DiagnosticInfo is in IR.

[1] https://reviews.llvm.org/D19678#419445

Differential Revision: https://reviews.llvm.org/D24587

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282499 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-27 16:15:16 +00:00
Vedant Kumar
64f3b51479 [llvm-cov] Silence a warning from the MSVC runtime (NFC)
Rework getLongestCommonPrefixLen() so that it doesn't access string null
terminators. The old version with std::mismatch would do this:

                        |
                        v
    Strings[0] = ['a', nil]

    Strings[1] = ['a', 'a', nil]
                        ^
                        |

This should silence a warning from the MSVC runtime (PR30515). As
before, I tested this out by preparing a coverage report for FileCheck.
Thanks to Yaron Keren for the report!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282422 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-26 17:57:13 +00:00
Sam Kolton
ecba0242f4 Revert "[AMDGPU] Disassembler: print label names in branch instructions"
This reverts commit 6c6dbe6252.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282396 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-26 11:29:03 +00:00