Commit Graph

264445 Commits

Author SHA1 Message Date
George Rimar adaba7aeaa [ELF] - Simplify gdb-index-empty.s
Just simplifies existent test.

Differential revision: https://reviews.llvm.org/D33986

llvm-svn: 305073
2017-06-09 13:30:36 +00:00
Serge Rogatch 85427c0da7 [XRay] Fix computation of function size subject to XRay threshold
Summary:
Currently XRay compares its threshold against `Function::size()` . However, `Function::size()` returns the number of basic blocks (as I understand, such as cycle bodies, if/else bodies, switch-case bodies, etc.), rather than the number of instructions.

The name of the parameter `-fxray-instruction-threshold=N`, as well as XRay documentation at http://llvm.org/docs/XRay.html , suggests that instructions should be counted, rather than the number of basic blocks.

I see two options:
1. Count the number of MachineInstr`s in MachineFunction : this gives better  estimate for the number of assembly instructions on the target. So a user can check in disassembly that the threshold works more or less correctly.
2. Count the number of Instruction`s in a Function : AFAIK, this gives correct number of IR instructions, which the user can check in IR listing. However, this number may be far (several times for small functions) from the number of assembly instructions finally emitted.

Option 1 is implemented in this patch because I think that having the closer estimate for the number of assembly instructions emitted is more important than to have a clear definition of the metric.

Reviewers: dberris, rengolin

Reviewed By: dberris

Subscribers: llvm-commits, iid_iunknown

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

llvm-svn: 305072
2017-06-09 13:23:23 +00:00
George Rimar af845f26e6 [ELF] - Fix build bot.
llvm-svn: 305071
2017-06-09 12:58:13 +00:00
Nirav Dave 43a4d8122f Prevent RemoveDeadNodes from deleted already deleted node.
This prevents against assertion errors like PR32659 which occur from a
replacement deleting a node after it's been added to the list argument
of RemoveDeadNodes. The specific failure from PR32659 does not
currently happen, but it is still potentially possible. The underlying
cause is that the callers of the change dfunction builds up a list of
nodes to delete after having moved their uses and it possible that a
move of a later node will cause a previously deleted nodes to be
deleted.

Reviewers: bkramer, spatel, davide

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 305070
2017-06-09 12:57:35 +00:00
George Rimar 1840901a2f [ELF] - Allow producing -r output if only empty archive is given.
This is used by linux kernel build system.

(https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt "3.2 Built-in object goals")

It has for example next configuration for linking built-in.o files:
drivers-y	:= $(patsubst %/, %/built-in.o, $(drivers-y))
drivers-$(CONFIG_PCI)		+= arch/ia64/pci/
...
drivers-$(CONFIG_OPROFILE)	+= arch/ia64/oprofile/

Im most simple case all CONFIG_* options are off. That means linker is called with empty input archive, 
emulation option and no inputs and expected to generate some relocatable output. 
ld.bfd is able to do that, we dont.

Patch allows to support this case.

Differential revision: https://reviews.llvm.org/D33937

llvm-svn: 305069
2017-06-09 12:26:57 +00:00
Nikolai Bozhenov de57795cc8 Revert of r305066 "Reapply Frontend support for Nios2 target"
llvm-svn: 305068
2017-06-09 12:09:29 +00:00
Roman Lebedev 739b48399d [clang-tools-extra] ReleaseNotes.rst: test commit: whitespace fix
llvm-svn: 305067
2017-06-09 12:00:04 +00:00
Nikolai Bozhenov b2de17c734 Reapply "Frontend support for Nios2 target"
Summary:
- Implements TargetInfo class for Nios2 target.
- Enables handling of -march and -mcpu options for Nios2 target.
- Definition of Nios2 builtin functions.

Reviewed By: craig.topper

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

Author: belickim <mateusz.belicki@intel.com>
llvm-svn: 305066
2017-06-09 10:56:18 +00:00
Peter Smith 28285576cb [ELF] Be more precise about Thumb state bit in ARM thunks
The symbols generated for Thunks have type STT_FUNC, to permit a thunk to
be reused via a blx instruction the Thumb bit (0) needs to be set properly.

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

llvm-svn: 305065
2017-06-09 09:51:51 +00:00
Oliver Stannard ad0973557c [ARM] Add scheduling info for VFMS
The scalar VFMS instructions did not have scheduling information attached (but
VFMA did), which was causing assertion failures with the Cortex-A57 scheduling
model and -fp-contract=fast.

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

llvm-svn: 305064
2017-06-09 09:19:09 +00:00
NAKAMURA Takumi 1b47ff7ee8 llvm/test/DebugInfo/PDB/pdbdump-debug-subsections.test: Try to unbreak r305043.
llvm-svn: 305063
2017-06-09 08:50:39 +00:00
Pavel Labath 54d405033a Skip TestNoreturnUnwind on linux+clang+arm
I was over-eager to unable this test in r304976. It still fails in this
combination, at there does not seem to be anything we can do about it,
as the generated code does not preserve the link register.

llvm-svn: 305062
2017-06-09 08:33:59 +00:00
Erik Verbruggen efe6fa501c Speed up preamble loading
Cache filename - SourceLocation pairs to speed up preamble loading and
global completion. This is especially relevant for windows, where
preamble loading takes a while.

Patch by Ivan Donchevskii!

Differential Revision: http://reviews.llvm.org/D33493

llvm-svn: 305061
2017-06-09 08:29:58 +00:00
Siddharth Bhat 286c916dde [Polly] [ScopDetection] Allow passing multiple functions to `-polly-only-func`.
- This is useful to run optimisations on only certain functions.

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

llvm-svn: 305060
2017-06-09 08:23:40 +00:00
Stefan Maksimovic add20f8f17 Test commit: remove whitespace
llvm-svn: 305059
2017-06-09 07:57:05 +00:00
Maxim Ostapenko d8c47ca836 [asan] Fix ASan internal failure in AllocateFromLocalPool
This patch addresses PR 33206. There might be a situation when dynamic ASan runtime initializes later
than shared library which has malloc in static constructor (rtld doesn't provide an order of shared libs initialization).
In this case ASan hasn't yet initialized interceptors, but already intercepts malloc.
If malloc is too big to be handled by static local pool, ASan will die with error: 
Sanitizer CHECK failed: lib/asan/asan_malloc_linux.cc:40 ((allocated_for_dlsym)) < ((kDlsymAllocPoolSize)) (1036, 1024)

Patch by Denis Khalikov.

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

llvm-svn: 305058
2017-06-09 07:47:38 +00:00
Alexander Kornienko 564f1c74b6 Revert "[clang-tidy] When" -fno-exceptions is used", this warning is better to be suppressed."
This reverts commit r304949.

https://reviews.llvm.org/D34002#775830

llvm-svn: 305057
2017-06-09 07:34:58 +00:00
David Blaikie 4a60d370e8 bugpoint: disabling symbolication of bugpoint-executed programs
Initial implementation - needs similar work/testing for other tools
bugpoint invokes (llc, lli I think, maybe more).

Alternatively (as suggested by chandlerc@) an environment variable could
be used. This would allow the option to pass transparently through user
scripts, pass to compilers if they happened to be LLVM-ish, etc.

I worry a bit about using cl::opt in the crash handling code - LLVM
might crash early, perhaps before the cl::opt is properly initialized?
Or at least before arguments have been parsed?

 - should be OK since it defaults to "pretty", so if the crash is very
 early in opt parsing, etc, then crash reports will still be symbolized.

I shyed away from doing this with an environment variable when I
realized that would require copying the existing environment and
appending the env variable of interest. But it seems there's no existing
LLVM API for accessing the environment (even the Support tests for
process launching have their own ifdefs for getting the environment). It
could be added, but seemed like a higher bar/untested codepath to
actually add environment variables.

Most importantly, this reduces the runtime of test/BugPoint/metadata.ll
in a split-dwarf Debug build from 1m34s to 6.5s by avoiding a lot of
symbolication. (this wasn't a problem for non-split-dwarf builds only
because the executable was too large to map into memory (due to bugpoint
setting a 400MB memory (including address space - not sure why? Going to
remove that) limit on the child process) so symbolication would fail
fast & wouldn't spend all that time parsing DWARF, etc)

Reviewers: chandlerc, dannyb

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

llvm-svn: 305056
2017-06-09 07:29:03 +00:00
Serguei Katkov 38414b57f9 [IndVars] Add an option to be able to disable LFTR
This change adds an option disable-lftr to be able to disable Linear Function Test Replace optimization.
By default option is off so current behavior is not changed.

Reviewers: reames, sanjoy, wmi, andreadb, apilipenko
Reviewed By: sanjoy
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D33979

llvm-svn: 305055
2017-06-09 06:11:59 +00:00
George Rimar b4b7b74b5a [ELF] - Fix build bot.
SyntheticSections.cpp:1773:29: error: chosen constructor is explicit in copy-initialization
        CuVectors.push_back({});
                            ^~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/set:428:14: note: constructor declared here
    explicit set(const value_compare& __comp = value_compare())
             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/vector:702:59: note: passing argument to parameter '__x' here
    _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x);

llvm-svn: 305054
2017-06-09 04:48:56 +00:00
George Burgess IV a20352e13e [LoopVectorize] Don't preserve nsw/nuw flags on shrunken ops.
If we're shrinking a binary operation, it may be the case that the new
operations wraps where the old didn't. If this happens, the behavior
should be well-defined. So, we can't always carry wrapping flags with us
when we shrink operations.

If we do, we get incorrect optimizations in cases like:

void foo(const unsigned char *from, unsigned char *to, int n) {
  for (int i = 0; i < n; i++)
    to[i] = from[i] - 128;
}

which gets optimized to:

void foo(const unsigned char *from, unsigned char *to, int n) {
  for (int i = 0; i < n; i++)
    to[i] = from[i] | 128;
}

Because:
- InstCombine turned `sub i32 %from.i, 128` into
  `add nuw nsw i32 %from.i, 128`.
- LoopVectorize vectorized the add to be `add nuw nsw <16 x i8>` with a
  vector full of `i8 128`s
- InstCombine took advantage of the fact that the newly-shrunken add
  "couldn't wrap", and changed the `add` to an `or`.

InstCombine seems happy to figure out whether we can add nuw/nsw on its
own, so I just decided to drop the flags. There are already a number of
places in LoopVectorize where we rely on InstCombine to clean up.

llvm-svn: 305053
2017-06-09 03:56:15 +00:00
David Blaikie cb9327b02d Inliner: Don't touch indirect calls
Other comments/implications are that this isn't intended behavior (nor
perserved/reimplemented in the new inliner) & complicates fixing the
'inlining' of trivially dead calls without consulting the cost function
first.

llvm-svn: 305052
2017-06-09 03:29:20 +00:00
Rui Ueyama 365d4d0000 Fix -Wunused-variable.
llvm-svn: 305051
2017-06-09 03:26:45 +00:00
Craig Topper 8416678804 [llvm-pdbdump] Fix -Wpessimizing-move warnings.
llvm-svn: 305050
2017-06-09 03:25:57 +00:00
Craig Topper a420562257 [InstCombine] Pass a proper context instruction to all of the calls into InstSimplify
Summary: This matches the behavior we already had for compares and makes us consistent everywhere.

Reviewers: dberlin, hfinkel, spatel

Reviewed By: dberlin

Subscribers: llvm-commits

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

llvm-svn: 305049
2017-06-09 03:21:29 +00:00
Rui Ueyama f08b38cbe1 Simplify. NFC.
llvm-svn: 305048
2017-06-09 03:19:08 +00:00
Rui Ueyama a1ba859ad3 Simplify. NFC.
llvm-svn: 305047
2017-06-09 02:42:20 +00:00
Argyrios Kyrtzidis 783e4c2e32 [clangd] Update for ASTUnit API change.
llvm-svn: 305046
2017-06-09 02:04:19 +00:00
Richard Smith d9259c2f5e Remove 'Filename' parameter from BeginSourceFileAction.
No-one was using this, and it's not meaningful in general -- FrontendActions
can be run on inputs that don't have a corresponding source file. The current
frontend input can be obtained by asking the FrontendAction if any future
action actually needs it.

llvm-svn: 305045
2017-06-09 01:36:10 +00:00
Argyrios Kyrtzidis 735e92c29a [libclang] Introduce a new parsing option 'CXTranslationUnit_SingleFileParse' that puts preprocessor in a mode for parsing a single file only.
This is useful for parsing a single file, as a fast/inaccurate 'mode' that can still provide declarations from the file, like the classes and their methods.

llvm-svn: 305044
2017-06-09 01:20:48 +00:00
Bob Haarman fdf499bf2d [codeview] use 32-bit integer for RelocOffset in DebugLinesSubsection
Summary:
RelocOffset is a 32-bit value, but we previously truncated it to 16 bits.

Fixes PR33335.

Reviewers: zturner, hiraditya!

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 305043
2017-06-09 01:18:10 +00:00
Rafael Espindola 6b901217dc Fix filename.
It was passing locally because of a leftover file.

llvm-svn: 305042
2017-06-09 00:56:09 +00:00
Zachary Turner 28c22c83e3 [pdb] Don't crash on unknown debug subsections.
More and more unknown debug subsection kinds are being discovered
so we should make it possible to dump these and display the
bytes.

llvm-svn: 305041
2017-06-09 00:53:59 +00:00
Rafael Espindola 85c607ea56 Add a test for R_386_PC16 range checking.
llvm-svn: 305040
2017-06-09 00:48:55 +00:00
Saleem Abdulrasool 54448909bf Represent debug information compression type fully
This is tied with the LLVM side of the change to expose the debug
information compression types to clang.  We now track the compression
type as an enumeration rather than a boolean.  We still use the same
value (GNU) that we did previously.  This is in preparation to support
passing down the compression type and switch it based on the command
line.

llvm-svn: 305039
2017-06-09 00:40:30 +00:00
Saleem Abdulrasool 1f62f57b37 sink DebugCompressionType into MC for exposing to clang
This is a preparatory change to expose the debug compression style to
clang.  It requires exposing the enumeration and passing the actual
value through to the backend from the frontend in actual value form
rather than a boolean that selects the GNU style of debug info
compression.

Minor tweak to the ELF Object Writer to use a variable for re-used
values.  Add an assertion that debug information format is one of the
two currently known types if debug information is being compressed.

llvm-svn: 305038
2017-06-09 00:40:19 +00:00
Zachary Turner deb391309c [CodeView] Support remaining debug subsection types
This adds support for Symbols, StringTable, and FrameData subsection
types.  Even though these subsections rarely if ever appear in a PDB
file (they are usually in object files), there's no theoretical reason
why they *couldn't* appear in a PDB.  The real issue though is that in
order to add support for dumping and writing them (which will be useful
for object files), we need a way to test them.  And since there is no
support for reading and writing them to / from object files yet, making
PDB support them is the best way to both add support for the underlying
format and add support for tests at the same time.  Later, when we go
to add support for reading / writing them from object files, we'll need
only minimal changes in the underlying read/write code.

llvm-svn: 305037
2017-06-09 00:28:08 +00:00
Zachary Turner 4fcdaa9423 Fix build by adding includes.
llvm-svn: 305036
2017-06-08 23:53:35 +00:00
Davide Italiano 983c3d8ed3 [VMRange] Simplify a couple of member functions. NFCI.
llvm-svn: 305035
2017-06-08 23:49:56 +00:00
Zachary Turner 1bf7762049 [llvm-pdbdump] Support native ordering of subsections in raw mode.
This is the same change for the YAML Output style applied to the
raw output style.  Previously we would queue up all subsections
until every one had been read, and then output them in a pre-
determined order.  This was because some subsections need to be
read first in order to properly dump later subsections.  This
patch allows them to be dumped in the order they appear.

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

llvm-svn: 305034
2017-06-08 23:49:01 +00:00
Rui Ueyama 67aea737f3 Use check() to report an error.
llvm-svn: 305033
2017-06-08 23:43:44 +00:00
Zachary Turner 3eedd16114 [llvm-pdbdump] Improve consistency among subcommands.
The pdb2yaml and raw subcommands did something very
similar but with a different output format, and they
used a lot of the same command line options, but each
one re-implemented the command line option with slightly
different spellings / options.  This patch merges them
together into a single definition which is shared by
both subcommands.  This new syntax also allows for more
flexibility in the way debug subsections are dumped.

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

llvm-svn: 305032
2017-06-08 23:39:33 +00:00
Evgeniy Stepanov d02dbf6b1c [CFI] Remove LinkerSubsectionsViaSymbols.
Since D17854 LinkerSubsectionsViaSymbols is unnecessary.

It is interfering with ThinLTO implementation of CFI-ICall, where
the aliases used on the !LinkerSubsectionsViaSymbols branch are
needed to export jump tables to ThinLTO backends.

This is the second attempt to land this change after fixing PR33316.

llvm-svn: 305031
2017-06-08 23:38:22 +00:00
Craig Topper 2aa4d39f5e [ExtractGV] Fix the doxygen comment on the constructor and the class to refer to global values instead of functions. While there fix an 80 column violation. NFC
llvm-svn: 305030
2017-06-08 23:38:19 +00:00
Galina Kistanova 415ec9260f Fixed warning: dereferencing type-punned pointer will break strict-aliasing rules.
No need in reinterpret_cast<StringTableOffset &> here, as struct coff_symbol Name is a unin
with the member StringTableOffset Offset. This union member could be accessed directly.

llvm-svn: 305029
2017-06-08 23:35:52 +00:00
Craig Topper c1993fa1a3 [IR] Remove getNumSuccessorsV/getSuccessorV/setSuccessorV from the TerminatorInst subclasses as much as possible now that Value has been de-virtualized
These used to be virtual methods that would enable doing the right thing with only a TerminatorInst pointer. I believe they were also acting as vtable anchors in my cases. I think the fact that they had a separate name ending in V was to allow a version without V to be called without a virtual call in a pre-C++11 final keyword world.

Where possible the base methods in TerminatorInst dispatch directly to the public methods in the classes that have the same signature. For some classes this wasn't possible so I've left private method versions that match the name and signature of the version in TerminatorInst. All versions have been moved into the class definitions since we no longer need vtable anchors here.

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

llvm-svn: 305028
2017-06-08 23:23:08 +00:00
Peter Collingbourne e357fbd243 Write summaries for merged modules when splitting modules for ThinLTO.
This is to prepare to allow for dead stripping of globals in the
merged modules.

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

llvm-svn: 305027
2017-06-08 23:01:49 +00:00
Kostya Serebryany 2c2fb8896b [sanitizer-coverage] one more flavor of coverage: -fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. Reapplying revisions 304630, 304631, 304632, 304673, see PR33308
llvm-svn: 305026
2017-06-08 22:58:19 +00:00
Peter Wu 0f215dd8ae [ASTMatchers] temporary disable tests with floating suffix
r305022 assumed that floatLiteral(equals(1.2)) would also match 1.2f and
1.2l, but apparently that is not the case. Until it is clear how to
match, temporary disable the test to fix CI.

llvm-svn: 305025
2017-06-08 22:58:12 +00:00
Alexander Kornienko 934b516a0a [clang-tidy] Use -fexceptions explicitly in the tests that need exceptions.
This should fix relevant buildbot breakages.

llvm-svn: 305024
2017-06-08 22:25:23 +00:00