Peter Collingbourne [Tue, 28 Nov 2017 22:50:53 +0000 (22:50 +0000)]
COFF: Simplify construction of safe SEH table. NFCI.
Instead of building intermediate sets of exception handlers for each
object file, just create one for the final output file.
Differential Revision: https://reviews.llvm.org/D40581
llvm-svn: 319244
Simon Pilgrim [Tue, 28 Nov 2017 22:47:45 +0000 (22:47 +0000)]
[X86][SSE] Use SSE_PACK OpndItins in PACKSS/PACKUS instruction definitions
Update multi-classes to take the scheduling OpndItins instead of hard coding it.
SSE_PACK will be reused in the AVX512 equivalents.
llvm-svn: 319243
Adam Nemet [Tue, 28 Nov 2017 22:39:38 +0000 (22:39 +0000)]
Remove this test
After r319235, we no longer generate this remark.
llvm-svn: 319242
Dean Michael Berris [Tue, 28 Nov 2017 22:33:07 +0000 (22:33 +0000)]
[XRay][compiler-rt] Fix runtime build
This isolates the per-architecture files from the common files
implementing the XRay facilities. Because of the refactoring done in
D39114, we were including the definition of the sources in the archive
twice, causing link-time failures.
Follow-up to D39114.
llvm-svn: 319241
Simon Pilgrim [Tue, 28 Nov 2017 22:32:43 +0000 (22:32 +0000)]
Fix VS2017 narrowing conversion warning. NFCI
llvm-svn: 319240
Craig Topper [Tue, 28 Nov 2017 22:28:23 +0000 (22:28 +0000)]
[X86] Remove unused variable.
llvm-svn: 319239
Rui Ueyama [Tue, 28 Nov 2017 22:17:39 +0000 (22:17 +0000)]
Fix spelling. NFC.
llvm-svn: 319238
Alex Shlyapnikov [Tue, 28 Nov 2017 22:15:27 +0000 (22:15 +0000)]
[LSan] Fix one source of stale segments in the process memory mapping.
Summary:
Load process memory map after updating the same cache to reflect the
umap happening in the process of updating.
Also clear out the buffer in case of failed read of /proc/self/maps (not
the source of stale segments, but can lead to the similar crash).
Reviewers: eugenis
Subscribers: llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D40529
llvm-svn: 319237
Rui Ueyama [Tue, 28 Nov 2017 22:14:13 +0000 (22:14 +0000)]
Remove unused `using`.
llvm-svn: 319236
Adam Nemet [Tue, 28 Nov 2017 22:11:00 +0000 (22:11 +0000)]
Demote this opt remark to DEBUG.
From a random opt-stat output:
Top 10 remarks:
tailcallelim/tailcall 53%
inline/AlwaysInline 13%
gvn/LoadClobbered 13%
inline/Inlined 8%
inline/TooCostly 2%
inline/NoDefinition 2%
licm/LoadWithLoopInvariantAddressInvalidated 2%
licm/Hoisted 1%
asm-printer/InstructionCount 1%
prologepilog/StackSize 1%
llvm-svn: 319235
Craig Topper [Tue, 28 Nov 2017 22:08:51 +0000 (22:08 +0000)]
[X86] Remove code from combineUIntToFP that tried to favor UINT_TO_FP if legal when zero extending from vXi8/vX816.
The UINT_TO_FP is immediately converted to SINT_TO_FP when the node is re-evaluated because we'll detect that the sign bit is zero.
llvm-svn: 319234
Craig Topper [Tue, 28 Nov 2017 22:08:48 +0000 (22:08 +0000)]
[X86] Remove custom lowering for uint_to_fp from vXi8/vXi16.
We have a DAG combine that uses a zero extend that should prevent this from ever occurring now.
llvm-svn: 319233
Daniel Sanders [Tue, 28 Nov 2017 22:07:05 +0000 (22:07 +0000)]
[globalisel][tablegen] Add support for importing G_ATOMIC_CMPXCHG, G_ATOMICRMW_* rules from SelectionDAG.
GIM_CheckNonAtomic has been replaced by GIM_CheckAtomicOrdering to allow it to support a wider
range of orderings. This has then been used to import patterns using nodes such
as atomic_cmp_swap, atomic_swap, and atomic_load_*.
llvm-svn: 319232
Adrian Prantl [Tue, 28 Nov 2017 21:30:38 +0000 (21:30 +0000)]
SROA: Don't create variable fragments that are outside of the variable.
An alloca may be larger than a variable that is described to be stored
there. Don't create a dbg.value for fragments that are outside of the
variable.
This fixes PR35447.
https://bugs.llvm.org/show_bug.cgi?id=35447
llvm-svn: 319230
Peter Collingbourne [Tue, 28 Nov 2017 21:30:05 +0000 (21:30 +0000)]
COFF: Do not add symbols in discarded sections to SEH handler list.
Differential Revision: https://reviews.llvm.org/D40576
llvm-svn: 319229
Don Hinton [Tue, 28 Nov 2017 21:23:30 +0000 (21:23 +0000)]
[cmake] Pass LLVM_USE_LINKER flag when building host tools, e.g.,
LLVM_OPTIMIZED_TABLEGEN=ON, and not crosscompiling.
Differential Revision: https://reviews.llvm.org/D39734
llvm-svn: 319228
Alexey Bataev [Tue, 28 Nov 2017 21:11:44 +0000 (21:11 +0000)]
[OPENMP] Generalize capturing of clauses expressions.
The handling and capturing of the non-constant expressions of some of
the capturable clauses in combined directives is generalized.
llvm-svn: 319227
Jim Ingham [Tue, 28 Nov 2017 21:11:15 +0000 (21:11 +0000)]
Add elf-core/RegisterUtilities.{cpp,h} to the project file.
llvm-svn: 319226
Aaron Ballman [Tue, 28 Nov 2017 21:09:25 +0000 (21:09 +0000)]
Add a new clang-tidy module for Fuchsia as an umbrella to diagnose issues with the Fuschia and Zircon coding guidelines (https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md). Adds the first of such checkers, which detects when default arguments are declared in a function declaration or when default arguments are used at call sites.
Patch by Julie Hockett
llvm-svn: 319225
Alexey Bataev [Tue, 28 Nov 2017 20:48:24 +0000 (20:48 +0000)]
[SLP] Additional test for PR35354, NFC.
llvm-svn: 319224
Mandeep Singh Grang [Tue, 28 Nov 2017 20:48:10 +0000 (20:48 +0000)]
[Hexagon] Use stable sort for HexagonShuffler to remove non-deterministic ordering
Summary:
This fixes failures in the following tests uncovered by D39245:
LLVM :: CodeGen/Hexagon/args.ll
LLVM :: CodeGen/Hexagon/constp-extract.ll
LLVM :: CodeGen/Hexagon/expand-condsets-basic.ll
LLVM :: CodeGen/Hexagon/gp-rel.ll
LLVM :: CodeGen/Hexagon/packetize_cond_inst.ll
LLVM :: CodeGen/Hexagon/simple_addend.ll
LLVM :: CodeGen/Hexagon/swp-stages4.ll
LLVM :: CodeGen/Hexagon/swp-vmult.ll
LLVM :: CodeGen/Hexagon/swp-vsum.ll
LLVM :: MC/Hexagon/align.s
LLVM :: MC/Hexagon/asmMap.s
LLVM :: MC/Hexagon/dis-duplex-p0.s
LLVM :: MC/Hexagon/double-vector-producer.s
LLVM :: MC/Hexagon/inst_select.ll
LLVM :: MC/Hexagon/instructions/j.s
Reviewers: colinl, kparzysz, adasgupt, slarin
Reviewed By: kparzysz
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D40227
llvm-svn: 319223
Mandeep Singh Grang [Tue, 28 Nov 2017 20:41:13 +0000 (20:41 +0000)]
[OpenMP] Stable sort Privates to remove non-deterministic ordering
Summary:
This fixes the following failures uncovered by D39245:
Clang :: OpenMP/task_firstprivate_codegen.cpp
Clang :: OpenMP/task_private_codegen.cpp
Clang :: OpenMP/taskloop_firstprivate_codegen.cpp
Clang :: OpenMP/taskloop_lastprivate_codegen.cpp
Clang :: OpenMP/taskloop_private_codegen.cpp
Clang :: OpenMP/taskloop_simd_firstprivate_codegen.cpp
Clang :: OpenMP/taskloop_simd_lastprivate_codegen.cpp
Clang :: OpenMP/taskloop_simd_private_codegen.cpp
Reviewers: rjmccall, ABataev, AndreyChurbanov
Reviewed By: rjmccall, ABataev
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D39947
llvm-svn: 319222
Rui Ueyama [Tue, 28 Nov 2017 20:39:17 +0000 (20:39 +0000)]
Move Memory.{h,cpp} to Common.
Differential Revision: https://reviews.llvm.org/D40571
llvm-svn: 319221
Daniel Sanders [Tue, 28 Nov 2017 20:27:59 +0000 (20:27 +0000)]
[aarch64][globalisel] Add missing tests from r319216
llvm-svn: 319220
Sam Clegg [Tue, 28 Nov 2017 20:27:21 +0000 (20:27 +0000)]
[WebAssembly] Remove initializers from Config.h
These should get initialized in by Driver.cpp based on
command line options.
Also, sort entries.
Differential Revision: https://reviews.llvm.org/D40570
llvm-svn: 319219
Sean Fertile [Tue, 28 Nov 2017 20:25:58 +0000 (20:25 +0000)]
[PowerPC] Allow tail calls of fastcc functions from C CallingConv functions.
Allow fastcc callees to be tail-called from ccc callers.
Differential Revision: https://reviews.llvm.org/D40355
llvm-svn: 319218
Rafael Espindola [Tue, 28 Nov 2017 20:21:44 +0000 (20:21 +0000)]
Bring r319051 back.
It had been reverted because it depended on r319008 which has been
recommitted.
Original message:
Add a missing test.
We were not testing that we correctly handled a .o with a weak symbol
after a .so.
llvm-svn: 319217
Daniel Sanders [Tue, 28 Nov 2017 20:21:15 +0000 (20:21 +0000)]
[aarch64][globalisel] Define G_ATOMIC_CMPXCHG and G_ATOMICRMW_* and make them legal
The IRTranslator cannot generate these instructions at the moment so there's no
issue with not having implemented ISel for them yet. D40092 will add
G_ATOMIC_CMPXCHG_WITH_SUCCESS and G_ATOMICRMW_* to the IRTranslator and a
further patch will add support for lowering G_ATOMIC_CMPXCHG_WITH_SUCCESS into
G_ATOMIC_CMPXCHG with an external success check via the `Lower` action.
The separation of G_ATOMIC_CMPXCHG_WITH_SUCCESS and G_ATOMIC_CMPXCHG is
to import SelectionDAG rules while still supporting targets that prefer to
custom lower the original LLVM-IR-like operation.
llvm-svn: 319216
Rafael Espindola [Tue, 28 Nov 2017 20:17:58 +0000 (20:17 +0000)]
Bring back r319008.
This includes a fix to mark copy reloc aliases as used.
Original message:
[ELF] Do not keep symbols if they referenced only from discarded sections.
This patch also ensures that in case of "--as-needed" is used,
DT_NEEDED entries are not created if they are required only by
these eliminated symbols.
llvm-svn: 319215
Rafael Espindola [Tue, 28 Nov 2017 20:13:12 +0000 (20:13 +0000)]
Add missing test.
This would have found the issue with r319008.
llvm-svn: 319214
Greg Clayton [Tue, 28 Nov 2017 20:04:43 +0000 (20:04 +0000)]
Update remote debugging page with many more details.
llvm-svn: 319213
Rui Ueyama [Tue, 28 Nov 2017 20:01:30 +0000 (20:01 +0000)]
Fix formatting.
llvm-svn: 319212
Rui Ueyama [Tue, 28 Nov 2017 19:58:45 +0000 (19:58 +0000)]
Factor out more code to Common/Args.cpp.
Differential Revision: https://reviews.llvm.org/D40540
llvm-svn: 319211
Mandeep Singh Grang [Tue, 28 Nov 2017 19:55:54 +0000 (19:55 +0000)]
[SelectionDAG] Make sorting predicate stronger to remove non-deterministic ordering
Summary:
Recommitting this with the correct sorting predicate. The Low field of Clusters is a ConstantInt and
cannot be directly compared. So we needed to invoke slt (signed less than) to compare correctly.
This fixes failures in the following tests uncovered by D39245:
LLVM :: CodeGen/ARM/ifcvt3.ll
LLVM :: CodeGen/ARM/switch-minsize.ll
LLVM :: CodeGen/X86/switch.ll
LLVM :: CodeGen/X86/switch-bt.ll
LLVM :: CodeGen/X86/switch-density.ll
Reviewers: hans, fhahn
Reviewed By: hans
Subscribers: aemerson, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D40541
llvm-svn: 319210
Simon Pilgrim [Tue, 28 Nov 2017 19:39:47 +0000 (19:39 +0000)]
[X86][SSE] Add SSE_HADDSUB/SSE_PABS/SSE_PALIGN OpndItins
Update multi-classes to take the scheduling OpndItins instead of hard coding it.
Will be reused in the AVX512 equivalents.
llvm-svn: 319209
Craig Topper [Tue, 28 Nov 2017 19:25:45 +0000 (19:25 +0000)]
[X86] In lowerVectorShuffleAsElementInsertion, if were able to find a scalar i8 or i16 and need to zero extend it, make sure we use a vXi32 type of the full vector width.
Previously, this was hardcoded to v4i32, but if the input type is 256 bits we need to use v8i32.
Fixes PR35443
llvm-svn: 319208
Francis Visoiu Mistrih [Tue, 28 Nov 2017 19:23:39 +0000 (19:23 +0000)]
[CodeGen] Fix doxygen \file comment style
llvm-svn: 319207
Francis Visoiu Mistrih [Tue, 28 Nov 2017 19:15:46 +0000 (19:15 +0000)]
[CodeGen] Fix doxygen
llvm-svn: 319206
Sanjay Patel [Tue, 28 Nov 2017 19:13:23 +0000 (19:13 +0000)]
[InstCombine] auto-generate complete test checks; NFC
llvm-svn: 319205
Krzysztof Parzyszek [Tue, 28 Nov 2017 19:13:17 +0000 (19:13 +0000)]
[Hexagon] Make sure to zero-extend bytes before building a vector
llvm-svn: 319204
Sanjay Patel [Tue, 28 Nov 2017 19:07:28 +0000 (19:07 +0000)]
[InstCombine] auto-generate complete test checks; NFC
llvm-svn: 319203
Daniel Sanders [Tue, 28 Nov 2017 18:57:02 +0000 (18:57 +0000)]
[mir] Print/Parse both MOLoad and MOStore when they occur together.
Summary:
They're not always mutually exclusive. read-modify-write atomics are both
at the same time. One example of this is the SWP instructions on AArch64.
Another example is GlobalISel's G_ATOMICRMW_* generic instructions which
will be added in a later patch.
Reviewers: arphaman, aemerson
Reviewed By: aemerson
Subscribers: aemerson, javed.absar, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D40157
llvm-svn: 319202
Artem Belevich [Tue, 28 Nov 2017 18:51:42 +0000 (18:51 +0000)]
[CUDA] Report "unsupported VLA" errors only on device side.
This fixes erroneously reported CUDA compilation errors
in host-side code during device-side compilation.
I've also restricted OpenMP-specific checks to trigger only
if we're compiling with OpenMP enabled.
Differential Revision: https://reviews.llvm.org/D40275
llvm-svn: 319201
Rafael Espindola [Tue, 28 Nov 2017 18:50:08 +0000 (18:50 +0000)]
Fix non assert build warnings.
llvm-svn: 319200
Hans Wennborg [Tue, 28 Nov 2017 18:44:26 +0000 (18:44 +0000)]
EntryExitInstrumenter: set DebugLocs on the inserted call instructions (PR35412)
Apparently the verifier requires that inlineable calls in a function
with debug info have debug locations.
llvm-svn: 319199
Zachary Turner [Tue, 28 Nov 2017 18:33:17 +0000 (18:33 +0000)]
[CodeView] Refactor / Rewrite TypeSerializer and TypeTableBuilder.
The motivation behind this patch is that future directions require us to
be able to compute the hash value of records independently of actually
using them for de-duplication.
The current structure of TypeSerializer / TypeTableBuilder being a
single entry point that takes an unserialized type record, and then
hashes and de-duplicates it is not flexible enough to allow this.
At the same time, the existing TypeSerializer is already extremely
complex for this very reason -- it tries to be too many things. In
addition to serializing, hashing, and de-duplicating, ti also supports
splitting up field list records and adding continuations. All of this
functionality crammed into this one class makes it very complicated to
work with and hard to maintain.
To solve all of these problems, I've re-written everything from scratch
and split the functionality into separate pieces that can easily be
reused. The end result is that one class TypeSerializer is turned into 3
new classes SimpleTypeSerializer, ContinuationRecordBuilder, and
TypeTableBuilder, each of which in isolation is simple and
straightforward.
A quick summary of these new classes and their responsibilities are:
- SimpleTypeSerializer : Turns a non-FieldList leaf type into a series of
bytes. Does not do any hashing. Every time you call it, it will
re-serialize and return bytes again. The same instance can be re-used
over and over to avoid re-allocations, and in exchange for this
optimization the bytes returned by the serializer only live until the
caller attempts to serialize a new record.
- ContinuationRecordBuilder : Turns a FieldList-like record into a series
of fragments. Does not do any hashing. Like SimpleTypeSerializer,
returns references to privately owned bytes, so the storage is
invalidated as soon as the caller tries to re-use the instance. Works
equally well for LF_FIELDLIST as it does for LF_METHODLIST, solving a
long-standing theoretical limitation of the previous implementation.
- TypeTableBuilder : Accepts sequences of bytes that the user has already
serialized, and inserts them by de-duplicating with a hash table. For
the sake of convenience and efficiency, this class internally stores a
SimpleTypeSerializer so that it can accept unserialized records. The
same is not true of ContinuationRecordBuilder. The user is required to
create their own instance of ContinuationRecordBuilder.
Differential Revision: https://reviews.llvm.org/D40518
llvm-svn: 319198
Simon Pilgrim [Tue, 28 Nov 2017 18:10:29 +0000 (18:10 +0000)]
[X86][X87] Tag FP_TO_INT_IN_MEM pseudos with hasNoSchedulingInfo
We don't need scheduling info for pseudos
llvm-svn: 319197
Rafael Espindola [Tue, 28 Nov 2017 18:02:22 +0000 (18:02 +0000)]
Handle binding in --wrap.
Copying the binding seems reasonable and matches the bfd behavior.
llvm-svn: 319196
Craig Topper [Tue, 28 Nov 2017 18:00:32 +0000 (18:00 +0000)]
[Target] Make a copy of TargetOptions feature list before sorting during CodeGen
Currently CodeGen is calling std::sort on the features vector in TargetOptions for every function, but I don't think CodeGen should be modifying TargetOptions.
Differential Revision: https://reviews.llvm.org/D40228
llvm-svn: 319195
Francis Visoiu Mistrih [Tue, 28 Nov 2017 17:58:43 +0000 (17:58 +0000)]
[CodeGen] Separate MachineOperand implementation from MachineInstr
Move the implementation to its own file.
Differential Revision: https://reviews.llvm.org/D40419
llvm-svn: 319194
Francis Visoiu Mistrih [Tue, 28 Nov 2017 17:58:38 +0000 (17:58 +0000)]
[CodeGen] Cleanup MachineOperand
* clang-format
* move doxygen from the implementation to headers
* remove duplicate doxygen
llvm-svn: 319193
Konstantin Zhuravlyov [Tue, 28 Nov 2017 17:51:08 +0000 (17:51 +0000)]
AMDGPU: Add num spilled s/vgprs to metadata
This was requested by tools.
Differential Revision: https://reviews.llvm.org/D40321
llvm-svn: 319192
Stephane Sezer [Tue, 28 Nov 2017 17:50:31 +0000 (17:50 +0000)]
Simplify UUID constructors
Summary: This remove a small amount of duplicated code.
Reviewers: clayborg, zturner, davide
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D40536
llvm-svn: 319191
Dan Liew [Tue, 28 Nov 2017 17:41:58 +0000 (17:41 +0000)]
[LibFuzzer] Improve comments on `CounterToFeature()` function.
This is based on discussion in https://reviews.llvm.org/D40376 .
The comments try to explain the reason for the current implementation
and note that it might change in the future, so clients should not
rely on this particular implementation.
Differential Revision: https://reviews.llvm.org/D40565
llvm-svn: 319190
Kamil Rytarowski [Tue, 28 Nov 2017 17:35:35 +0000 (17:35 +0000)]
Support the setjmp(3) family of functions in TSan/NetBSD
Summary:
This change adds support for the setjmp(3)/longjmp(3)
family of functions on NetBSD.
There are three types of them on NetBSD:
- setjmp(3) / longjmp(3)
- sigsetjmp(3) / sigsetjmp(3)
- _setjmp(3) / _longjmp(3)
Due to historical and compat reasons the symbol
names are mangled:
- setjmp -> __setjmp14
- longjmp -> __longjmp14
- sigsetjmp -> __sigsetjmp14
- siglongjmp -> __siglongjmp14
- _setjmp -> _setjmp
- _longjmp -> _longjmp
This leads to symbol renaming in the existing codebase.
There is no such symbol as __sigsetjmp/__longsetjmp
on NetBSD
Add a comment that GNU-style executable stack
note is not needed on NetBSD. The stack is not
executable without it.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, dvyukov, vitalybuka
Reviewed By: dvyukov
Subscribers: llvm-commits, kubamracek, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D40337
llvm-svn: 319189
Adam Nemet [Tue, 28 Nov 2017 17:26:28 +0000 (17:26 +0000)]
Add opt-viewer testing
Detects whether we have the Python modules (pygments, yaml) required by
opt-viewer and hooks this up to REQUIRES.
This fixes https://bugs.llvm.org/show_bug.cgi?id=34129 (the lack of opt-viewer
testing).
It's also related to https://github.com/apple/swift/pull/12938 and the idea is
to expose LLVM_HAVE_OPT_VIEWER_MODULES to the Swift cmake.
Differential Revision: https://reviews.llvm.org/D40202
llvm-svn: 319188
Francis Visoiu Mistrih [Tue, 28 Nov 2017 17:15:09 +0000 (17:15 +0000)]
[CodeGen] Print register names in lowercase in both MIR and debug output
As part of the unification of the debug format and the MIR format,
always print registers as lowercase.
* Only debug printing is affected. It now follows MIR.
Differential Revision: https://reviews.llvm.org/D40417
llvm-svn: 319187
Dan Gohman [Tue, 28 Nov 2017 17:15:03 +0000 (17:15 +0000)]
[WebAssembly] Support bitcasted function addresses with varargs.
Generalize FixFunctionBitcasts to handle varargs functions. This in
particular fixes the case where clang bitcasts away a varargs when
calling a K&R-style function.
This avoids interacting with tricky ABI details because it operates
at the LLVM IR level before varargs ABI details are exposed.
This fixes PR35385.
llvm-svn: 319186
Matt Arsenault [Tue, 28 Nov 2017 17:11:30 +0000 (17:11 +0000)]
DAG: Legalize truncstores to illegal int types
Truncate to a legal int type, and produce a new
truncstore from a narrower type.
llvm-svn: 319185
Simon Pilgrim [Tue, 28 Nov 2017 16:57:20 +0000 (16:57 +0000)]
[X86][X87] Tag FTST x87 instruction scheduler class
Looking through Agner, FTST is very similar to generic float compare behaviour, so I've added them to the existing IIC_FCOMI (WriteFAdd) tags.
llvm-svn: 319184
Alexander Kornienko [Tue, 28 Nov 2017 16:41:03 +0000 (16:41 +0000)]
[clang-tidy] Move more checks from misc- to performance-
Summary:
rename_check.py misc-move-const-arg performance-move-const-arg
rename_check.py misc-noexcept-move-constructor performance-noexcept-move-constructor
Reviewers: hokein, xazax.hun
Reviewed By: xazax.hun
Subscribers: rnkovacs, klimek, mgorny, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D40507
llvm-svn: 319183
Sanjay Patel [Tue, 28 Nov 2017 16:40:30 +0000 (16:40 +0000)]
[InstCombine] add tests from D39421 to show current transforms; NFC
llvm-svn: 319182
Bill Seurer [Tue, 28 Nov 2017 16:28:54 +0000 (16:28 +0000)]
[PowerPC][tsan] Update tsan to handle changed memory layouts in newer kernels
In more recent Linux kernels with 47 bit VMAs the layout of virtual memory
for powerpc64 changed causing the thread sanitizer to not work properly. This
patch adds support for 47 bit VMA kernels for powerpc64.
(second part)
Tested on several 4.x and 3.x kernel releases.
llvm-svn: 319180
Serge Pavlov [Tue, 28 Nov 2017 16:14:14 +0000 (16:14 +0000)]
Refactor functions PrintTemplateArgumentList
These functions were defined as static members of TemplateSpecializationType.
Now they are moved to namespace level. Previously there were different
implementations for lists containing TemplateArgument and TemplateArgumentLoc,
now these implementations share the same code.
This change is a result of refactoring patch D40508. NFC.
llvm-svn: 319178
Francis Visoiu Mistrih [Tue, 28 Nov 2017 16:11:56 +0000 (16:11 +0000)]
[Support] Add unit test for printLowerCase
Add test case for the function added in r319171.
llvm-svn: 319177
Don Hinton [Tue, 28 Nov 2017 16:08:57 +0000 (16:08 +0000)]
[cmake] Remove redundant call to cmake when building host tools.
Summary:
Remove the redundant, config-time call to cmake when
building host tools for cross compiles or optimized tablegen..
The config-time call to cmake is redundant because it will always get
called again when the CONFIGURE_LLVM_${target_name} target fires at
build-time. This speeds up initial configuration, but has no affect
on build behavior.
Reviewers: beanz
Reviewed By: beanz
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D40229
llvm-svn: 319176
Simon Pilgrim [Tue, 28 Nov 2017 15:03:42 +0000 (15:03 +0000)]
[X86][X87] Tag FABS/FCHS/FSQRT/FSIN/FCOS x87 instruction scheduler classes
Atom's FABS/FCHS/FSQRT latencies taken from Agner.
Note: I just added FSIN and FCOS to the existing IIC_FSINCOS itinerary, which is actually a more costly instruction.
llvm-svn: 319175
Malcolm Parsons [Tue, 28 Nov 2017 14:57:47 +0000 (14:57 +0000)]
[clang-tidy] Ignore ExprWithCleanups when looking for else-after-throw
Summary:
The readability-else-after-return check was not warning about
an else after a throw of an exception that had arguments that needed
to be cleaned up.
Reviewers: aaron.ballman, alexfh, djasper
Reviewed By: aaron.ballman
Subscribers: lebedev.ri, klimek, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D40505
llvm-svn: 319174
Jonas Paulsson [Tue, 28 Nov 2017 14:44:32 +0000 (14:44 +0000)]
Use getStoreSize() in various places instead of 'BitSize >> 3'.
This is needed for cases when the memory access is not as big as the width of
the data type. For instance, storing i1 (1 bit) would be done in a byte (8
bits).
Using 'BitSize >> 3' (or '/ 8') would e.g. give the memory access of an i1 a
size of 0, which for instance makes alias analysis return NoAlias even when
it shouldn't.
There are no tests as this was done as a follow-up to the bugfix for the case
where this was discovered (r318824). This handles more similar cases.
Review: Björn Petterson
https://reviews.llvm.org/D40339
llvm-svn: 319173
Simon Pilgrim [Tue, 28 Nov 2017 14:35:52 +0000 (14:35 +0000)]
[X86][X86] Add some x87 schedule tests
Still missing some instructions: mainly loads/stores/system ops, all flagged as TODO.
llvm-svn: 319172
Francis Visoiu Mistrih [Tue, 28 Nov 2017 14:22:27 +0000 (14:22 +0000)]
[Support] Merge toLower / toUpper implementations
Merge the ones from StringRef and StringExtras.
llvm-svn: 319171
Gabor Horvath [Tue, 28 Nov 2017 13:54:52 +0000 (13:54 +0000)]
[clang-tidy] Fix tests for ReplaceRandomShuffleCheck
Patch by: Daniel Kolozsvari!
Differential Revision: https://reviews.llvm.org/D40516
llvm-svn: 319170
Peter Smith [Tue, 28 Nov 2017 13:51:48 +0000 (13:51 +0000)]
[ELF] Read ARM BuildAttributes section to determine supported features.
lld assumes some ARM features that are not available in all Arm
processors. In particular:
- The blx instruction present for interworking.
- The movt/movw instructions are used in Thunks.
- The J1=1 J2=1 encoding of branch immediates to improve Thumb wide
branch range are assumed to be present.
This patch reads the ARM Attributes section to check for the
architecture the object file was compiled with. If none of the objects
have an architecture that supports either of these features a warning
will be given. This is most likely to affect armv6 as used in the first
Raspberry Pi.
Differential Revision: https://reviews.llvm.org/D36823
llvm-svn: 319169
Francis Visoiu Mistrih [Tue, 28 Nov 2017 12:42:37 +0000 (12:42 +0000)]
[CodeGen] Rename functions PrintReg* to printReg*
LLVM Coding Standards:
Function names should be verb phrases (as they represent actions), and
command-like function should be imperative. The name should be camel
case, and start with a lower case letter (e.g. openFile() or isFoo()).
Differential Revision: https://reviews.llvm.org/D40416
llvm-svn: 319168
Simon Pilgrim [Tue, 28 Nov 2017 12:37:35 +0000 (12:37 +0000)]
[X86][3DNow] Add instruction itinerary and scheduling classes for femms/prefetch/prefetchw
llvm-svn: 319167
Peter Smith [Tue, 28 Nov 2017 12:34:05 +0000 (12:34 +0000)]
[ARM][AArch64] Workaround ARM/AArch64 peculiarity in clearing icache.
Certain ARM implementations treat icache clear instruction as a memory read,
and CPU segfaults on trying to clear cache on !PROT_READ page.
We workaround this in Memory::protectMappedMemory by adding
PROT_READ to affected pages, clearing the cache, and then setting
desired protection.
This fixes "AllocationTests/MappedMemoryTest.***/3" unit-tests on
affected hardware.
Reviewers: psmith, zatrazz, kristof.beyls, lhames
Reviewed By: lhames
Subscribers: llvm-commits, krytarowski, peter.smith, jgreenhalgh, aemerson,
rengolin
Patch by maxim-kuvrykov!
Differential Revision: https://reviews.llvm.org/D40423
llvm-svn: 319166
Dean Michael Berris [Tue, 28 Nov 2017 11:49:22 +0000 (11:49 +0000)]
[XRay][compiler-rt][Darwin] Minimal XRay build support in Darwin
This change is the first in a series of changes to get the XRay runtime
building on macOS. This first allows us to build the minimal parts of
XRay to get us started on supporting macOS development. These include:
- CMake changes to allow targeting x86_64 initially.
- Allowing for building the initialisation routines without
`.preinit_array` support.
- Use __sanitizer::SleepForMillis() to work around the lack of
clock_nanosleep on macOS.
- Deprecate the xray_fdr_log_grace_period_us flag, and introduce
the xray_fdr_log_grace_period_ms flag instead, to use
milliseconds across platforms.
Reviewers: kubamracek
Subscribers: llvm-commits, krytarowski, nglevin, mgorny
Differential Review: https://reviews.llvm.org/D39114
llvm-svn: 319165
Chandler Carruth [Tue, 28 Nov 2017 11:32:31 +0000 (11:32 +0000)]
Add a new pass to speculate around PHI nodes with constant (integer) operands when profitable.
The core idea is to (re-)introduce some redundancies where their cost is
hidden by the cost of materializing immediates for constant operands of
PHI nodes. When the cost of the redundancies is covered by this,
avoiding materializing the immediate has numerous benefits:
1) Less register pressure
2) Potential for further folding / combining
3) Potential for more efficient instructions due to immediate operand
As a motivating example, consider the remarkably different cost on x86
of a SHL instruction with an immediate operand versus a register
operand.
This pattern turns up surprisingly frequently, but is somewhat rarely
obvious as a significant performance problem.
The pass is entirely target independent, but it does rely on the target
cost model in TTI to decide when to speculate things around the PHI
node. I've included x86-focused tests, but any target that sets up its
immediate cost model should benefit from this pass.
There is probably more that can be done in this space, but the pass
as-is is enough to get some important performance on our internal
benchmarks, and should be generally performance neutral, but help with
more extensive benchmarking is always welcome.
One awkward part is that this pass has to be scheduled after
*everything* that can eliminate these kinds of redundancies. This
includes SimplifyCFG, GVN, etc. I'm open to suggestions about better
places to put this. We could in theory make it part of the codegen pass
pipeline, but there doesn't really seem to be a good reason for that --
it isn't "lowering" in any sense and only relies on pretty standard cost
model based TTI queries, so it seems to fit well with the "optimization"
pipeline model. Still, further thoughts on the pipeline position are
welcome.
I've also only implemented this in the new pass manager. If folks are
very interested, I can try to add it to the old PM as well, but I didn't
really see much point (my use case is already switched over to the new
PM).
I've tested this pretty heavily without issue. A wide range of
benchmarks internally show no change outside the noise, and I don't see
any significant changes in SPEC either. However, the size class
computation in tcmalloc is substantially improved by this, which turns
into a 2% to 4% win on the hottest path through tcmalloc for us, so
there are definitely important cases where this is going to make
a substantial difference.
Differential revision: https://reviews.llvm.org/D37467
llvm-svn: 319164
Kamil Rytarowski [Tue, 28 Nov 2017 11:21:27 +0000 (11:21 +0000)]
Correct mangled_sp on NetBSD/amd64 in TSan
The proper index is 6, not 2.
Patch extracted from https://reviews.llvm.org/D40337
Reviewed and accepted by <dvyukov>.
Sponsored by <The NetBSD Foundation>
llvm-svn: 319163
Pavel Labath [Tue, 28 Nov 2017 11:10:23 +0000 (11:10 +0000)]
elf-core: Convert remaining register context to use register set maps
In https://reviews.llvm.org/D39681, we started using a map instead
passing a long list of register sets to the ppc64le register context.
However, existing register contexts were still using the old method.
This converts the remaining register contexts to use this approach.
While doing that, I've had to modify the approach a bit:
- the general purpose register set is still kept as a separate field,
because this one is always present, and it's parsing is somewhat
different than that of other register sets.
- since the same register sets have different IDs on different operating
systems, but we use the same register context class to represent
different register sets, I've needed to add a layer of indirection to
translate os-specific constants (e.g. NETBSD::NT_AMD64_FPREGS) into more
generic terms (e.g. floating point register set).
While slightly more complicated, this setup allows for better separation
of concerns. The parsing code in ProcessElfCore can focus on parsing
OS-specific core file notes, and can completely ignore
architecture-specific register sets (by just storing any unrecognised
notes in a map). These notes will then be passed on to the
architecture-specific register context, which can just deal with
architecture specifics, because the OS-specific note types are hidden in
a register set description map.
This way, adding an register set, which is already supported on other
OSes, to a new OS, should in most cases be as simple as adding a new
entry into the register set description map.
Differential Revision: https://reviews.llvm.org/D40133
llvm-svn: 319162
Pavel Labath [Tue, 28 Nov 2017 10:56:54 +0000 (10:56 +0000)]
Fix floating point register write on new x86 linux kernels
Summary:
New linux kernels (on systems that support the XSAVES instruction) will
not update the inferior registers unless the corresponding flag in the
XSAVE header is set. Normally this flag will be set in our image of the
XSAVE area (since we obtained it from the kernel), but if the inferior
has never used the corresponding register set, the respective flag can
be clear.
This fixes the issue by making sure we explicitly set the flags
corresponding to the registers we modify. I don't try to precisely match
the flags to set on each write, as the rules could get quite complicated
-- I use a simpler over-approximation instead.
This was already caught by test_fp_register_write, but that was only
because the code that ran before main() did not use some of the register
sets. Since nothing in this test relies on being stopped in main(), I
modify the test to stop at the entry point instead, so we can be sure
the inferior did not have a chance to access these registers.
Reviewers: clayborg, valentinagiusti
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D40434
llvm-svn: 319161
Kamil Rytarowski [Tue, 28 Nov 2017 10:54:58 +0000 (10:54 +0000)]
Handle symbol renaming of sigaction for NetBSD
Summary:
NetBSD uses the __sigaction14 symbol name for historical and compat
reasons for the sigaction(2) function name.
Rename the interceptors and users of sigaction to sigaction_symname
and reuse it in the code base.
This change fixes 4 failing tests in TSan/NetBSD:
- ThreadSanitizer-x86_64 :: signal_errno.cc
- ThreadSanitizer-x86_64 :: signal_malloc.cc
- ThreadSanitizer-x86_64 :: signal_sync2.cc
- ThreadSanitizer-x86_64 :: signal_thread.cc
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, vitalybuka, eugenis, dvyukov, kcc
Reviewed By: dvyukov
Subscribers: kubamracek, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D40341
llvm-svn: 319160
Sam McCall [Tue, 28 Nov 2017 09:37:43 +0000 (09:37 +0000)]
[clangd] Switch from YAMLParser to JSONExpr
Summary:
- Converted Protocol.h parse() functions to take JSON::Expr.
These no longer detect and log unknown fields, as this is not that
useful and no longer free.
I haven't changed the error handling too much: fields that were
treated as optional before are still optional, even when it's wrong.
Exception: object properties with the wrong type are now ignored.
- Made JSONRPCDispatcher parse using json::parse
- The bug where 'method' must come before 'params' in the stream is
fixed as a side-effect. (And the same bug in executeCommand).
- Some parser crashers fixed as a side effect.
e.g. https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3890
- The debug stream now prettyprints the input messages with --pretty.
- Request params are attached to traces when tracing is enabled.
- Fixed some bugs in tests (errors tolerated by YAMLParser, and
off-by-ones in Content-Length that our null-termination was masking)
- Fixed a random double-escape bug in ClangdLSPServer (it was our last
use of YAMLParser!)
Reviewers: ilya-biryukov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D40406
llvm-svn: 319159
Florian Hahn [Tue, 28 Nov 2017 09:32:25 +0000 (09:32 +0000)]
[TailRecursionElimination] Skip debug intrinsics.
Summary:
I think we do not need to analyze debug intrinsics here, as they should
not impact codegen. This has 2 benefits: 1) slightly less work to do and
2) avoiding generating optimization remarks for converting calls to
debug intrinsics to tail calls, which are not really helpful for users.
Based on work by Sander de Smalen.
Reviewers: davide, trentxintong, aprantl
Reviewed By: aprantl
Subscribers: llvm-commits, JDevlieghere
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D40440
llvm-svn: 319158
Sam McCall [Tue, 28 Nov 2017 09:25:09 +0000 (09:25 +0000)]
[clangd] Add missing (but documented!) JSONExpr typed accessors
Summary:
Noticed this when I tried to port the Protocol.h parsers.
And tests for the inspect API, which caught a small bug.
Reviewers: ioeric
Subscribers: ilya-biryukov
Differential Revision: https://reviews.llvm.org/D40399
llvm-svn: 319157
Nicolai Haehnle [Tue, 28 Nov 2017 08:42:46 +0000 (08:42 +0000)]
AMDGPU: Re-organize the outer loop of SILoadStoreOptimizer
Summary:
The entire algorithm operates per basic-block, so for cache locality
it should be better to re-optimize a basic-block immediately rather than
in a separate loop.
I don't have performance measurements.
Change-Id: I85106570bd623c4ff277faaa50ee43258e1ddcc5
Reviewers: arsenm, rampitec
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye
Differential Revision: https://reviews.llvm.org/D40344
llvm-svn: 319156
Nicolai Haehnle [Tue, 28 Nov 2017 08:41:50 +0000 (08:41 +0000)]
AMDGPU: Consistently check for immediates in SIInstrInfo::FoldImmediate
Summary:
The PeepholeOptimizer pass calls this function solely based on checking
DefMI->isMoveImmediate(), which only checks the MoveImm bit of the
instruction description. So it's up to FoldImmediate itself to properly
check that DefMI *actually* moves from an immediate.
I don't have a separate test case for this, but the next patch introduces
a test case which happens to crash without this change.
This error is caught by the assertion in MachineOperand::getImm().
Change-Id: I88e7cdbcf54d75e1a296822e6fe5f9a5f095bbf8
Reviewers: arsenm, rampitec
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D40342
llvm-svn: 319155
Igor Kudrin [Tue, 28 Nov 2017 08:39:40 +0000 (08:39 +0000)]
Revert r319008, "[ELF] Do not keep symbols if they referenced only from discarded sections."
and r319051, "Add a missing test."
r319008 broke the LTO bots;
r319051 depends on changes in r319008.
llvm-svn: 319154
Max Kazantsev [Tue, 28 Nov 2017 08:26:43 +0000 (08:26 +0000)]
[SCEV][NFC] More efficient caching in CompareValueComplexity
Currently, we use a set of pairs to cache responces like `CompareValueComplexity(X, Y) == 0`. If we had
proved that `CompareValueComplexity(S1, S2) == 0` and `CompareValueComplexity(S2, S3) == 0`,
this cache does not allow us to prove that `CompareValueComplexity(S1, S3)` is also `0`.
This patch replaces this set with `EquivalenceClasses` that merges Values into equivalence sets so that
any two values from the same set are equal from point of `CompareValueComplexity`. This, in particular,
allows us to prove the fact from example above.
Differential Revision: https://reviews.llvm.org/D40429
llvm-svn: 319153
Martin Storsjo [Tue, 28 Nov 2017 08:12:03 +0000 (08:12 +0000)]
Fix shared library builds of lld, broken in SVN r319138
llvm-svn: 319152
Martin Storsjo [Tue, 28 Nov 2017 08:08:37 +0000 (08:08 +0000)]
[COFF] Interpret a period as a separator for section suffix just like '$'
This allows grouping all sections like ".ctors.12345" into ".ctors".
For MinGW, the numerical values for such ctors are all zero-padded,
so a lexical sort is good enough.
Differential Revision: https://reviews.llvm.org/D40408
llvm-svn: 319151
Martin Storsjo [Tue, 28 Nov 2017 08:07:18 +0000 (08:07 +0000)]
[COFF] Implement constructor priorities
The priorities in the section name suffixes are zero padded,
allowing the linker to just do a lexical sort.
Add zero padding for .ctors sections in ELF as well.
Differential Revision: https://reviews.llvm.org/D40407
llvm-svn: 319150
Max Kazantsev [Tue, 28 Nov 2017 07:48:12 +0000 (07:48 +0000)]
[SCEV][NFC] More efficient caching in CompareSCEVComplexity
Currently, we use a set of pairs to cache responces like `CompareSCEVComplexity(X, Y) == 0`. If we had
proved that `CompareSCEVComplexity(S1, S2) == 0` and `CompareSCEVComplexity(S2, S3) == 0`,
this cache does not allow us to prove that `CompareSCEVComplexity(S1, S3)` is also `0`.
This patch replaces this set with `EquivalenceClasses` any two values from the same set are equal from
point of `CompareSCEVComplexity`. This, in particular, allows us to prove the fact from example above.
Differential Revision: https://reviews.llvm.org/D40428
llvm-svn: 319149
Kevin Funk [Tue, 28 Nov 2017 07:17:01 +0000 (07:17 +0000)]
run-clang-tidy: Use check_call instead of check_output
Summary:
Streamlines the output under Python 3.x.
Before:
```
b'Enabled checks:\n clang-analyzer-apiModeling.google.GTest\n ...
```
After:
```
Enabled checks:
clang-analyzer-apiModeling.google.GTest
...
```
Reviewers: cfe-commits, alexfh
Reviewed By: alexfh
Subscribers: JDevlieghere
Differential Revision: https://reviews.llvm.org/D37482
Change-Id: I6287104bc73926ae6d0f66c15c250c3cb44bee33
llvm-svn: 319148
Max Kazantsev [Tue, 28 Nov 2017 07:07:55 +0000 (07:07 +0000)]
[GVN] Prevent ScalarPRE from hoisting across instructions that don't pass control flow to successors
This is to address a problem similar to those in D37460 for Scalar PRE. We should not
PRE across an instruction that may not pass execution to its successor unless it is safe
to speculatively execute it.
Differential Revision: https://reviews.llvm.org/D38619
llvm-svn: 319147
Adam Nemet [Tue, 28 Nov 2017 06:22:29 +0000 (06:22 +0000)]
Revert "Add opt-viewer testing"
This reverts commit r319073.
Bot fails with a mismatch that looks like pygments-generated HTML.
llvm-svn: 319146
Martin Storsjo [Tue, 28 Nov 2017 05:47:24 +0000 (05:47 +0000)]
[test] Fix a typo in a test comment. NFC.
llvm-svn: 319145
Dan Gohman [Tue, 28 Nov 2017 05:36:42 +0000 (05:36 +0000)]
[WebAssembly] Handle errors better in fast-isel.
Fast-isel routines need to bail out in the case that fast-isel
fails on the operands.
This fixes https://bugs.llvm.org/show_bug.cgi?id=35064
llvm-svn: 319144
Craig Topper [Tue, 28 Nov 2017 05:23:57 +0000 (05:23 +0000)]
[X86] Remove some unused pattern fragments from td file. NFC
llvm-svn: 319143
Simon Dardis [Tue, 28 Nov 2017 04:07:59 +0000 (04:07 +0000)]
[DAGCombine] Disable finding better chains for stores at O0
Unoptimized IR can have linear sequences of stores to an array, where the
initial GEP for the first store is formed from the pointer to the array, and the
GEP for each store after the first is formed from the previous GEP with some
offset in an inductive fashion.
The (large) resulting DAG when analyzed by DAGCombine undergoes an excessive
number of combines as each store node is examined every time its' offset node
is combined with any child of the offset. One of the transformations is
findBetterNeighborChains which assists MergeConsecutiveStores. The former
relies on repeated chain walking to do its' work, however MergeConsecutiveStores
is disabled at O0 which makes the transformation redundant.
Any optimization level other than O0 would invoke InstCombine which would
resolve the chain of GEPs into flat base + offset GEP for each store which
does not exhibit the repeated examination of each store to the array.
Disabling this optimization fixes an excessive compile time issue (30~ minutes
for the test case provided) at O0.
Reviewers: niravd, craig.topper, t.p.northover
Differential Revision: https://reviews.llvm.org/D40193
llvm-svn: 319142