platform/upstream/llvm.git
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

6 years ago[Driver] Include the Android multiarch includes.
Dan Albert [Wed, 4 Apr 2018 21:28:34 +0000 (21:28 +0000)]
[Driver] Include the Android multiarch includes.

Summary:
Most Android headers live in a single directory, but a small handful
live in multiarch directories.

Reviewers: srhines

Reviewed By: srhines

Subscribers: javed.absar, cfe-commits

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

llvm-svn: 329234

6 years agoDo not show alignment 0 because that is equivalent to 1.
Rui Ueyama [Wed, 4 Apr 2018 21:25:37 +0000 (21:25 +0000)]
Do not show alignment 0 because that is equivalent to 1.

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

llvm-svn: 329233

6 years ago[CUDA] Add amdgpu sub archs
Yaxun Liu [Wed, 4 Apr 2018 21:19:27 +0000 (21:19 +0000)]
[CUDA] Add amdgpu sub archs

Patch by Greg Rodgers.
Revised and lit tests added by Yaxun Liu.

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

llvm-svn: 329232

6 years ago[clang-format] In tests, expected code should be format-stable
Mark Zeren [Wed, 4 Apr 2018 21:09:00 +0000 (21:09 +0000)]
[clang-format] In tests, expected code should be format-stable

Summary: Extend various verifyFormat helper functions to check that the
expected text is "stable". This provides some protection against bugs
where formatting results are ocilating between two forms, or continually
change in some other way.

Testing Done:

* Ran unit tests.

* Reproduced a known instability in preprocessor indentation which was
  caught by this new check.

Reviewers: krasimir

Subscribers: cfe-commits

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

llvm-svn: 329231

6 years ago[MemorySSA] Fix spelling errors in MemorySSA.cpp. NFC
Zhaoshi Zheng [Wed, 4 Apr 2018 21:08:11 +0000 (21:08 +0000)]
[MemorySSA] Fix spelling errors in MemorySSA.cpp. NFC

llvm-svn: 329230

6 years agoRevert "[CUDA] Check initializers of instantiated template variables."
Artem Belevich [Wed, 4 Apr 2018 20:48:42 +0000 (20:48 +0000)]
Revert "[CUDA] Check initializers of instantiated template variables."

This (temporarily) reverts commit r329127 due to the problems
it exposed in TensorFlow.

llvm-svn: 329229

6 years agohwasan: add -hwasan-match-all-tag flag
Evgeniy Stepanov [Wed, 4 Apr 2018 20:44:59 +0000 (20:44 +0000)]
hwasan: add -hwasan-match-all-tag flag

Sometimes instead of storing addresses as is, the kernel stores the address of
a page and an offset within that page, and then computes the actual address
when it needs to make an access. Because of this the pointer tag gets lost
(gets set to 0xff). The solution is to ignore all accesses tagged with 0xff.

This patch adds a -hwasan-match-all-tag flag to hwasan, which allows to ignore
accesses through pointers with a particular pointer tag value for validity.

Patch by Andrey Konovalov.

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

llvm-svn: 329228

6 years agoCOFF: Sort non-discardable sections at the same time as other sections. NFC.
Peter Collingbourne [Wed, 4 Apr 2018 20:30:37 +0000 (20:30 +0000)]
COFF: Sort non-discardable sections at the same time as other sections. NFC.

This makes the sort order a little clearer.

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

llvm-svn: 329227

6 years ago[asan] Fix aligned_alloc test case
Kostya Kortchinsky [Wed, 4 Apr 2018 20:03:16 +0000 (20:03 +0000)]
[asan] Fix aligned_alloc test case

Summary:
Under some circumstances (that I haven't dug further into), the first stack
frame for the test looks like:
`#0 0x4e6038 in __interceptor_memalign.localalias.1 ...compiler-rt/lib/asan/asan_malloc_linux.cc:113`
which isn't matched by the current CHECK.

Expand the CHECK to match aligned_alloc or memalign. Hopefully this should fix
the PowerPC issue as well, otherwise we'll bring back the FIXME.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 329226

6 years ago[analyzer][test] Set C++14 as language standard for test depending on new
Jan Korous [Wed, 4 Apr 2018 19:58:48 +0000 (19:58 +0000)]
[analyzer][test] Set C++14 as language standard for test depending on new
features

llvm-svn: 329225

6 years agoFix the test some more after r329221
Hans Wennborg [Wed, 4 Apr 2018 19:55:45 +0000 (19:55 +0000)]
Fix the test some more after r329221

llvm-svn: 329224

6 years agoFixes errors with FS iterators caused by https://reviews.llvm.org/D44960
Max Moroz [Wed, 4 Apr 2018 19:47:25 +0000 (19:47 +0000)]
Fixes errors with FS iterators caused by https://reviews.llvm.org/D44960

Summary:
In https://reviews.llvm.org/D44960, file status check is executed every
time a real file system directory iterator is constructed or
incremented, and emits an error code. This change list fixes the errors
in VirtualFileSystem caused by https://reviews.llvm.org/D44960.

Patch by Yuke Liao (@liaoyuke).

Reviewers: vsk, pcc, zturner, liaoyuke

Reviewed By: vsk

Subscribers: mgrang, cfe-commits

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

llvm-svn: 329223

6 years agoFix test after r329221
Hans Wennborg [Wed, 4 Apr 2018 19:36:27 +0000 (19:36 +0000)]
Fix test after r329221

It seems I accidentally overspecified the section size in my previous
commit, whereas it was previously carefully left out.

llvm-svn: 329222

6 years agoCOFF: Layout sections in the same order as link.exe
Hans Wennborg [Wed, 4 Apr 2018 19:15:55 +0000 (19:15 +0000)]
COFF: Layout sections in the same order as link.exe

One place where this seems to matter is to make sure the .rsrc section comes
after .text. The Win32 UpdateResource() function can change the contents of
.rsrc. It will move the sections that come after, but if .text gets moved, the
entry point header will not get updated and the executable breaks. This was
found by a test in Chromium.

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

llvm-svn: 329221

6 years ago[MachineOutliner] Add `useMachineOutliner` target hook
Jessica Paquette [Wed, 4 Apr 2018 19:13:31 +0000 (19:13 +0000)]
[MachineOutliner] Add `useMachineOutliner` target hook

The MachineOutliner has a bunch of target hooks that will call llvm_unreachable
if the target doesn't implement them. Therefore, if you enable the outliner on
such a target, it'll just crash. It'd be much better if it'd just *not* run
the outliner at all in this case.

This commit adds a hook to TargetInstrInfo that returns false by default.
Targets that implement the hook make it return true. The outliner checks the
return value of this hook to decide whether or not to continue.

llvm-svn: 329220

6 years agoDon't ignore addend in getOffset.
Rafael Espindola [Wed, 4 Apr 2018 19:13:30 +0000 (19:13 +0000)]
Don't ignore addend in getOffset.

We were ignoring the addend if the piece was dead. I don't expect this
to make a difference in any real world situations, but it is simpler
anyway.

llvm-svn: 329219

6 years ago[Analysis] Support aligned new/delete functions.
Eric Fiselier [Wed, 4 Apr 2018 19:01:51 +0000 (19:01 +0000)]
[Analysis] Support aligned new/delete functions.

Summary:
Clang's __builtin_operator_new/delete was recently taught about the aligned allocation overloads (r328134). This patch makes LLVM aware of them as well.
This allows the compiler to perform certain optimizations including eliding new/delete calls.

Reviewers: rsmith, majnemer, dblaikie, vsk, bkramer

Reviewed By: bkramer

Subscribers: ckennelly, llvm-commits

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

llvm-svn: 329218

6 years agoRevert "[Analysis] Support aligned new/delete functions."
Eric Fiselier [Wed, 4 Apr 2018 18:23:00 +0000 (18:23 +0000)]
Revert "[Analysis] Support aligned new/delete functions."

This reverts commit bee3bbd9bdd3ab3364b8fb0cdb6326bc1ae740e0.

llvm-svn: 329217

6 years ago[AArch64] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Wed, 4 Apr 2018 18:20:28 +0000 (18:20 +0000)]
[AArch64] 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, jmolloy, RKSimon, rengolin

Reviewed By: rengolin

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

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

llvm-svn: 329216

6 years ago[Analysis] Support aligned new/delete functions.
Eric Fiselier [Wed, 4 Apr 2018 18:12:01 +0000 (18:12 +0000)]
[Analysis] Support aligned new/delete functions.

Summary:
Clang's __builtin_operator_new/delete was recently taught about the aligned allocation overloads (r328134). This patch makes LLVM aware of them as well.
This allows the compiler to perform certain optimizations including eliding new/delete calls.

Reviewers: rsmith, majnemer, dblaikie, vsk, bkramer

Reviewed By: bkramer

Subscribers: ckennelly, llvm-commits

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

llvm-svn: 329215

6 years ago[Polly][IslAst] Fix minimal dependence distance.
Huihui Zhang [Wed, 4 Apr 2018 18:08:13 +0000 (18:08 +0000)]
[Polly][IslAst] Fix minimal dependence distance.

Summary:
When checking the parallelism of a scheduling dimension, we first check if excluding reduction dependences the loop is parallel or not.
If the loop is not parallel, then we need to return the minimal dependence distance of all data dependences, including the previously subtracted reduction dependences.

Reviewers: grosser, Meinersbur, efriedma, eli.friedman, jdoerfert, bollu

Reviewed By: Meinersbur

Subscribers: llvm-commits, pollydev

Tags: #polly

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

llvm-svn: 329214

6 years ago[MachineOutliner] Fix typo; NFC
Jessica Paquette [Wed, 4 Apr 2018 18:07:07 +0000 (18:07 +0000)]
[MachineOutliner] Fix typo; NFC

There was a typo in an unreachable statement in one of the outliner target
hooks.

llvm-svn: 329213

6 years ago[CMake] Support for monorepo layout
Petr Hosek [Wed, 4 Apr 2018 17:57:15 +0000 (17:57 +0000)]
[CMake] Support for monorepo layout

Support finding libcxx sources in monorepo style layout.

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

llvm-svn: 329212

6 years ago[X86] Separate BSWAP32r and BSWAP64r scheduling data in SandyBridge/Haswell/Broadwell...
Craig Topper [Wed, 4 Apr 2018 17:54:19 +0000 (17:54 +0000)]
[X86] Separate BSWAP32r and BSWAP64r scheduling data in SandyBridge/Haswell/Broadwell/Skylake scheduler models.

The BSWAP64r version is 2 uops and BSWAP32r is only 1 uop. The regular expressions also looked for a non-existant BSWAP16r.

llvm-svn: 329211

6 years agoAdd simple runtime tests for shadowcallstack
Vlad Tsyrklevich [Wed, 4 Apr 2018 17:53:33 +0000 (17:53 +0000)]
Add simple runtime tests for shadowcallstack

Summary:
ShadowCallStack does not yet have a runtime provided by compiler-rt, but
this change includes simple tests that make use of a very minimal
runtime in test/shadowcallstack/minimal_runtime.h

Reviewers: pcc, kcc, delcypher, eugenis, filcab

Reviewed By: pcc

Subscribers: kubamracek, mgorny, delcypher, llvm-commits, #sanitizers, kcc

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

llvm-svn: 329210

6 years agoFix a compilation failure with non MSVC compilers.
Zachary Turner [Wed, 4 Apr 2018 17:41:05 +0000 (17:41 +0000)]
Fix a compilation failure with non MSVC compilers.

llvm-svn: 329209

6 years ago[CMake] Support for monorepo layout
Petr Hosek [Wed, 4 Apr 2018 17:40:59 +0000 (17:40 +0000)]
[CMake] Support for monorepo layout

Support finding libcxx and libunwind sources in monorepo style layout.

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

llvm-svn: 329208

6 years ago[llvm-pdbutil] Add the ability to explain binary files.
Zachary Turner [Wed, 4 Apr 2018 17:29:09 +0000 (17:29 +0000)]
[llvm-pdbutil] Add the ability to explain binary files.

Using this, you can use llvm-pdbutil to export the contents of a
stream to a binary file, then run explain on the binary file so
that it treats the offset as an offset into the stream instead
of an offset into a file.  This makes it easy to compare the
contents of the same stream from two different files.

llvm-svn: 329207

6 years ago[Power9]Legalize and emit code for quad-precision fma instructions
Lei Huang [Wed, 4 Apr 2018 16:43:50 +0000 (16:43 +0000)]
[Power9]Legalize and emit code for quad-precision fma instructions

Legalize and emit code for the following quad-precision fma:

  * xsmaddqp
  * xsnmaddqp
  * xsmsubqp
  * xsnmsubqp

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

llvm-svn: 329206

6 years ago[CMake] Support statically linked libc++abi and libunwind
Petr Hosek [Wed, 4 Apr 2018 16:27:33 +0000 (16:27 +0000)]
[CMake] Support statically linked libc++abi and libunwind

This expands the CMake check to handle both statically and dynamically
linked version of libc++abi and libunwind and matches the implemnetation
used elsewhere in LLVM.

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

llvm-svn: 329205

6 years ago[sanitizer] Split stacktrace/symbolizer: Windows unwind
Kostya Kortchinsky [Wed, 4 Apr 2018 15:23:30 +0000 (15:23 +0000)]
[sanitizer] Split stacktrace/symbolizer: Windows unwind

Summary:
The purpose of this set of changes is to separate stackframe/symbolizer support into their own RT within sanitizer_common.
Sanitizers with no use for those could then be built without the extraneous dependencies pulled in by the default visibility interface functions.
I am aiming to do small changes for specific platforms.

In this one, we split the unwind functions from sanitizer_win.cc into their own sanitizer_unwind_win.cc.

Reviewers: alekseyshl, rnk

Reviewed By: alekseyshl, rnk

Subscribers: delcypher, #sanitizers, kubamracek, mgorny, llvm-commits

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

llvm-svn: 329204

6 years ago[ELF] - X86_64: Use white list for relocations checked by isPicRel.
George Rimar [Wed, 4 Apr 2018 15:21:21 +0000 (15:21 +0000)]
[ELF] - X86_64: Use white list for relocations checked by isPicRel.

isPicRel is used to check if we want to create the dynamic relocations.
Not all of the dynamic relocations we create are passing through this
check, but those that are, probably better be whitelisted.

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

llvm-svn: 329203

6 years agoFix build breakage from r329201
Pavel Labath [Wed, 4 Apr 2018 14:54:08 +0000 (14:54 +0000)]
Fix build breakage from r329201

Some compilers do not like having an enum type and a variable with the
same name (AccelTableKind). I rename the variable to TheAccelTableKind.

Suggestions for a better name welcome.

llvm-svn: 329202

6 years agoRe-commit r329179 after fixing build&test issues
Pavel Labath [Wed, 4 Apr 2018 14:42:14 +0000 (14:42 +0000)]
Re-commit r329179 after fixing build&test issues

- MSVC was not OK with a static_assert referencing a non-static member
  variable, even though it was just in a sizeof(expression). I move the
  assert into the emit function, where it is probably more useful.
- Tests were failing in builds which did not have the X86 target
  configured. Since this functionality is not target-specific, I have
  removed the target specifiers from the .ll files.

llvm-svn: 329201

6 years ago[llvm-exegesis] Temporarily disable a few tests.
Clement Courbet [Wed, 4 Apr 2018 14:32:09 +0000 (14:32 +0000)]
[llvm-exegesis] Temporarily disable a few tests.

These are failing on clang-ppc64le-linux-lnt, though the subdirectory is
not even supposed to be built in CMakeLists. Disable the tests until we
understand what's going on.

llvm-svn: 329200

6 years ago[libcxx][test] Fix fs::proximate tests on platforms where /net exists.
Jan Korous [Wed, 4 Apr 2018 14:23:51 +0000 (14:23 +0000)]
[libcxx][test] Fix fs::proximate tests on platforms where /net exists.

Following Eric's patch.

llvm-svn: 329199

6 years ago[InstCombine] [NFC] Add tests for getting rid of select of bittest (PR36950 / PR17564)
Roman Lebedev [Wed, 4 Apr 2018 14:10:13 +0000 (14:10 +0000)]
[InstCombine] [NFC] Add tests for getting rid of select of bittest (PR36950 / PR17564)

Summary: See [[ https://bugs.llvm.org/show_bug.cgi?id=36950 | PR36950 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=17564 | PR17564 ]], D45065, D45108

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 329198

6 years ago[AMDGPU][MC] Enabled instruction TBUFFER_LOAD_FORMAT_XYZ for SI/CI
Dmitry Preobrazhensky [Wed, 4 Apr 2018 13:54:55 +0000 (13:54 +0000)]
[AMDGPU][MC] Enabled instruction TBUFFER_LOAD_FORMAT_XYZ for SI/CI

See bug 36958: https://bugs.llvm.org/show_bug.cgi?id=36958

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

Reviewers: artem.tamazov, arsenm, timcorringham
llvm-svn: 329197

6 years ago[SLPVectorizer][X86] Regenerate some tests. NFCI
Simon Pilgrim [Wed, 4 Apr 2018 13:53:51 +0000 (13:53 +0000)]
[SLPVectorizer][X86] Regenerate some tests. NFCI

llvm-svn: 329196