platform/upstream/llvm.git
6 years ago[WebAssembly] Remove StackPointerGlobal member variable from the driver.
Rui Ueyama [Thu, 5 Apr 2018 19:37:48 +0000 (19:37 +0000)]
[WebAssembly] Remove StackPointerGlobal member variable from the driver.

Since InputGlobal makes a copy of a given object, we can use a temporary
object allocated on the stack here.

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

llvm-svn: 329337

6 years ago[WebAssembly] Remove another trivial accessor.
Rui Ueyama [Thu, 5 Apr 2018 19:37:31 +0000 (19:37 +0000)]
[WebAssembly] Remove another trivial accessor.

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

llvm-svn: 329336

6 years ago[RuntimeDyld][PowerPC] Use global entry points for calls between sections.
Lang Hames [Thu, 5 Apr 2018 19:37:05 +0000 (19:37 +0000)]
[RuntimeDyld][PowerPC] Use global entry points for calls between sections.

Functions in different objects may use different TOCs, so calls between such
functions should use the global entry point of the callee which updates the
TOC pointer.

This should fix a bug that the Numba developers encountered (see
https://github.com/numba/numba/issues/2451).

Patch by Olexa Bilaniuk. Thanks Olexa!

No RuntimeDyld checker test case yet as I am not familiar enough with how
RuntimeDyldELF fixes up call-sites, but I do not want to hold up landing
this. I will continue to work on it and see if I can rope some powerpc
experts in.

llvm-svn: 329335

6 years ago[Bitcode] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Thu, 5 Apr 2018 19:27:04 +0000 (19:27 +0000)]
[Bitcode] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: pcc, mehdi_amini, dexonsmith

Reviewed By: dexonsmith

Subscribers: llvm-commits

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

llvm-svn: 329334

6 years ago[ELF] Add CHECK to test/ELF/undef-start.s
Fangrui Song [Thu, 5 Apr 2018 19:20:33 +0000 (19:20 +0000)]
[ELF] Add CHECK to test/ELF/undef-start.s

llvm-svn: 329333

6 years agoDR1672, DR1813, DR1881, DR2120: Implement recent fixes to "standard
Richard Smith [Thu, 5 Apr 2018 18:55:37 +0000 (18:55 +0000)]
DR1672, DR1813, DR1881, DR2120: Implement recent fixes to "standard
layout" rules.

The new rules say that a standard-layout struct has its first non-static
data member and all base classes at offset 0, and consider a class to
not be standard-layout if that would result in multiple subobjects of a
single type having the same address.

We track "is C++11 standard-layout class" separately from "is
standard-layout class" so that the ABIs that need this information can
still use it.

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

llvm-svn: 329332

6 years ago[InstCombine] Properly change GEP type when reassociating loop invariant GEP chains
Daniel Neilson [Thu, 5 Apr 2018 18:51:45 +0000 (18:51 +0000)]
[InstCombine] Properly change GEP type when reassociating loop invariant GEP chains

Summary:
This is a fix to PR37005.

Essentially, rL328539 ([InstCombine] reassociate loop invariant GEP chains to enable LICM) contains a bug
whereby it will convert:
%src = getelementptr inbounds i8, i8* %base, <2 x i64> %val
%res = getelementptr inbounds i8, <2 x i8*> %src, i64 %val2
into:
%src = getelementptr inbounds i8, i8* %base, i64 %val2
%res = getelementptr inbounds i8, <2 x i8*> %src, <2 x i64> %val

By swapping the index operands if the GEPs are in a loop, and %val is loop variant while %val2
is loop invariant.

This fix recreates new GEP instructions if the index operand swap would result in the type
of %src changing from vector to scalar, or vice versa.

Reviewers: sebpop, spatel

Reviewed By: sebpop

Subscribers: llvm-commits

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

llvm-svn: 329331

6 years ago[X86] Synchronize the SchedRW on some EVEX instructions with their VEX equivalents.
Craig Topper [Thu, 5 Apr 2018 18:38:45 +0000 (18:38 +0000)]
[X86] Synchronize the SchedRW on some EVEX instructions with their VEX equivalents.

Mostly vector load, store, and move instructions.

llvm-svn: 329330

6 years ago[ARM] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Thu, 5 Apr 2018 18:31:50 +0000 (18:31 +0000)]
[ARM] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in D44363 for a list of all the required patches.

Reviewers: t.p.northover, RKSimon, MatzeB, bkramer

Reviewed By: bkramer

Subscribers: javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 329329

6 years agoSilence msvc warning on isl. NFC.
Michael Kruse [Thu, 5 Apr 2018 18:30:44 +0000 (18:30 +0000)]
Silence msvc warning on isl. NFC.

The warning is:

    isl_union_map.c(2041): warning C4221: nonstandard extension used: 'filter_user': cannot be initialized using address of automatic variable 'data'

for the following code (and others)

struct isl_un_op_drop_user_data data = { &isl_set_is_wrapping };
struct isl_un_op_control control = {
.filter = &un_op_filter_drop_user,
.filter_user = &data,
.fn_map = &isl_set_wrapped_domain_map,
};

llvm-svn: 329328

6 years ago[X86] Disassembler support for having an ADSIZE prefix affect instructions with 0xf2...
Craig Topper [Thu, 5 Apr 2018 18:20:14 +0000 (18:20 +0000)]
[X86] Disassembler support for having an ADSIZE prefix affect instructions with 0xf2 and 0xf3 prefixes.

Needed to support umonitor from D45253.

llvm-svn: 329327

6 years ago[llvm-pdbutil] Display types from MSVC precompiled header object files.
Zachary Turner [Thu, 5 Apr 2018 18:18:12 +0000 (18:18 +0000)]
[llvm-pdbutil] Display types from MSVC precompiled header object files.

These appear in a .debug$P section, which is exactly the same in
format as a .debug$T section.  So we shouldn't ignore these when
dumping types.

llvm-svn: 329326

6 years agollvm-exegesis: Fix unittests include dirs when llvm is a part of another project
Konstantin Zhuravlyov [Thu, 5 Apr 2018 18:16:02 +0000 (18:16 +0000)]
llvm-exegesis: Fix unittests include dirs when llvm is a part of another project

When llvm is a part of another project (i.e. opencl),
CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR are pointing to
the parent project, which lead to build failures.

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

llvm-svn: 329325

6 years agoRemove the temporary availability checking workaround for
Alex Lorenz [Thu, 5 Apr 2018 18:12:06 +0000 (18:12 +0000)]
Remove the temporary availability checking workaround for
the nested declarations in @interface.

rdar://28825862

llvm-svn: 329324

6 years agoFix typo in comment -fmath-errno=0 -> -fno-math-errno
Sam Clegg [Thu, 5 Apr 2018 17:44:08 +0000 (17:44 +0000)]
Fix typo in comment -fmath-errno=0 -> -fno-math-errno

The former is not a valid clang argument

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

llvm-svn: 329323

6 years ago[InstCombine] add test for fneg+fsub with nsz; NFC
Sanjay Patel [Thu, 5 Apr 2018 17:40:51 +0000 (17:40 +0000)]
[InstCombine] add test for fneg+fsub with nsz; NFC

There used to be a fold that would handle this case more generally,
but it was removed at rL73243 to fix PR4374:
https://bugs.llvm.org/show_bug.cgi?id=4374

llvm-svn: 329322

6 years ago[X86][SSE] Add integer add/mul vector.reduce tests
Simon Pilgrim [Thu, 5 Apr 2018 17:37:35 +0000 (17:37 +0000)]
[X86][SSE] Add integer add/mul vector.reduce tests

llvm-svn: 329321

6 years ago[X86][SSE] Add integer and/or/xor vector.reduce tests
Simon Pilgrim [Thu, 5 Apr 2018 17:29:51 +0000 (17:29 +0000)]
[X86][SSE] Add integer and/or/xor vector.reduce tests

llvm-svn: 329320

6 years ago[X86][SSE] Add integer min/max vector.reduce tests
Simon Pilgrim [Thu, 5 Apr 2018 17:25:40 +0000 (17:25 +0000)]
[X86][SSE] Add integer min/max vector.reduce tests

llvm-svn: 329319

6 years agoAnother fix for r329293: Unbreak the windows bots
Philip Pfaffe [Thu, 5 Apr 2018 17:20:45 +0000 (17:20 +0000)]
Another fix for r329293: Unbreak the windows bots

Only build the unittest if plugins are enabled. Link components into the
TestPlugin on windows and cygwin.

llvm-svn: 329318

6 years agoMake "Size" column in the map file one characters shorter.
Rui Ueyama [Thu, 5 Apr 2018 17:20:18 +0000 (17:20 +0000)]
Make "Size" column in the map file one characters shorter.

Previously, "size" column is 9 characters long which is too long
at least for 32-bit (because at maximum it needs 8 columns). This
patch make it one column shorter than before. That's also a reasonable
default for 64-bit.

llvm-svn: 329317

6 years ago[InstCombine] use pattern matchers for fsub --> fadd folds
Sanjay Patel [Thu, 5 Apr 2018 17:06:45 +0000 (17:06 +0000)]
[InstCombine] use pattern matchers for fsub --> fadd folds

This allows folding for vectors with undef elements.

llvm-svn: 329316

6 years ago[WebAssembly] Allow for the creation of user-defined custom sections
Sam Clegg [Thu, 5 Apr 2018 17:01:39 +0000 (17:01 +0000)]
[WebAssembly] Allow for the creation of user-defined custom sections

This patch adds a way for users to create their own custom sections to
be added to wasm files. At the LLVM IR layer, they are defined through
the "wasm.custom_sections" named metadata. The expected use case for
this is bindings generators such as wasm-bindgen.

Patch by Dan Gohman

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

llvm-svn: 329315

6 years agoOne more windows build fix
Pavel Labath [Thu, 5 Apr 2018 16:59:36 +0000 (16:59 +0000)]
One more windows build fix

llvm-svn: 329314

6 years ago[InstCombine] add tests for fsub --> fadd; NFC
Sanjay Patel [Thu, 5 Apr 2018 16:51:09 +0000 (16:51 +0000)]
[InstCombine] add tests for fsub --> fadd; NFC

llvm-svn: 329313

6 years agoFix column size in the map file.
Rui Ueyama [Thu, 5 Apr 2018 16:45:37 +0000 (16:45 +0000)]
Fix column size in the map file.

Size can be narrow, but LMA should be the same width as VMA.

llvm-svn: 329312

6 years ago[documentation][llvm-mca] Update the documentation.
Andrea Di Biagio [Thu, 5 Apr 2018 16:42:32 +0000 (16:42 +0000)]
[documentation][llvm-mca] Update the documentation.

Scheduling models can now describe processor register files and retire control
units. This updates the existing documentation and the README file.

llvm-svn: 329311

6 years ago[X86] Use WriteFShuffle256 for VEXTRACTF128 to be consistent with VEXTRACTI128 which...
Craig Topper [Thu, 5 Apr 2018 16:32:48 +0000 (16:32 +0000)]
[X86] Use WriteFShuffle256 for VEXTRACTF128 to be consistent with VEXTRACTI128 which uses WriteShuffle256.

llvm-svn: 329310

6 years agoFix windows build after r329296
Pavel Labath [Thu, 5 Apr 2018 16:23:54 +0000 (16:23 +0000)]
Fix windows build after r329296

Add a couple of #include <csignal>s.

llvm-svn: 329309

6 years agoFix r329293: Add a missing CMake dependency
Philip Pfaffe [Thu, 5 Apr 2018 15:58:27 +0000 (15:58 +0000)]
Fix r329293:  Add a missing CMake dependency

The unittest plugin indirectly includes Attributes.gen, so make sure its
target depends on the appropriate tablegen target.

llvm-svn: 329308

6 years agoInitialize OutputOff to zero.
Rafael Espindola [Thu, 5 Apr 2018 15:56:04 +0000 (15:56 +0000)]
Initialize OutputOff to zero.

We have a dedicated Live bit, so we don't need a special value and we
were not accounting for in at least one place.

llvm-svn: 329307

6 years agoFix the buildbots after r329304.
Andrea Di Biagio [Thu, 5 Apr 2018 15:53:31 +0000 (15:53 +0000)]
Fix the buildbots after r329304.

llvm-svn: 329306

6 years agoCleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit
Greg Clayton [Thu, 5 Apr 2018 15:52:39 +0000 (15:52 +0000)]
Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit

Many things that were in DWARFCompileUnit actually need to be in DWARFUnit. This patch moves all DWARFUnit specific things over into DWARFUnit and fixes the layering. This is in preparation for adding DWARFTypeUnit for the .debug_types patch.

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

llvm-svn: 329305

6 years ago[MC][Tablegen] Allow models to describe the retire control unit for llvm-mca.
Andrea Di Biagio [Thu, 5 Apr 2018 15:41:41 +0000 (15:41 +0000)]
[MC][Tablegen] Allow models to describe the retire control unit for llvm-mca.

This patch adds the ability to describe properties of the hardware retire
control unit.

Tablegen class RetireControlUnit has been added for this purpose (see
TargetSchedule.td).

A RetireControlUnit specifies the size of the reorder buffer, as well as the
maximum number of opcodes that can be retired every cycle.

A zero (or negative) value for the reorder buffer size means: "the size is
unknown". If the size is unknown, then llvm-mca defaults it to the value of
field SchedMachineModel::MicroOpBufferSize.  A zero or negative number of
opcodes retired per cycle means: "there is no restriction on the number of
instructions that can be retired every cycle".

Models can optionally specify an instance of RetireControlUnit. There can only
be up-to one RetireControlUnit definition per scheduling model.

Information related to the RCU (RetireControlUnit) is stored in (two new fields
of) MCExtraProcessorInfo.  llvm-mca loads that information when it initializes
the DispatchUnit / RetireControlUnit (see Dispatch.h/Dispatch.cpp).

This patch fixes PR36661.

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

llvm-svn: 329304

6 years ago[PatternMatch] define m_FNeg using m_FSub
Sanjay Patel [Thu, 5 Apr 2018 15:36:55 +0000 (15:36 +0000)]
[PatternMatch] define m_FNeg using m_FSub

Using cstfp_pred_ty in the definition allows us to match vectors with undef elements.

This replicates the change for m_Not from D44076 / rL326823 and continues
towards making all pattern matchers allow undef elements in vectors.

llvm-svn: 329303

6 years agoRemove namespace comment at end of class. NFC.
Michael Kruse [Thu, 5 Apr 2018 15:32:06 +0000 (15:32 +0000)]
Remove namespace comment at end of class. NFC.

The
}; // namespace polly
comment was put at the closing brace of the FunctionToScopPassAdaptor class.
Since no namespace ends here, the comment is misplaced.

Reported-by: Lukas Böhm <lukas.boehm93@gmail.com>
llvm-svn: 329302

6 years ago[ASTImporter] Fix for importing unnamed structs
Aleksei Sidorin [Thu, 5 Apr 2018 15:31:49 +0000 (15:31 +0000)]
[ASTImporter] Fix for importing unnamed structs

Patch by Peter Szecsi!

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

llvm-svn: 329301

6 years agoDisable -fmerge-all-constants as default.
Manoj Gupta [Thu, 5 Apr 2018 15:29:52 +0000 (15:29 +0000)]
Disable -fmerge-all-constants as default.

Summary:
"-fmerge-all-constants" is a non-conforming optimization and should not
be the default. It is also causing miscompiles when building Linux
Kernel (https://lkml.org/lkml/2018/3/20/872).

Fixes PR18538.

Reviewers: rjmccall, rsmith, chandlerc

Reviewed By: rsmith, chandlerc

Subscribers: srhines, cfe-commits

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

llvm-svn: 329300

6 years ago[PowerPC] fix assertion failure due to missing instruction in P9InstrResources.td
Hiroshi Inoue [Thu, 5 Apr 2018 15:27:06 +0000 (15:27 +0000)]
[PowerPC] fix assertion failure due to missing instruction in P9InstrResources.td

This patch adds L(W|H|B)ZXTLS_32 instructions introduced by https://reviews.llvm.org/rL327635 in P9InstrResources.td.

llvm-svn: 329299

6 years ago[clang-format] Support lightweight Objective-C generics
Ben Hamilton [Thu, 5 Apr 2018 15:26:25 +0000 (15:26 +0000)]
[clang-format] Support lightweight Objective-C generics

Summary:
Previously, `clang-format` didn't understand lightweight
Objective-C generics, which have the form:

```
@interface Foo <KeyType,
                ValueTypeWithConstraint : Foo,
AnotherValueTypeWithGenericConstraint: Bar<Baz>, ... > ...
```

The lightweight generic specifier list appears before the base
class, if present, but because it starts with < like the protocol
specifier list, `UnwrappedLineParser` was getting confused and
failed to parse interfaces with both generics and protocol lists:

```
@interface Foo <KeyType> : NSObject <NSCopying>
```

Since the parsed line would be incomplete, the format result
would be very confused (e.g., https://bugs.llvm.org/show_bug.cgi?id=24381).

This fixes the issue by explicitly parsing the ObjC lightweight
generic conformance list, so the line is fully parsed.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=24381

Test Plan: New tests added. Ran tests with:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 329298

6 years ago[clang-format] Ensure ObjC selectors with 0 args are annotated correctly
Ben Hamilton [Thu, 5 Apr 2018 15:26:23 +0000 (15:26 +0000)]
[clang-format] Ensure ObjC selectors with 0 args are annotated correctly

Summary:
Previously, clang-format would incorrectly annotate 0-argument
Objective-C selector names as TT_TrailingAnnotation:

```
% echo "-(void)foo;" > /tmp/test.m
% ./bin/clang-format -debug /tmp/test.m
Language: Objective-C
----
Line(0, FSC=0): minus[T=68, OC=0] l_paren[T=68, OC=1] void[T=68, OC=2]
r_paren[T=68, OC=6] identifier[T=68, OC=7] semi[T=68, OC=10]
Line(0, FSC=0): eof[T=68, OC=0]
Run 0...
AnnotatedTokens(L=0):
 M=0 C=0 T=ObjCMethodSpecifier S=1 B=0 BK=0 P=0 Name=minus L=1 PPK=2
 FakeLParens= FakeRParens=0 Text='-'
 M=0 C=1 T=Unknown S=1 B=0 BK=0 P=33 Name=l_paren L=3 PPK=2
 FakeLParens= FakeRParens=0 Text='('
 M=0 C=1 T=Unknown S=0 B=0 BK=0 P=140 Name=void L=7 PPK=2 FakeLParens=
 FakeRParens=0 Text='void'
 M=0 C=0 T=CastRParen S=0 B=0 BK=0 P=43 Name=r_paren L=8 PPK=2
 FakeLParens= FakeRParens=0 Text=')'
 M=0 C=1 T=TrailingAnnotation S=0 B=0 BK=0 P=120 Name=identifier L=11
 PPK=2 FakeLParens= FakeRParens=0 Text='foo'
 M=0 C=0 T=Unknown S=0 B=0 BK=0 P=23 Name=semi L=12 PPK=2 FakeLParens=
 FakeRParens=0 Text=';'
```

This caused us to incorrectly indent 0-argument wrapped selectors
when Style.IndentWrappedFunctionNames was false, as we thought
the 0-argument ObjC selector name was actually a trailing
annotation (which is always indented).

This diff fixes the issue and adds tests.

Test Plan: New tests added. Confirmed tests failed before diff.
  After diff, tests passed. Ran tests with:
  % make -j12 FormatTests &&
  ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper, jolesiak

Subscribers: klimek, cfe-commits

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

llvm-svn: 329297

6 years agoRemove unused NativeProcessProtocol.h include from Platform.h
Pavel Labath [Thu, 5 Apr 2018 15:17:51 +0000 (15:17 +0000)]
Remove unused NativeProcessProtocol.h include from Platform.h

After removing it, I got a couple of compile errors because we were
missing some symbols (SIGKILL and such), as their definitions were not
transitively included anymore. I fix this by including csignal from
PosixApi.h, as it's windows version provides a stub definitions of these
symbols. This should make the result of #including PosixApi.h more
consistent across platforms (although in the long run, we should just
get rid of this header).

llvm-svn: 329296

6 years agoFix error in QEnableErrorStrings gdb-remote docs
Pavel Labath [Thu, 5 Apr 2018 15:17:43 +0000 (15:17 +0000)]
Fix error in QEnableErrorStrings gdb-remote docs

this probably happened because we changed the name of the packet
mid-review.

llvm-svn: 329295

6 years ago[InstCombine] add vector and vector undef tests for FP folds; NFC
Sanjay Patel [Thu, 5 Apr 2018 15:07:35 +0000 (15:07 +0000)]
[InstCombine] add vector and vector undef tests for FP folds; NFC

llvm-svn: 329294

6 years agoRe-land r329273: [Plugins] Add a slim plugin API to work together with the new PM
Philip Pfaffe [Thu, 5 Apr 2018 15:04:13 +0000 (15:04 +0000)]
Re-land r329273: [Plugins] Add a slim plugin API to work together with the new PM

Fix unittest: Do not link LLVM into the test plugin.
Additionally, remove an unrelated change that slipped in in r329273.

llvm-svn: 329293

6 years ago[clang-tidy] Remove google-runtime-member-string-references
Benjamin Kramer [Thu, 5 Apr 2018 14:51:01 +0000 (14:51 +0000)]
[clang-tidy] Remove google-runtime-member-string-references

This is triggering on a pattern that's both too broad (const
std::string& members can be used safely) and too narrow (std::string is
not the only class with this problem). It has a very low true positive
rate, just remove it until we find a better solution for dangling string
references.

llvm-svn: 329292

6 years agor600: Update datalayout after LLVM r328656
Jan Vesely [Thu, 5 Apr 2018 14:47:57 +0000 (14:47 +0000)]
r600: Update datalayout after LLVM r328656

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 329291

6 years agoamdgcn: Update datalayout after LLVM r328656
Jan Vesely [Thu, 5 Apr 2018 14:47:44 +0000 (14:47 +0000)]
amdgcn: Update datalayout after LLVM r328656

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 329290

6 years ago[ObjC] Make C++ triviality type traits available to non-trivial C
Akira Hatanaka [Thu, 5 Apr 2018 14:39:57 +0000 (14:39 +0000)]
[ObjC] Make C++ triviality type traits available to non-trivial C
structs.

r326307 and r327870 made changes that allowed using non-trivial C
structs with fields qualified with __strong or __weak. This commit makes
the following C++ triviality type traits available to non-trivial C
structs:

__has_trivial_assign
__has_trivial_move_assign
__has_trivial_copy
__has_trivial_move_constructor
__has_trivial_constructor
__has_trivial_destructor

This reapplies r328680. This commit fixes a bug where the copy/move
__has_trivial_* traits would return false when a volatile type was being
passed. Thanks to Richard Smith for pointing out the mistake.

rdar://problem/33599681

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

llvm-svn: 329289

6 years ago[Testing/Support]: Better matching of Error failure states
Pavel Labath [Thu, 5 Apr 2018 14:32:10 +0000 (14:32 +0000)]
[Testing/Support]: Better matching of Error failure states

Summary:
The existing Failed() matcher only allowed asserting that the operation
failed, but it was not possible to verify any details of the returned
error.

This patch adds two new matchers, which make this possible:
- Failed<InfoT>() verifies that the operation failed with a single error
  of a given type.
- Failed<InfoT>(M) additionally check that the contained error info
  object is matched by the nested matcher M.

To make these work, I've changed the implementation of the ErrorHolder
class. Now, instead of just storing the string representation of the
Error, it fetches the ErrorInfo objects and stores then as a list of
shared pointers. This way, ErrorHolder remains copyable, while still
retaining the full information contained in the Error object.

In case the Error object contains two or more errors, the new matchers
will fail to match, instead of trying to match all (or any) of the
individual ErrorInfo objects. This seemed to be the most sensible
behavior for when one wants to match exact error details, but I could be
convinced otherwise...

Reviewers: zturner, lhames

Subscribers: llvm-commits

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

llvm-svn: 329288

6 years agoARM: Do not spill CSR to stack on entry to noreturn functions
Tim Northover [Thu, 5 Apr 2018 14:26:06 +0000 (14:26 +0000)]
ARM: Do not spill CSR to stack on entry to noreturn functions

A noreturn nounwind function can be expected to never return in any way, and by
never returning it will also never have to restore any callee-saved registers
for its caller. This makes it possible to skip spills of those registers during
function entry, saving some stack space and time in the process. This is rather
useful for embedded targets with limited stack space.

Should fix PR9970.

Patch by myeisha (pmb).

llvm-svn: 329287

6 years ago[Hexagon] Remove default values from lambda parameters
Krzysztof Parzyszek [Thu, 5 Apr 2018 14:25:52 +0000 (14:25 +0000)]
[Hexagon] Remove default values from lambda parameters

llvm-svn: 329286

6 years ago[Lexicon] Add "ICE", internal compiler error
Brian Gesiak [Thu, 5 Apr 2018 14:08:16 +0000 (14:08 +0000)]
[Lexicon] Add "ICE", internal compiler error

Test Plan:
1. `ninja docs-llvm-html`
2. Confirm that the rendered docs HTML contains the new "ICE" entry

llvm-svn: 329285

6 years ago[MC] Fix spaces between values printed by EmitRegisterFileInfo.
Andrea Di Biagio [Thu, 5 Apr 2018 13:59:52 +0000 (13:59 +0000)]
[MC] Fix spaces between values printed by EmitRegisterFileInfo.

llvm-svn: 329284

6 years ago[DAGCombine] Revert r329160
Sam Parker [Thu, 5 Apr 2018 13:46:17 +0000 (13:46 +0000)]
[DAGCombine] Revert r329160

Again, broke the big endian stage 2 builders.

llvm-svn: 329283

6 years ago[InstCombine] cleanup; NFC
Sanjay Patel [Thu, 5 Apr 2018 13:24:26 +0000 (13:24 +0000)]
[InstCombine] cleanup; NFC

llvm-svn: 329282

6 years ago[ELF] Don't add NOLOAD sections to segment
Eugene Leviant [Thu, 5 Apr 2018 13:23:59 +0000 (13:23 +0000)]
[ELF] Don't add NOLOAD sections to segment

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

llvm-svn: 329281

6 years ago[SchedModel] Complete models shouldn't match against itineraries when they don't...
Simon Pilgrim [Thu, 5 Apr 2018 13:11:36 +0000 (13:11 +0000)]
[SchedModel] Complete models shouldn't match against itineraries when they don't use them (PR35639)

For schedule models that don't use itineraries, checkCompleteness still checks that an instruction has a matching itinerary instead of skipping and going straight to matching the InstRWs. That doesn't seem to match what happens in TargetSchedule.cpp

This patch causes problems for a number of models that had been incorrectly flagged as complete.

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

llvm-svn: 329280

6 years ago[LoopInterchange] Require asserts for test using -stats (NFC)
Florian Hahn [Thu, 5 Apr 2018 13:07:39 +0000 (13:07 +0000)]
[LoopInterchange] Require asserts for test using -stats (NFC)

This fixes a buildbot failure.

llvm-svn: 329279

6 years ago[PATCH] [RISCV] Extend getTargetDefines for RISCVTargetInfo
Shiva Chen [Thu, 5 Apr 2018 12:54:00 +0000 (12:54 +0000)]
[PATCH] [RISCV] Extend getTargetDefines for RISCVTargetInfo

Summary:
This patch extend getTargetDefines and implement handleTargetFeatures
and hasFeature. and define corresponding marco for those features.

Reviewers: asb, apazos, eli.friedman

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

Patch by Kito Cheng.

llvm-svn: 329278

6 years agoMinor fix in docs.
Alexander Kornienko [Thu, 5 Apr 2018 12:48:22 +0000 (12:48 +0000)]
Minor fix in docs.

llvm-svn: 329277

6 years agoRevert "[Plugins] Add a slim plugin API to work together with the new PM"
Philip Pfaffe [Thu, 5 Apr 2018 12:42:12 +0000 (12:42 +0000)]
Revert "[Plugins] Add a slim plugin API to work together with the new PM"

This reverts commit ecf3ba1ab45edb1b0fadce716a7facf50dca4fbb/r329273.

llvm-svn: 329276

6 years ago[ELF] - Eliminate Target::isPicRel method.
George Rimar [Thu, 5 Apr 2018 12:07:20 +0000 (12:07 +0000)]
[ELF] - Eliminate Target::isPicRel method.

As was mentioned in comments for D45158,
isPicRel's name does not make much sense,
because what this method does is checks if
we need to create the dynamic relocation or not.

Instead of renaming it to something different,
we can 'isPicRel' completely.

We can reuse the getDynRel method.
They are logically very close, getDynRel can just return
R_*_NONE in case no dynamic relocation should be produced
and that would simplify things and avoid functionality
correlation/duplication with 'isPicRel'.

The patch does this change.

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

llvm-svn: 329275

6 years ago[llvm-mca] Remove flag -max-retire-per-cycle, and update the docs.
Andrea Di Biagio [Thu, 5 Apr 2018 11:36:50 +0000 (11:36 +0000)]
[llvm-mca] Remove flag -max-retire-per-cycle, and update the docs.

This is done in preparation for D45259.
With D45259, models can specify the size of the reorder buffer, and the retire
throughput directly via tablegen.

llvm-svn: 329274

6 years ago[Plugins] Add a slim plugin API to work together with the new PM
Philip Pfaffe [Thu, 5 Apr 2018 11:29:37 +0000 (11:29 +0000)]
[Plugins] Add a slim plugin API to work together with the new PM

Summary:
Add a new plugin API. This closes the gap between pass registration and out-of-tree passes for the new PassManager.

Unlike with the existing API, interaction with a plugin is always
initiated from the tools perspective. I.e., when a plugin is loaded, it
resolves and calls a well-known symbol `llvmGetPassPluginInfo` to obtain
details about the plugin. The fundamental motivation is to get rid of as
many global constructors as possible.  The API exposed by the plugin
info is kept intentionally minimal.

Reviewers: chandlerc

Reviewed By: chandlerc

Subscribers: bollu, grosser, lksbhm, mgorny, llvm-commits

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

llvm-svn: 329273

6 years ago[ELF] - Reveal more information in -Map file about assignments.
George Rimar [Thu, 5 Apr 2018 11:25:58 +0000 (11:25 +0000)]
[ELF] - Reveal more information in -Map file about assignments.

Currently, LLD print symbol assignment commands to the map file,
but it does not do that for assignments that are outside of the section
descriptions. Such assignments can affect the layout though.

The patch implements the following:

* Teaches LLD to print symbol assignments outside of section declaration.
* Teaches LLD to print PROVIDE/HIDDEN/PROVIDE hidden commands.

In case when symbol is not provided, nothing will be printed.

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

llvm-svn: 329272

6 years ago[ELF] - Print LMA in a -Map file.
George Rimar [Thu, 5 Apr 2018 10:51:06 +0000 (10:51 +0000)]
[ELF] - Print LMA in a -Map file.

Currently, LLD prints VA, but not LMA in a map file.
It seems can be useful to print both to reveal layout
details and patch implements it.

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

llvm-svn: 329271

6 years ago[UpdateTestChecks] Moved core functionality of add_asm_checks into add_checks
Simon Pilgrim [Thu, 5 Apr 2018 10:48:38 +0000 (10:48 +0000)]
[UpdateTestChecks] Moved core functionality of add_asm_checks into add_checks

As discussed on D45272

llvm-svn: 329270

6 years ago[LoopInterchange] Add stats counter for number of interchanged loops.
Florian Hahn [Thu, 5 Apr 2018 10:39:23 +0000 (10:39 +0000)]
[LoopInterchange] Add stats counter for number of interchanged loops.

Reviewers: samparker, karthikthecool, blitz.opensource

Reviewed By: samparker

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

llvm-svn: 329269

6 years ago[mips] Regenerate test before posting patch for constant multiplication (NFC)
Simon Dardis [Thu, 5 Apr 2018 10:30:17 +0000 (10:30 +0000)]
[mips] Regenerate test before posting patch for constant multiplication (NFC)

llvm-svn: 329268

6 years agoallow custom OptBisect classes set to LLVMContext
Fedor Sergeev [Thu, 5 Apr 2018 10:29:37 +0000 (10:29 +0000)]
allow custom OptBisect classes set to LLVMContext

This patch introduces a way to set custom OptPassGate instances to LLVMContext.
A new instance field OptBisector and a new method setOptBisect() are added
to the LLVMContext classes. These changes allow to set a custom OptBisect class
that can make its own decisions on skipping optional passes.

Another important feature of this change is ability to set different instances
of OptPassGate to different LLVMContexts. So the different contexts can be used
independently in several compiling threads of one process.

One unit test is added.

Patch by Yevgeny Rouban.

Reviewers: andrew.w.kaylor, fedor.sergeev, vsk, dberlin, Eugene.Zelenko, reames, skatkov
Reviewed By: andrew.w.kaylor, fedor.sergeev
Differential Revision: https://reviews.llvm.org/D44464

llvm-svn: 329267

6 years ago[UpdateTestChecks] Split core functionality of add_ir_checks into add_checks
Simon Pilgrim [Thu, 5 Apr 2018 10:26:13 +0000 (10:26 +0000)]
[UpdateTestChecks] Split core functionality of add_ir_checks into add_checks

Cherry picked from D45272, also added some setup for add_asm_checks to use add_checks as well.

llvm-svn: 329266

6 years ago[UpdateTestChecks] Make add_asm_checks more like add_ir_checks
Simon Pilgrim [Thu, 5 Apr 2018 09:50:58 +0000 (09:50 +0000)]
[UpdateTestChecks] Make add_asm_checks more like add_ir_checks

Towards merging them as mentioned on D45272

llvm-svn: 329265

6 years ago[LoopInterchange] Preserve LoopInfo after interchanging.
Florian Hahn [Thu, 5 Apr 2018 09:48:45 +0000 (09:48 +0000)]
[LoopInterchange] Preserve LoopInfo after interchanging.

LoopInterchange relies on LoopInfo being up-to-date, so we should
preserve it after interchanging. This patch updates restructureLoops to
move the BBs of the interchanged loops to the right place.

Reviewers: davide, efriedma, karthikthecool, mcrosier

Reviewed By: efriedma

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

llvm-svn: 329264

6 years ago[clang-format] Preserve spaces before a percent in (text) protos
Krasimir Georgiev [Thu, 5 Apr 2018 09:33:03 +0000 (09:33 +0000)]
[clang-format] Preserve spaces before a percent in (text) protos

This makes sure that we do not change the meaning of pieces of text with
format specifiers.

llvm-svn: 329263

6 years ago[UpdateTestChecks] Remove unnecessary return from add_ir_checks
Simon Pilgrim [Thu, 5 Apr 2018 09:30:42 +0000 (09:30 +0000)]
[UpdateTestChecks] Remove unnecessary return from add_ir_checks

llvm-svn: 329262

6 years ago[llvm-exegesis] Check for libpfm headers.
Clement Courbet [Thu, 5 Apr 2018 07:35:28 +0000 (07:35 +0000)]
[llvm-exegesis] Check for libpfm headers.

HAVE_LIBPFM is only defined if the libpfm headers are present.

llvm-svn: 329261

6 years ago[MIR-Canon] Fixing warnings in Non-assert builds.
Puyan Lotfi [Thu, 5 Apr 2018 06:56:44 +0000 (06:56 +0000)]
[MIR-Canon] Fixing warnings in Non-assert builds.

llvm-svn: 329258

6 years ago[llvm-exegesis] Suppress a warning.
Clement Courbet [Thu, 5 Apr 2018 05:57:23 +0000 (05:57 +0000)]
[llvm-exegesis] Suppress a warning.

llvm-svn: 329257

6 years ago[X86] Revert r329251-329254
Craig Topper [Thu, 5 Apr 2018 05:19:36 +0000 (05:19 +0000)]
[X86] Revert r329251-329254

It's failing on the bots and I'm not sure why.

This reverts:

[X86] Synchronize the SchedRW on some EVEX instructions with their VEX equivalents.
[X86] Use WriteFShuffle256 for VEXTRACTF128 to be consistent with VEXTRACTI128 which uses WriteShuffle256.
[X86] Remove some InstRWs for plain store instructions on Sandy Bridge.
[X86] Auto-generate complete checks. NFC

llvm-svn: 329256

6 years ago[X86] Synchronize the SchedRW on some EVEX instructions with their VEX equivalents.
Craig Topper [Thu, 5 Apr 2018 04:42:03 +0000 (04:42 +0000)]
[X86] Synchronize the SchedRW on some EVEX instructions with their VEX equivalents.

Mostly vector load, store, and move instructions.

llvm-svn: 329254

6 years ago[X86] Use WriteFShuffle256 for VEXTRACTF128 to be consistent with VEXTRACTI128 which...
Craig Topper [Thu, 5 Apr 2018 04:42:02 +0000 (04:42 +0000)]
[X86] Use WriteFShuffle256 for VEXTRACTF128 to be consistent with VEXTRACTI128 which uses WriteShuffle256.

llvm-svn: 329253

6 years ago[X86] Remove some InstRWs for plain store instructions on Sandy Bridge.
Craig Topper [Thu, 5 Apr 2018 04:42:01 +0000 (04:42 +0000)]
[X86] Remove some InstRWs for plain store instructions on Sandy Bridge.

We were forcing the latency of these instructions to 5 cycles, but every other scheduler model had them as 1 cycle. I'm sure I didn't get everything, but this gets a big portion.

llvm-svn: 329252

6 years ago[X86] Auto-generate complete checks. NFC
Craig Topper [Thu, 5 Apr 2018 04:41:59 +0000 (04:41 +0000)]
[X86] Auto-generate complete checks. NFC

llvm-svn: 329251

6 years ago[CallSiteSplitting] Do not perform callsite splitting inside landing pad
Taewook Oh [Thu, 5 Apr 2018 04:16:23 +0000 (04:16 +0000)]
[CallSiteSplitting] Do not perform callsite splitting inside landing pad

Summary:
If the callsite is inside landing pad, do not perform callsite splitting.

Callsite splitting uses utility function llvm::DuplicateInstructionsInSplitBetween, which eventually calls llvm::SplitEdge. llvm::SplitEdge calls llvm::SplitCriticalEdge with an assumption that the function returns nullptr only when the target edge is not a critical edge (and further assumes that if the return value was not nullptr, the predecessor of the original target edge always has a single successor because critical edge splitting was successful). However, this assumtion is not true because SplitCriticalEdge returns nullptr if the destination block is a landing pad. This invalid assumption results assertion failure.

Fundamental solution might be fixing llvm::SplitEdge to not to rely on the invalid assumption. However, it'll involve a lot of work because current API assumes that llvm::SplitEdge never fails. Instead, this patch makes callsite splitting to not to attempt splitting if the callsite is in a landing pad.

Attached test case will crash with assertion failure without the fix.

Reviewers: fhahn, junbuml, dberlin

Subscribers: llvm-commits

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

llvm-svn: 329250

6 years ago[gold] Add debug-pass-manager option, and use it to test new-pass-manager
Teresa Johnson [Thu, 5 Apr 2018 03:16:57 +0000 (03:16 +0000)]
[gold] Add debug-pass-manager option, and use it to test new-pass-manager

Summary: Follow up from r314963.

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 329249

6 years ago[IR] Upgrade comment token in objc retain release marker
Gerolf Hoflehner [Thu, 5 Apr 2018 02:44:46 +0000 (02:44 +0000)]
[IR] Upgrade comment token in objc retain release marker

Older compiler issued '#' instead of ';'

llvm-svn: 329248

6 years agoRevert r328680 ("[ObjC] Make C++ triviality type traits available to non-trivial...
Richard Smith [Thu, 5 Apr 2018 00:34:54 +0000 (00:34 +0000)]
Revert r328680 ("[ObjC] Make C++ triviality type traits available to non-trivial C structs.")

It unintentionally caused the values of the __has_* type traits to change in
C++ for trivially-copyable classes with volatile members.

llvm-svn: 329247

6 years ago[MIR-Canon] Improving performance by switching to named vregs.
Puyan Lotfi [Thu, 5 Apr 2018 00:27:15 +0000 (00:27 +0000)]
[MIR-Canon] Improving performance by switching to named vregs.

No more skipping thounsands of vregs. Much faster running time.

llvm-svn: 329246

6 years ago[coroutines] libcxx, noop_coroutine, make bots even more happy
Gor Nishanov [Thu, 5 Apr 2018 00:18:37 +0000 (00:18 +0000)]
[coroutines] libcxx, noop_coroutine, make bots even more happy

llvm-svn: 329245

6 years ago[AST] Don't track lambda captures when checking a potential constant expression.
Erik Pilkington [Thu, 5 Apr 2018 00:12:05 +0000 (00:12 +0000)]
[AST] Don't track lambda captures when checking a potential constant expression.

Fixes PR36054.

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

llvm-svn: 329244

6 years ago[MIR-Canon] Adding support for multi-def -> user distance reduction.
Puyan Lotfi [Thu, 5 Apr 2018 00:08:15 +0000 (00:08 +0000)]
[MIR-Canon] Adding support for multi-def -> user distance reduction.

llvm-svn: 329243

6 years agoInitialize OffsetMap earlier.
Rafael Espindola [Thu, 5 Apr 2018 00:01:57 +0000 (00:01 +0000)]
Initialize OffsetMap earlier.

Now that getSectionPiece uses OffsetMap, it is advantageous to
initialize it earlier.

llvm-svn: 329242

6 years agoEnable msan unconditionally on Linux.
Evgeniy Stepanov [Wed, 4 Apr 2018 23:48:06 +0000 (23:48 +0000)]
Enable msan unconditionally on Linux.

Memory sanitizer compatibility are already done in
MemorySanitizer::doInitialization. It verifies whether the necessary offsets
exist and bails out if not. For this reason it is no good to duplicate two
checks in two projects. This patch removes clang check and postpones msan
compatibility validation till MemorySanitizer::doInitialization.

Another reason for this patch is to allow using msan with any CPU (given
compatible runtime) and custom mapping provided via the arguments added by
https://reviews.llvm.org/D44926.

Patch by vit9696.

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

llvm-svn: 329241

6 years ago[coroutines] libcxx noop_coroutine. Make bots happier
Gor Nishanov [Wed, 4 Apr 2018 23:43:50 +0000 (23:43 +0000)]
[coroutines] libcxx noop_coroutine. Make bots happier

llvm-svn: 329240

6 years ago[coroutines] Allow compilation under c++03
Gor Nishanov [Wed, 4 Apr 2018 22:51:57 +0000 (22:51 +0000)]
[coroutines] Allow compilation under c++03

llvm-svn: 329239

6 years ago[WebAssembly] Only write 32-bits for WebAssembly::OPERAND_OFFSET32
Sam Clegg [Wed, 4 Apr 2018 22:27:58 +0000 (22:27 +0000)]
[WebAssembly] Only write 32-bits for WebAssembly::OPERAND_OFFSET32

A bug was found where an offset of -1 would generate an encoding
of max int64 which is invalid in the binary format.

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

llvm-svn: 329238

6 years ago[coroutines] Add noop_coroutine to <experimental/coroutine>
Gor Nishanov [Wed, 4 Apr 2018 22:18:03 +0000 (22:18 +0000)]
[coroutines] Add noop_coroutine to <experimental/coroutine>

A recent addition to Coroutines TS (https://wg21.link/p0913) adds a pre-defined
coroutine noop_coroutine that does nothing.

This patch implements require library types in <experimental/coroutine>

Related clang and llvm patches:

https://reviews.llvm.org/D45114
https://reviews.llvm.org/D45120

llvm-svn: 329237

6 years agoAArch64: Implement support for the shadowcallstack attribute.
Peter Collingbourne [Wed, 4 Apr 2018 21:55:44 +0000 (21:55 +0000)]
AArch64: Implement support for the shadowcallstack attribute.

The implementation of shadow call stack on aarch64 is quite different to
the implementation on x86_64. Instead of reserving a segment register for
the shadow call stack, we reserve the platform register, x18. Any function
that spills lr to sp also spills it to the shadow call stack, a pointer to
which is stored in x18.

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

llvm-svn: 329236

6 years agoDon't inline @llvm.icall.branch.funnel
Vitaly Buka [Wed, 4 Apr 2018 21:46:27 +0000 (21:46 +0000)]
Don't inline @llvm.icall.branch.funnel

Summary: @llvm.icall.branch.funnel is musttail with variable number of
arguments. After inlining current backend can't separate call targets from call
arguments.

Reviewers: pcc

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 329235