platform/upstream/llvm.git
7 years agoInline trivial symbol constructors.
Rui Ueyama [Fri, 27 Oct 2017 23:26:46 +0000 (23:26 +0000)]
Inline trivial symbol constructors.

llvm-svn: 316811

7 years agoARM: centralise SizeType, PtrDiffType, and IntPtrType
Saleem Abdulrasool [Fri, 27 Oct 2017 23:04:27 +0000 (23:04 +0000)]
ARM: centralise SizeType, PtrDiffType, and IntPtrType

Centralise the definitions of these compiler vended types to aid
inspection to ensure that they are defined similarly.  The one case that
stands out is the Darwin case where the types do not match up.  This
fixes the API conformance for APCS-GNU as well.

llvm-svn: 316810

7 years agoRename isInCurrentDSO -> isInCurrentOutput.
Rui Ueyama [Fri, 27 Oct 2017 22:54:16 +0000 (22:54 +0000)]
Rename isInCurrentDSO -> isInCurrentOutput.

DSO is short for dynamic shared object, so the function name was a
little confusing because it sounded like it didn't work when we were
a creating statically-linked executable or something.

What we mean by "DSO" here is the current output file that we are
creating. Thus the new name. Alternatively, we could call it the current
ELF module, but "module" is a overloaded word, so I avoided that.

llvm-svn: 316809

7 years ago[Analyzer] [Tests] Fixing typo from the previous commit.
George Karpenkov [Fri, 27 Oct 2017 22:52:36 +0000 (22:52 +0000)]
[Analyzer] [Tests] Fixing typo from the previous commit.

Can not open a non-existent file with r+.

llvm-svn: 316808

7 years ago[MS] Allow access to ambiguous, inaccessible direct bases
Reid Kleckner [Fri, 27 Oct 2017 22:48:41 +0000 (22:48 +0000)]
[MS] Allow access to ambiguous, inaccessible direct bases

Summary:
Clang typically warns that in the following class hierarchy, 'A' is
inaccessible because there is no series of casts that the user can
write to access it unambiguously:
  struct A { };
  struct B : A { };
  struct C : A, B { };

MSVC allows the user to convert from C* to A*, though, and we've
encountered this issue in the latest Windows SDK headers.

This patch allows this conversion when -fms-compatibility is set and
adds a warning for it under -Wmicrosoft-inaccessible-base.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 316807

7 years ago[Analyzer] [Tests] Dump the output of scan-build to stdout on failure.
George Karpenkov [Fri, 27 Oct 2017 22:39:54 +0000 (22:39 +0000)]
[Analyzer] [Tests] Dump the output of scan-build to stdout on failure.

Eliminates extra lookup step during debugging.

llvm-svn: 316806

7 years agoAdd support for writing 64-bit symbol tables for archives when offsets become too...
Jake Ehrlich [Fri, 27 Oct 2017 22:26:37 +0000 (22:26 +0000)]
Add support for writing 64-bit symbol tables for archives when offsets become too large for 32-bit

This should fix https://bugs.llvm.org//show_bug.cgi?id=34189

This change makes it so that if writing a K_GNU style archive, you need
to output a > 32-bit offset it should output in K_GNU64 style instead.

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

llvm-svn: 316805

7 years ago[Hexagon] Adjust patterns to reflect instruction selection preferences
Krzysztof Parzyszek [Fri, 27 Oct 2017 22:24:49 +0000 (22:24 +0000)]
[Hexagon] Adjust patterns to reflect instruction selection preferences

llvm-svn: 316804

7 years agoAdd a few missing headers for modularization/IWYU/etc
David Blaikie [Fri, 27 Oct 2017 22:12:46 +0000 (22:12 +0000)]
Add a few missing headers for modularization/IWYU/etc

Several cases where class definitions are required for DenseMap pointer
traits handling.

llvm-svn: 316803

7 years ago[DAGCombine] Don't combine sext with extload if sextload is not supported and extload...
Guozhi Wei [Fri, 27 Oct 2017 21:54:24 +0000 (21:54 +0000)]
[DAGCombine] Don't combine sext with extload if sextload is not supported and extload has multi users

In function DAGCombiner::visitSIGN_EXTEND_INREG, sext can be combined with extload even if sextload is not supported by target, then

  if sext is the only user of extload, there is no big difference, no harm no benefit.
  if extload has more than one user, the combined sextload may block extload from combining with other zext, causes extra zext instructions generated. As demonstrated by the attached test case.

This patch add the constraint that when sextload is not supported by target, sext can only be combined with extload if it is the only user of extload.

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

llvm-svn: 316802

7 years agoMake 32-bit member offset in Archive::Symbol::getMember 64-bit
Jake Ehrlich [Fri, 27 Oct 2017 21:47:38 +0000 (21:47 +0000)]
Make 32-bit member offset in Archive::Symbol::getMember 64-bit

When accessing a member for a symbol with an offset greater than 2^32 -
1 the current Archive::Symbol::getMember implementation will overflow
and cause unexpected behavior. This change simply fixes that. In
particular if you call "llvm-nm --print-armap" on an archive that has
this behavior you'll get an error.

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

llvm-svn: 316801

7 years ago[CMake] Build clang as dependency when using in-tree clang for tests.
Davide Italiano [Fri, 27 Oct 2017 21:22:57 +0000 (21:22 +0000)]
[CMake] Build clang as dependency when using in-tree clang for tests.

Discussed with Zachary Turner and Pavel Labath on lldb-dev.
Let's hope this doesn't break anything :)

llvm-svn: 316800

7 years agoHandle undefined weak hidden symbols on all architectures.
Rafael Espindola [Fri, 27 Oct 2017 21:18:48 +0000 (21:18 +0000)]
Handle undefined weak hidden symbols on all architectures.

We were handling the non-hidden case in lib/Target/TargetMachine.cpp,
but the hidden case was handled in architecture dependent code and
only X86_64 and AArch64 were covered.

While it is true that some code sequences in some ABIs might be able
to produce the correct value at runtime, that doesn't seem to be the
common case.

I left the AArch64 code in place since it also forces a got access for
non-pic code. It is not clear if that is needed, but it is probably
better to change that in another commit.

llvm-svn: 316799

7 years agoForce #define GTEST_LANG_CXX11.
Zachary Turner [Fri, 27 Oct 2017 21:12:28 +0000 (21:12 +0000)]
Force #define GTEST_LANG_CXX11.

gtest depends on this #define to determine whether it can
use various classes like std::tuple, or whether it has to fall
back to experimental classes in the std::tr1 namespace.  The
check in the current version of gtest relies on the value of
the `__cplusplus` macro, but MSVC provides a non-conformant
value of this macro, making it effectively impossible to detect
C++11.  In short, LLVM compiled with MSVC has been silently
using the tr1 versions of several classes since the beginning of
time.

This would normally be pretty benign, except that in the latest
preview of MSVC they have marked all of the tr1 classes
deprecated, so it spews thousands of warnings.

llvm-svn: 316798

7 years ago[X86] Remove fast-isel code for handling i8 shifts. This is handled by auto generated...
Craig Topper [Fri, 27 Oct 2017 21:00:59 +0000 (21:00 +0000)]
[X86] Remove fast-isel code for handling i8 shifts. This is handled by auto generated code.

llvm-svn: 316797

7 years ago[X86] Add fast-isel tests for integer shifts. We definitely had no coverage of i16...
Craig Topper [Fri, 27 Oct 2017 21:00:56 +0000 (21:00 +0000)]
[X86] Add fast-isel tests for integer shifts. We definitely had no coverage of i16 and i32/i64 are only tested by larger tests.

llvm-svn: 316796

7 years agoImprove clamp recognition in ValueTracking.
Artur Gainullin [Fri, 27 Oct 2017 20:53:41 +0000 (20:53 +0000)]
Improve clamp recognition in ValueTracking.

Summary:
ValueTracking was recognizing not all variations of clamp. Swapping of
true value and false value of select was added to fix this problem. The
first patch was reverted because it caused miscompile in NVPTX target.
Added corresponding test cases.

Reviewers: spatel, majnemer, efriedma, reames

Subscribers: llvm-commits, jholewinski

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

llvm-svn: 316795

7 years agoStaticAnalyzer: Modularize/fix ODR violations making functions inline but non-static...
David Blaikie [Fri, 27 Oct 2017 20:40:46 +0000 (20:40 +0000)]
StaticAnalyzer: Modularize/fix ODR violations making functions inline but non-static in headers

Also move these out of the llvm namespace & rely on ADL as is
appropriate for these op<< overloads.

llvm-svn: 316794

7 years agoSanitizers.h: Modularize/Fix ODR violations by making inline functions non-static
David Blaikie [Fri, 27 Oct 2017 20:40:45 +0000 (20:40 +0000)]
Sanitizers.h: Modularize/Fix ODR violations by making inline functions non-static

llvm-svn: 316793

7 years agoCharInfo.h: Modularize/fix ODR violations by making inline functions in header not...
David Blaikie [Fri, 27 Oct 2017 20:40:45 +0000 (20:40 +0000)]
CharInfo.h: Modularize/fix ODR violations by making inline functions in header not static

llvm-svn: 316792

7 years agoASTContext.h: Modularize/fix ODR violations by removing 'static' from inline function...
David Blaikie [Fri, 27 Oct 2017 20:40:44 +0000 (20:40 +0000)]
ASTContext.h: Modularize/fix ODR violations by removing 'static' from inline functions in headers

llvm-svn: 316791

7 years ago[X86] Teach fastisel to use VLX VMOVNTDQA for v4f64 and 256-bit integers when available.
Craig Topper [Fri, 27 Oct 2017 20:13:10 +0000 (20:13 +0000)]
[X86] Teach fastisel to use VLX VMOVNTDQA for v4f64 and 256-bit integers when available.

This looks to have been missed from r280682.

llvm-svn: 316790

7 years ago[X86] Add avx512vl command line to fast-isel-nontemporal.ll
Craig Topper [Fri, 27 Oct 2017 20:13:06 +0000 (20:13 +0000)]
[X86] Add avx512vl command line to fast-isel-nontemporal.ll

llvm-svn: 316789

7 years ago[scudo] Allow to specify the maximum number of TSDs at compile time
Kostya Kortchinsky [Fri, 27 Oct 2017 20:10:14 +0000 (20:10 +0000)]
[scudo] Allow to specify the maximum number of TSDs at compile time

Summary:
This introduces `SCUDO_MAX_CACHES` allowing to define an upper bound to the
number of `ScudoTSD` created in the Shared TSD model (by default 32U).
This name felt clearer than `SCUDO_MAX_TSDS` which is technically what it really
is. I am opened to suggestions if that doesn't feel right.

Additionally change `getNumberOfCPUs` to return a `u32` to be more consistent.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 316788

7 years agoRemove trailing whitespace.
Rui Ueyama [Fri, 27 Oct 2017 19:23:12 +0000 (19:23 +0000)]
Remove trailing whitespace.

llvm-svn: 316787

7 years agoFix llvm-special-case-list-fuzzer regexp exception
Vlad Tsyrklevich [Fri, 27 Oct 2017 19:15:13 +0000 (19:15 +0000)]
Fix llvm-special-case-list-fuzzer regexp exception

Summary:
Original oss-fuzz report:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3727#c2

The minimized test case that causes this failure:
5b 5b 5b 3d 47 53 00 5b  3d 5d 5b 5d 0a     [[[=GS.[=][].

Note the string "=GS\x00". The failure happens because the code is
searching the string against an array of known collated names. "GS\x00"
is a hit, but since len takes into account an extra NUL byte, indexing
into cp->name[len] goes one byte past it's allocated memory. Fix this to
use a strlen(cp->name) comparison to account for NUL bytes in the input.

Reviewers: pcc

Reviewed By: pcc

Subscribers: hctim, kcc

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

llvm-svn: 316786

7 years ago[Hexagon] Fix an incorrect assertion in HexagonConstExtenders.cpp
Krzysztof Parzyszek [Fri, 27 Oct 2017 18:52:28 +0000 (18:52 +0000)]
[Hexagon] Fix an incorrect assertion in HexagonConstExtenders.cpp

Making sure that an instruction has fewer operands than required, then
attempting to access one out of range is going to fail.

llvm-svn: 316785

7 years agoReplace a few usages of llvm::join with range-version[NFC]
Erich Keane [Fri, 27 Oct 2017 18:45:06 +0000 (18:45 +0000)]
Replace a few usages of llvm::join with range-version[NFC]

I noticed a few usages of llvm::join that were using
begin/end rather than just the range version.  This patch
just replaces those.

llvm-svn: 316784

7 years agoFilter out invalid 'target' items from being passed to LLVM
Erich Keane [Fri, 27 Oct 2017 18:32:23 +0000 (18:32 +0000)]
Filter out invalid 'target' items from being passed to LLVM

Craig noticed that CodeGen wasn't properly ignoring the
values sent to the target attribute. This patch ignores
them.

This patch also sets the 'default' for this checking to
'supported', since only X86 has implemented the support
for checking valid CPU names and Feature Names.

One test was changed to i686, since it uses a lakemont,
which would otherwise be prohibited in x86_64.

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

llvm-svn: 316783

7 years agoHandle all symbol types in --trace.
Rafael Espindola [Fri, 27 Oct 2017 18:30:11 +0000 (18:30 +0000)]
Handle all symbol types in --trace.

One case I was not sure was lazy symbols. bfd skips them completely,
but that is probably an artifact of how they implement archives.

llvm-svn: 316782

7 years agoRemove x86,x86_32/64 from isValidFeatureName
Erich Keane [Fri, 27 Oct 2017 18:29:02 +0000 (18:29 +0000)]
Remove x86,x86_32/64 from isValidFeatureName

These are not valid values for this, and are pretty
non-sensical, since LLVM doesn't understand them.

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

llvm-svn: 316781

7 years ago[refactor] Describe refactorings in the operation classes
Alex Lorenz [Fri, 27 Oct 2017 18:19:11 +0000 (18:19 +0000)]
[refactor] Describe refactorings in the operation classes

This commit changes the way that the refactoring operation classes are
structured:
- Users have to call `initiate` instead of constructing an instance of the
  class. The `initiate` is now supposed to have custom initiation logic, and
  you don't need to subclass the builtin requirements.
- A new `describe` function returns a structure with the id, title and the
  description of the refactoring operation.

The refactoring action classes are now placed into one common place in
RefactoringActions.cpp instead of being separate.

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

llvm-svn: 316780

7 years ago[X86][SSE] Add tests for inserting all-bits (-1) into a vector
Simon Pilgrim [Fri, 27 Oct 2017 18:14:12 +0000 (18:14 +0000)]
[X86][SSE] Add tests for inserting all-bits (-1) into a vector

We should be able to do this by re-materializing an all-bits vector and then blending with it

llvm-svn: 316779

7 years ago[Sema] Fix an assert-on-invalid by avoiding function template specialisation
Alex Lorenz [Fri, 27 Oct 2017 18:13:31 +0000 (18:13 +0000)]
[Sema] Fix an assert-on-invalid by avoiding function template specialisation
deduction for invalid functions

The fabricated template parameters cause an assertion because their depth
is invalid.

rdar://34109988

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

llvm-svn: 316778

7 years ago[WebAssembly] Add crt1.o with calling lld
Sam Clegg [Fri, 27 Oct 2017 18:10:19 +0000 (18:10 +0000)]
[WebAssembly] Add crt1.o with calling lld

Also, for OS unknown targets like wasm, don't include
'unknown' in the library path. This is a fix for rL316719.

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

llvm-svn: 316777

7 years agoInstead of enclosing an entire file, add lld:: specifier for public functions.
Rui Ueyama [Fri, 27 Oct 2017 18:04:49 +0000 (18:04 +0000)]
Instead of enclosing an entire file, add lld:: specifier for public functions.

llvm-svn: 316776

7 years agoELF: Add support for emitting dynamic relocations in the Android relocation packing...
Peter Collingbourne [Fri, 27 Oct 2017 17:49:40 +0000 (17:49 +0000)]
ELF: Add support for emitting dynamic relocations in the Android relocation packing format.

The Android relocation packing format is a more compact
format for dynamic relocations in executables and DSOs
that is based on delta encoding and SLEBs. An overview
of the format can be found in the Android source code:
https://android.googlesource.com/platform/bionic/+/refs/heads/master/tools/relocation_packer/src/delta_encoder.h

This patch implements relocation packing using that format.

This implementation uses a more intelligent algorithm for compressing
relative relocations than Android's own relocation packer. As a
result it can generally create smaller relocation sections than
that packer. If I link Chromium for Android targeting ARM32 I get a
.rel.dyn of size 174693 bytes, as compared to 371832 bytes with gold
and the Android packer.

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

llvm-svn: 316775

7 years ago[clangd] Don't crash on extremely large JSON messages.
Benjamin Kramer [Fri, 27 Oct 2017 17:06:41 +0000 (17:06 +0000)]
[clangd] Don't crash on extremely large JSON messages.

Found by clangd-fuzzer.

llvm-svn: 316774

7 years agoNew lldb python module for managing diagnostic breakpoints
Don Hinton [Fri, 27 Oct 2017 17:02:33 +0000 (17:02 +0000)]
New lldb python module for managing diagnostic breakpoints

Summary:
Can be used to set breakpoints for either the diagnostics actually
emitted for the current compilation, a particular DiagID, or all
DiagIDs for a particular warning.

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

llvm-svn: 316773

7 years agoAdd specific ppc64le hardware watchpoint handler
Pavel Labath [Fri, 27 Oct 2017 17:02:32 +0000 (17:02 +0000)]
Add specific ppc64le hardware watchpoint handler

Summary: Add hardware watchpoint funcionality for ppc64le

Reviewers: clayborg, zturner

Reviewed By: clayborg

Subscribers: eugene, clayborg, zturner, lbianc, gut, nemanjai, alexandreyy, kbarton, lldb-commits

Differential Revision: https://reviews.llvm.org/D38897
Patch by Ana Julia Caetano <ana.caetano@eldorado.org.br>

llvm-svn: 316772

7 years ago[X86][F16C] Fix btver2 AGU pipe scheduling
Simon Pilgrim [Fri, 27 Oct 2017 16:34:58 +0000 (16:34 +0000)]
[X86][F16C] Fix btver2 AGU pipe scheduling

Use the store AGU for stores, and the load AGU needs to be the first pipe for loads

llvm-svn: 316771

7 years ago[clangd] Harden clangd a bit against garbage input.
Benjamin Kramer [Fri, 27 Oct 2017 16:33:15 +0000 (16:33 +0000)]
[clangd] Harden clangd a bit against garbage input.

There can be nullptrs here if the YAML fails to parse. Found by
clangd-fuzzer!

llvm-svn: 316770

7 years ago[ForwardOpTree] Use space indention. NFC.
Michael Kruse [Fri, 27 Oct 2017 14:48:34 +0000 (14:48 +0000)]
[ForwardOpTree] Use space indention. NFC.

llvm-svn: 316769

7 years ago[LoopPredication] Handle the case when the guard and the latch IV have different...
Artur Pilipenko [Fri, 27 Oct 2017 14:46:17 +0000 (14:46 +0000)]
[LoopPredication] Handle the case when the guard and the latch IV have different offsets

This is a follow up change for D37569.

Currently the transformation is limited to the case when:
 * The loop has a single latch with the condition of the form: ++i <pred> latchLimit, where <pred> is u<, u<=, s<, or s<=.
 * The step of the IV used in the latch condition is 1.
 * The IV of the latch condition is the same as the post increment IV of the guard condition.
 * The guard condition is of the form i u< guardLimit.

This patch enables the transform in the case when the latch is

 latchStart + i <pred> latchLimit, where <pred> is u<, u<=, s<, or s<=.

And the guard is

 guardStart + i u< guardLimit

Reviewed By: anna

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

llvm-svn: 316768

7 years ago[clang-tidy] Fix bug 34845, offending standard bitmask types
Jonas Toth [Fri, 27 Oct 2017 14:44:08 +0000 (14:44 +0000)]
[clang-tidy] Fix bug 34845, offending standard bitmask types

Summary:
The C++ standard allows implementations to choose the underlying type for
bitmask types (e.g. std::ios_base::openmode). MSVC implemented some of them
as signed integers resulting in warnings for usual code like
`auto dd = std::ios_base::badbit | std::ios_base::failbit;`

These false positives were reported in https://bugs.llvm.org/show_bug.cgi?id=34845

The fix allows bitwise |,&,^ for known standard bitmask types under the condition
that both operands are such bitmask types.
Shifting and bitwise complement are still forbidden.

Reviewers: aaron.ballman, alexfh, hokein

Reviewed By: aaron.ballman

Subscribers: xazax.hun

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

llvm-svn: 316767

7 years ago[ForwardOpTree] Reload know values.
Michael Kruse [Fri, 27 Oct 2017 14:26:14 +0000 (14:26 +0000)]
[ForwardOpTree] Reload know values.

For scalar accesses, change the access target to an array element that
is known to contain the same value.

This may become an alternative to forwardKnownLoad which creates new
loads (and therefore closer to forwarding speculatives). Reloading does
not require the known value originating from a load, but can be a store
as well.

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

llvm-svn: 316766

7 years ago[CodeGen] Fix -Wunused-private-field warning on lld-x86_64-darwin13.
Clement Courbet [Fri, 27 Oct 2017 13:34:41 +0000 (13:34 +0000)]
[CodeGen] Fix -Wunused-private-field warning on lld-x86_64-darwin13.

llvm-svn: 316765

7 years ago[CrossTU] Fix handling of Cross Translation Unit directory path
Gabor Horvath [Fri, 27 Oct 2017 12:53:37 +0000 (12:53 +0000)]
[CrossTU] Fix handling of Cross Translation Unit directory path

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

llvm-svn: 316764

7 years ago[CodeGen][ExpandMemCmp][NFC] Simplify load sequence generation.
Clement Courbet [Fri, 27 Oct 2017 12:34:18 +0000 (12:34 +0000)]
[CodeGen][ExpandMemCmp][NFC] Simplify load sequence generation.

llvm-svn: 316763

7 years ago[LLVM-C] Publicly expose getters of MetadataType, TokenType
whitequark [Fri, 27 Oct 2017 11:51:40 +0000 (11:51 +0000)]
[LLVM-C] Publicly expose getters of MetadataType, TokenType

Patch by Robert Widmann.

Expose getters for MetadataType and TokenType publicly in the C API.
Discovered a need for these while trying to wrap the intrinsics API.

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

llvm-svn: 316762

7 years ago[ELF] - Ignore non-absolute R_386_GOTPC relocation in debug sections.
George Rimar [Fri, 27 Oct 2017 11:49:24 +0000 (11:49 +0000)]
[ELF] - Ignore non-absolute R_386_GOTPC relocation in debug sections.

This is for PR34852.

GCC 8.0 or earlier have a bug that it emits R_386_GOTPC relocations
against _GLOBAL_OFFSET_TABLE for .debug_info. The bug seems to have
been fixed in 2017: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82630,
but we do not want LLD to report errors for such inputs.
In this patch we ignore such relocations.

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

llvm-svn: 316761

7 years ago[ELF] - Stop naming relocation sections with first input section name.
George Rimar [Fri, 27 Oct 2017 11:38:31 +0000 (11:38 +0000)]
[ELF] - Stop naming relocation sections with first input section name.

It was reported (https://reviews.llvm.org/D38724#902841) that when we use
-ffunction-sections --emit-relocs build, REL[A] output section receives the name of first
input section, like .rela.text.first_function_in_text rather than .rela.text.

It is probably not really an issue as sh_info still points to correct target section, but
it does not look clean in output and allows internal section name to leak there,
what at least looks confusing and is not consistent with ld.bfd.

Patch changes this behavior so that target output section name is used as a base.

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

llvm-svn: 316760

7 years ago[ELF] - Simplify reporting of garbage collected sections.
George Rimar [Fri, 27 Oct 2017 11:32:22 +0000 (11:32 +0000)]
[ELF] - Simplify reporting of garbage collected sections.

This moves reporting of garbage collected sections right after
we do GC. That simplifies things.

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

llvm-svn: 316759

7 years agoTest commit
Ivan Donchevskii [Fri, 27 Oct 2017 11:05:40 +0000 (11:05 +0000)]
Test commit

llvm-svn: 316758

7 years agoFix BB after r316756 "[llvm-dwarfdump] - Teach verifier to report broken DWARF expres...
George Rimar [Fri, 27 Oct 2017 10:58:04 +0000 (10:58 +0000)]
Fix BB after r316756 "[llvm-dwarfdump] - Teach verifier to report broken DWARF expressions."

Bot:
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/6255

Changed format of this message by mistake.

llvm-svn: 316757

7 years ago[llvm-dwarfdump] - Teach verifier to report broken DWARF expressions.
George Rimar [Fri, 27 Oct 2017 10:42:04 +0000 (10:42 +0000)]
[llvm-dwarfdump] - Teach verifier to report broken DWARF expressions.

Patch improves next things:

* Fixes assert/crash in getOpDesc when giving it a invalid expression op code.
* DWARFExpression::print() called DWARFExpression::Operation::getEndOffset() which
  returned and used uninitialized field EndOffset. Patch fixes that.
* Teaches verifier to verify DW_AT_location and error out on broken expressions.

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

llvm-svn: 316756

7 years ago[ELF][ARM] Add missing REQUIRES: arm to tests
Peter Smith [Fri, 27 Oct 2017 09:16:46 +0000 (09:16 +0000)]
[ELF][ARM] Add missing REQUIRES: arm to tests

My apologies I missed REQUIRES: arm from a couple of Arm specific tests.

llvm-svn: 316755

7 years ago[ELF] Add support for multiple passes to createThunks()
Peter Smith [Fri, 27 Oct 2017 09:07:10 +0000 (09:07 +0000)]
[ELF] Add support for multiple passes to createThunks()

This change allows Thunks to be added on multiple passes. To do this we must
merge only the thunks added in each pass, and deal with thunks that have
drifted out of range of their callers.

A thunk may end out of range of its caller if enough thunks are added in
between the caller and the thunk. To handle this we create another thunk.

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

llvm-svn: 316754

7 years agoDAG: Fold fma (fneg x), K, y -> fma x, -K, y
Matt Arsenault [Fri, 27 Oct 2017 09:06:07 +0000 (09:06 +0000)]
DAG: Fold fma (fneg x), K, y -> fma x, -K, y

llvm-svn: 316753

7 years ago[ELF] Introduce range extension thunks for ARM
Peter Smith [Fri, 27 Oct 2017 09:04:11 +0000 (09:04 +0000)]
[ELF] Introduce range extension thunks for ARM

This change adds initial support for range extension thunks. All thunks must
be created within the first pass so some corner cases are not supported. A
follow up patch will add support for multiple passes.

With this change the existing tests arm-branch-error.s and
arm-thumb-branch-error.s now no longer fail with an out of range branch.
These have been renamed and tests added for the range extension thunk.

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

llvm-svn: 316752

7 years ago[ELF] Pre-create ThunkSections at Target specific intervals
Peter Smith [Fri, 27 Oct 2017 08:58:28 +0000 (08:58 +0000)]
[ELF] Pre-create ThunkSections at Target specific intervals

When an OutputSection is larger than the branch range for a Target we
need to place thunks such that they are always in range of their caller,
and sufficiently spaced to maximise the number of callers that can use
the thunk. We use the simple heuristic of placing the
ThunkSection at intervals corresponding to a target specific branch range.
If the OutputSection is small we put the thunks at the end of the executable
sections.

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

llvm-svn: 316751

7 years ago[ELF] Record created ThunkSections in InputSectionDescription [NFC].
Peter Smith [Fri, 27 Oct 2017 08:56:20 +0000 (08:56 +0000)]
[ELF] Record created ThunkSections in InputSectionDescription [NFC].

Instead of maintaining a map of the std::vector to ThunkSections, record the
ThunkSections directly in InputSectionDescription.

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

llvm-svn: 316750

7 years ago[CodeGen][ExpandMemcmp][NFC] Make tests more complete.
Clement Courbet [Fri, 27 Oct 2017 08:33:51 +0000 (08:33 +0000)]
[CodeGen][ExpandMemcmp][NFC] Make tests more complete.

llvm-svn: 316749

7 years ago[GVN][NFC] Refactor loop iteration with foreach
Max Kazantsev [Fri, 27 Oct 2017 08:19:35 +0000 (08:19 +0000)]
[GVN][NFC] Refactor loop iteration with foreach

llvm-svn: 316748

7 years agoAdd support for dwarf unwinding on windows on x86_64
Martin Storsjo [Fri, 27 Oct 2017 08:11:36 +0000 (08:11 +0000)]
Add support for dwarf unwinding on windows on x86_64

Clang doesn't currently support building for windows/x86_64 with
dwarf by setting command line parameters, but if manually modified
to use dwarf, we can make libunwind work in this configuration
as well.

Also include i386 in the docs when adding this as a supported
configuration; libunwind already works for i386 windows, but
can fail due to an issue unrelated to windows itself.

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

llvm-svn: 316747

7 years agoExpress Registers_*::lastDwarfReg using _LIBUNWIND_HIGHEST_DWARF_REGISTER
Martin Storsjo [Fri, 27 Oct 2017 07:59:01 +0000 (07:59 +0000)]
Express Registers_*::lastDwarfReg using _LIBUNWIND_HIGHEST_DWARF_REGISTER

This avoids having to keep the same information duplicated in multiple
places.

Adjust _LIBUNWIND_HIGHEST_DWARF_REGISTER to actually have the value
of the highest used register and only use the value
_LIBUNWIND_HIGHEST_DWARF_REGISTER + 1 (kMaxRegisterNumber + 1) for
allocating the savedRegisters array.

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

llvm-svn: 316745

7 years ago[clang-tidy ObjC] [3/3] New check objc-forbidden-subclassing
Haojian Wu [Fri, 27 Oct 2017 07:41:36 +0000 (07:41 +0000)]
[clang-tidy ObjC] [3/3] New check objc-forbidden-subclassing

Summary:
This is part 3 of 3 of a series of changes to improve Objective-C
linting in clang-tidy.

This adds a new clang-tidy check `objc-forbidden-subclassing` which
ensures clients do not create subclasses of Objective-C classes which
are not designed to be subclassed.

(Note that for code under your control, you should use
__attribute__((objc_subclassing_restricted)) instead -- this
is intended for third-party APIs which cannot be modified.)

By default, the following classes (which are publicly documented
as not supporting subclassing) are forbidden from subclassing:

ABNewPersonViewController
ABPeoplePickerNavigationController
ABPersonViewController
ABUnknownPersonViewController
NSHashTable
NSMapTable
NSPointerArray
NSPointerFunctions
NSTimer
UIActionSheet
UIAlertView
UIImagePickerController
UITextInputMode
UIWebView

Clients can set a CheckOption
`objc-forbidden-subclassing.ClassNames` to a semicolon-separated
list of class names, which overrides this list.

Test Plan: `ninja check-clang-tools`

Patch by Ben Hamilton!

Reviewers: hokein, alexfh

Reviewed By: hokein

Subscribers: saidinwot, Wizard, srhines, mgorny, xazax.hun

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

llvm-svn: 316744

7 years agollvm/CodeGen/GlobalISel/InstructionSelectorImpl.h: Fix -fmodules build introduced...
NAKAMURA Takumi [Fri, 27 Oct 2017 05:45:11 +0000 (05:45 +0000)]
llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h: Fix -fmodules build introduced in rL316715.

llvm-svn: 316743

7 years agoSimplify logic to find the last executable segment. NFC.
Rui Ueyama [Fri, 27 Oct 2017 05:08:39 +0000 (05:08 +0000)]
Simplify logic to find the last executable segment. NFC.

llvm-svn: 316742

7 years agoFix typo.
Rui Ueyama [Fri, 27 Oct 2017 04:59:33 +0000 (04:59 +0000)]
Fix typo.

llvm-svn: 316741

7 years agoFix a use-after-free in lldb-server
Pavel Labath [Fri, 27 Oct 2017 04:53:24 +0000 (04:53 +0000)]
Fix a use-after-free in lldb-server

UriParser::Parse is returning a StringRef pointing the the parsed
string, but we were calling it with a temporary string. Change this to a
local variable to make sure the string persists as long as we need it.

llvm-svn: 316740

7 years agoRevert rL316568 because of sudden performance drop on ARM
Max Kazantsev [Fri, 27 Oct 2017 04:17:44 +0000 (04:17 +0000)]
Revert rL316568 because of sudden performance drop on ARM

llvm-svn: 316739

7 years agoRemove a boolean flag `Create`. NFC.
Rui Ueyama [Fri, 27 Oct 2017 04:15:28 +0000 (04:15 +0000)]
Remove a boolean flag `Create`. NFC.

llvm-svn: 316738

7 years agoAdd subclass data to the FoldingSetNode for MemIntrinsicSDNodes.
Sean Fertile [Fri, 27 Oct 2017 04:02:51 +0000 (04:02 +0000)]
Add subclass data to the FoldingSetNode for MemIntrinsicSDNodes.

Not having the subclass data on an MemIntrinsicSDNodes means it was possible
to try to fold 2 nodes with the same operands but differing MMO flags. This
would trip an assertion when trying to refine the alignment between the 2
MachineMemOperands.

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

llvm-svn: 316737

7 years agoDefine a file-local write32 as a wrapper for endian::write32.
Rui Ueyama [Fri, 27 Oct 2017 03:59:34 +0000 (03:59 +0000)]
Define a file-local write32 as a wrapper for endian::write32.

llvm-svn: 316736

7 years agoDo not use InputSection::getFile<ELFT>() if InputSection::File suffices. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:25:04 +0000 (03:25 +0000)]
Do not use InputSection::getFile<ELFT>() if InputSection::File suffices.  NFC.

llvm-svn: 316735

7 years agoDe-template EhFrameHdr. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:14:24 +0000 (03:14 +0000)]
De-template EhFrameHdr. NFC.

llvm-svn: 316734

7 years agoDe-template EhReader. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:14:09 +0000 (03:14 +0000)]
De-template EhReader. NFC.

llvm-svn: 316733

7 years agoDe-template elf::getObjMsg. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:13:54 +0000 (03:13 +0000)]
De-template elf::getObjMsg. NFC.

llvm-svn: 316732

7 years agoDe-template EhFrameSection. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:13:39 +0000 (03:13 +0000)]
De-template EhFrameSection. NFC.

llvm-svn: 316731

7 years agoMake EhFrameHdr pull data from EhFrameSection. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:13:24 +0000 (03:13 +0000)]
Make EhFrameHdr pull data from EhFrameSection. NFC.

Previously, EhFrameSection pushes data to EhFrameHdr by calling addFde
function. By making EhFrameHdr pull data from EhFrameSection, we can
eliminate a member from EhFrameHdr.

llvm-svn: 316730

7 years agoDe-template a few functions. NFC.
Rui Ueyama [Fri, 27 Oct 2017 03:13:09 +0000 (03:13 +0000)]
De-template a few functions. NFC.

llvm-svn: 316729

7 years agoDefault to using in-tree clang for building test executables
Pavel Labath [Fri, 27 Oct 2017 02:24:04 +0000 (02:24 +0000)]
Default to using in-tree clang for building test executables

Summary:
Using the in-tree clang should be the default test configuration as that
is the one compiler that we can be sure everyone has (better
reproducibility of test results). Also, it should hopefully reduce the
impact of pr35040.

This also reduces the number of settings which control the compiler
used. LLDB_TEST_C_COMPILER is used for C files and
LLDB_TEST_CXX_COMPILER for C++ files. Both of the settings default to
the in-tree clang.

Reviewers: zturner

Subscribers: mgorny, davide, lldb-commits

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

llvm-svn: 316728

7 years agoAdd Arm Architecture plugin to the xcode project file.
Jason Molenda [Fri, 27 Oct 2017 02:21:55 +0000 (02:21 +0000)]
Add Arm Architecture plugin to the xcode project file.

llvm-svn: 316727

7 years agoInclude an error code when getRandomBytes failed.
Rui Ueyama [Fri, 27 Oct 2017 01:25:29 +0000 (01:25 +0000)]
Include an error code when getRandomBytes failed.

In a rare situation, the function can fail (e.g. it fails if it cannot
open /dev/urandom.)

llvm-svn: 316726

7 years agoFix test/Driver/wasm-toolchain.c on windows
Sam Clegg [Fri, 27 Oct 2017 01:20:16 +0000 (01:20 +0000)]
Fix test/Driver/wasm-toolchain.c on windows

llvm-svn: 316725

7 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 27 Oct 2017 01:09:08 +0000 (01:09 +0000)]
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 316724

7 years ago[CodeGen] Add support for IncompleteArrayType in Obj-C ivars.
Volodymyr Sapsai [Fri, 27 Oct 2017 00:56:23 +0000 (00:56 +0000)]
[CodeGen] Add support for IncompleteArrayType in Obj-C ivars.

Fixes an assertion failure when ivar is a struct containing incomplete
array. Also completes support for direct flexible array members.

rdar://problem/21054495

Reviewers: rjmccall, theraven

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 316723

7 years ago[PDB] Handle an empty globals hash table with no buckets
Reid Kleckner [Fri, 27 Oct 2017 00:45:51 +0000 (00:45 +0000)]
[PDB] Handle an empty globals hash table with no buckets

llvm-svn: 316722

7 years agoRevert "[CGP] Merge empty case blocks if no extra moves are added."
Balaram Makam [Fri, 27 Oct 2017 00:35:18 +0000 (00:35 +0000)]
Revert "[CGP] Merge empty case blocks if no extra moves are added."

This reverts commit r316711. The domtree isn't getting updated correctly.

llvm-svn: 316721

7 years ago[LSan] Disable a couple of failing tests on PPC64 (pending investigation).
Alex Shlyapnikov [Fri, 27 Oct 2017 00:29:40 +0000 (00:29 +0000)]
[LSan] Disable a couple of failing tests on PPC64 (pending investigation).

llvm-svn: 316720

7 years ago[WebAssembly] Include libclang_rt.builtins in the standard way
Sam Clegg [Fri, 27 Oct 2017 00:26:07 +0000 (00:26 +0000)]
[WebAssembly] Include libclang_rt.builtins in the standard way

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

llvm-svn: 316719

7 years ago[X86] Add 'sse4' to X86TargetInfo::isValidFeatureName
Craig Topper [Fri, 27 Oct 2017 00:18:16 +0000 (00:18 +0000)]
[X86] Add 'sse4' to X86TargetInfo::isValidFeatureName

sse4 is valid for target attribute and functions as an alias of sse4.2.

llvm-svn: 316718

7 years ago[WebAssembly] MC: Don't allow zero sized data segments
Sam Clegg [Fri, 27 Oct 2017 00:08:55 +0000 (00:08 +0000)]
[WebAssembly] MC: Don't allow zero sized data segments

This ensures that each segment has a unique address.
Without this, consecutive zero sized symbols would
end up with the same address and the linker cannot
map symbols to unique data segments.

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

llvm-svn: 316717

7 years agoRemove an unnecessary inheritance.
Rui Ueyama [Thu, 26 Oct 2017 23:54:00 +0000 (23:54 +0000)]
Remove an unnecessary inheritance.

llvm-svn: 316716

7 years agoInstructionSelectorImpl.h: Modularize/remove ODR violations by using a static member...
David Blaikie [Thu, 26 Oct 2017 23:39:54 +0000 (23:39 +0000)]
InstructionSelectorImpl.h: Modularize/remove ODR violations by using a static member function to expose the debug name

llvm-svn: 316715

7 years agoMCCodePadder.h: Include definition of type for use with DenseMap
David Blaikie [Thu, 26 Oct 2017 23:39:52 +0000 (23:39 +0000)]
MCCodePadder.h: Include definition of type for use with DenseMap

Pointer traits require a full definition of a type to function
correctly, so the header must be included rather than only a forward
declaration.

llvm-svn: 316714

7 years agoUse -fuse-init-array if no gcc installation is found.
Nico Weber [Thu, 26 Oct 2017 23:26:29 +0000 (23:26 +0000)]
Use -fuse-init-array if no gcc installation is found.

clang currently uses .init_array instead of .ctors on Linux if it detects gcc
4.7+. Make it so that it also uses .init_array if no gcc installation is found
at all – if there's no old gcc, there's nothing we need to be compatible with.

icecc for example runs clang in a very small chroot, so before this change
clang would use .ctors if run under icecc. And lld currently silently mislinks
inputs with .ctors sections, so before this clang + icecc + lld would produce
broken binaries. (But this seems like a good change independent of that lld
bug.)

https://reviews.llvm.org/D39317

llvm-svn: 316713

7 years ago[X86] Make -march=i686 an alias of -march=pentiumpro
Craig Topper [Thu, 26 Oct 2017 23:06:19 +0000 (23:06 +0000)]
[X86] Make -march=i686 an alias of -march=pentiumpro

I think the only reason they are different is because we don't set tune_i686 for -march=i686 to match GCC. But GCC 4.9.0 seems to have changed this behavior and they do set it now. So I think they can aliases now.

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

llvm-svn: 316712

7 years ago[CGP] Merge empty case blocks if no extra moves are added.
Balaram Makam [Thu, 26 Oct 2017 22:34:01 +0000 (22:34 +0000)]
[CGP] Merge empty case blocks if no extra moves are added.

Summary:
Currently we skip merging when extra moves may be added in the header of switch instead of the case block, if the case block is used as an incoming
block of a PHI. If all the incoming values of the PHIs are non-constants and the destination block is dominated by the switch block then extra moves are likely not added by ISel, so there is no need to skip merging in this case.

Reviewers: efriedma, junbuml, davidxl, hfinkel, qcolombet

Reviewed By: efriedma

Subscribers: dberlin, kuhar, mcrosier, llvm-commits

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

llvm-svn: 316711