platform/upstream/llvm.git
6 years ago[DebugInfo] Use WithColor to print errors/warnings
Jonas Devlieghere [Sat, 14 Apr 2018 22:07:23 +0000 (22:07 +0000)]
[DebugInfo] Use WithColor to print errors/warnings

Use the convenience methods from WithColor to consistently print errors
and warnings in libDebugInfo.

llvm-svn: 330092

6 years ago[Support] Add convenience functions to WithColor. NFC.
Jonas Devlieghere [Sat, 14 Apr 2018 21:36:42 +0000 (21:36 +0000)]
[Support] Add convenience functions to WithColor. NFC.

Create convenience functions for printing error, warning and note to
stdout. Previously we had similar functions being used in dsymutil, but
given that this pattern is so common it makes sense to make it available
globally.

llvm-svn: 330091

6 years ago[X86] Tests for unsigned saturation downconvert detection.
Artur Gainullin [Sat, 14 Apr 2018 20:10:17 +0000 (20:10 +0000)]
[X86] Tests for unsigned saturation downconvert detection.

One more test for smax(smin(x, C2), C1) pattern.

llvm-svn: 330090

6 years ago[InstCombine] Enable Add/Sub simplifications with only 'reassoc' FMF
Warren Ristow [Sat, 14 Apr 2018 19:18:28 +0000 (19:18 +0000)]
[InstCombine] Enable Add/Sub simplifications with only 'reassoc' FMF

These simplifications were previously enabled only with isFast(), but that
is more restrictive than required. Since r317488, FMF has 'reassoc' to
control these cases at a finer level.

llvm-svn: 330089

6 years ago[X86] Tests for unsigned saturation downconvert detection.
Artur Gainullin [Sat, 14 Apr 2018 19:09:02 +0000 (19:09 +0000)]
[X86] Tests for unsigned saturation downconvert detection.

llvm-svn: 330088

6 years ago[clangd] Fix label and snippet for funcs in the index
Ilya Biryukov [Sat, 14 Apr 2018 16:27:35 +0000 (16:27 +0000)]
[clangd] Fix label and snippet for funcs in the index

This is a follow-up to r330004 to fix functions with required template args,
e.g. std::make_shared.

llvm-svn: 330087

6 years ago[InstCombine] add shift+logic tests (PR37098); NFC
Sanjay Patel [Sat, 14 Apr 2018 13:39:02 +0000 (13:39 +0000)]
[InstCombine] add shift+logic tests (PR37098); NFC

It debateable whether instcombine should be in the business of
reassociation, but it is currently.

These tests and PR37098 demonstrate a missing ability to do a
simple reassociation that allows eliminating shifts.

If we decide that functionality belongs somewhere else, then we
should still have some tests to show that we've intentionally
limited instcombine to *not* include this ability.

llvm-svn: 330086

6 years ago[X86][MMX] Set PAVG/PHADD/PMIN/PMAX/PSIGN instructions to use same scheduler classes...
Simon Pilgrim [Sat, 14 Apr 2018 13:06:38 +0000 (13:06 +0000)]
[X86][MMX] Set PAVG/PHADD/PMIN/PMAX/PSIGN instructions to use same scheduler classes as SSE/AVX

llvm-svn: 330085

6 years agoReapply "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit".
Jan Kratochvil [Sat, 14 Apr 2018 11:12:52 +0000 (11:12 +0000)]
Reapply "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit".

This patch by Greg Clayton drops the virtualization for DWARFPartialUnit.
The virtualization of DWARFUnit now matches more its LLVM counterpart.
DWZ patchset is going to be implementable without DWARFPartialUnit remapping.
https://reviews.llvm.org/D40474

This reverts commit 329423.
This reapplies commit r329305.

llvm-svn: 330084

6 years ago[NFC] fix trivial typos in document and comments
Hiroshi Inoue [Sat, 14 Apr 2018 08:59:00 +0000 (08:59 +0000)]
[NFC] fix trivial typos in document and comments

"not not" -> "not" etc

llvm-svn: 330083

6 years ago[AMDGPU] Add gfx902 product names
Tony Tye [Sat, 14 Apr 2018 01:58:10 +0000 (01:58 +0000)]
[AMDGPU] Add gfx902 product names

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

llvm-svn: 330081

6 years agoRevert "[Serialization] Fix some Clang-tidy modernize and Include What You Use warnin...
Vedant Kumar [Sat, 14 Apr 2018 01:40:48 +0000 (01:40 +0000)]
Revert "[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC)."

This reverts commit r330068. It breaks the lldb bots due to assertion
failures (more details on cfe-commits).

http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/
http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/6341/

stderr: Assertion failed: (M && "imported decl from no module file"), function loadPendingDeclChain, file /Users/vsk/src/llvm.org-lldbsan/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp, line 3861.
llvm-svn: 330080

6 years ago[WebAssembly] Fix a bug in MachineBasicBlock::findDebugLoc() call
Heejin Ahn [Sat, 14 Apr 2018 00:12:12 +0000 (00:12 +0000)]
[WebAssembly] Fix a bug in MachineBasicBlock::findDebugLoc() call

Summary:
InsertPos is within the bacic block `Header`, so `findDebugLoc()` should
be called on not `MBB` but `Header` instead.

Reviewers: yurydelendik

Subscribers: jfb, dschuff, aprantl, sbc100, jgravelle-google, sunfish, JDevlieghere, llvm-commits

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

llvm-svn: 330079

6 years ago[X86] Add the bizarro movsww and movzww mnemonics for the disassembler.
Craig Topper [Fri, 13 Apr 2018 23:57:54 +0000 (23:57 +0000)]
[X86] Add the bizarro movsww and movzww mnemonics for the disassembler.

The destination size of the movzx/movsx instruction is controlled by the normal operand size mechanisms. Only the input type is fixed.

This means that a 0x66 prefix on the encoding for zext/sext 16->32 should really produce a 16->16 instruction. Functionally this is equivalent to a GR16->GR16 move since bits 16 and above will be preserved. So nothing is actually extended.

llvm-svn: 330078

6 years ago[Driver] Export profiling symbols for -exported_symbols_list
Vedant Kumar [Fri, 13 Apr 2018 23:43:59 +0000 (23:43 +0000)]
[Driver] Export profiling symbols for -exported_symbols_list

When profiling is enabled and -exported_symbols_list is specified for
the Darwin linker, export the requisite set of profiling symbols.

rdar://39427167

llvm-svn: 330077

6 years ago[Fuzzer] Avoid C++ compiler checks for fuzzer C++ library
Petr Hosek [Fri, 13 Apr 2018 23:05:14 +0000 (23:05 +0000)]
[Fuzzer] Avoid C++ compiler checks for fuzzer C++ library

When bulding libFuzzer as part of the toolchain, C++ library may not
have been fully built yet so the C++ compiler checks will fail, but we
don't care since we don't need C++ library anyway as we're building
our own.

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

llvm-svn: 330075

6 years ago[ODRHash] Support pointer and reference types.
Richard Trieu [Fri, 13 Apr 2018 22:34:43 +0000 (22:34 +0000)]
[ODRHash] Support pointer and reference types.

Recommit r328404 which was reverted in rL328404.  r329869 fixed the issue that
caused the revert.

llvm-svn: 330074

6 years agoMachO: trap unreachable instructions
Tim Northover [Fri, 13 Apr 2018 22:25:20 +0000 (22:25 +0000)]
MachO: trap unreachable instructions

Debugability is more important than saving 4 bytes to let us to fall
through to nonense.

llvm-svn: 330073

6 years ago[InstCombine][NFC] masked-merge: add 'and' tests, too.
Roman Lebedev [Fri, 13 Apr 2018 21:57:01 +0000 (21:57 +0000)]
[InstCombine][NFC] masked-merge: add 'and' tests, too.

(and plain 'or', for completeness sake.)

After submitting D45631, i have realized that it will *already*
affect 'and' pattern, and it was obvious that there were no
good test patterns to show that.

Since the masked-merge.ll is getting kinda big,
unify naming schemes a bit, and split into 'xor'/'and'/'or'
testfiles, with the only difference being the last operation.

llvm-svn: 330072

6 years agoRevert "[debugserver] Remove dead function call. NFCI."
Davide Italiano [Fri, 13 Apr 2018 21:26:32 +0000 (21:26 +0000)]
Revert "[debugserver] Remove dead function call. NFCI."

This reverts commit r330066 as it was wrong and the call was
not dead. Thanks to Fred for pointing this out.

llvm-svn: 330071

6 years ago[DebugInfo][OPT] NFC follow-up on "Fixing a couple of DI duplication bugs of CloneModule"
Roman Tereshin [Fri, 13 Apr 2018 21:23:11 +0000 (21:23 +0000)]
[DebugInfo][OPT] NFC follow-up on "Fixing a couple of DI duplication bugs of CloneModule"

llvm-svn: 330070

6 years ago[DebugInfo][OPT] Fixing a couple of DI duplication bugs of CloneModule
Roman Tereshin [Fri, 13 Apr 2018 21:22:24 +0000 (21:22 +0000)]
[DebugInfo][OPT] Fixing a couple of DI duplication bugs of CloneModule

As demonstrated by the regression tests added in this patch, the
following cases are valid cases:

1. A Function with no DISubprogram attached, but various debug info
  related to its instructions, coming, for instance, from an inlined
  function, also defined somewhere else in the same module;
2. ... or coming exclusively from the functions inlined and eliminated
  from the module entirely.

The ValueMap shared between CloneFunctionInto calls within CloneModule
needs to contain identity mappings for all of the DISubprogram's to
prevent them from being duplicated by MapMetadata / RemapInstruction
calls, this is achieved via DebugInfoFinder collecting all the
DISubprogram's. However, CloneFunctionInto was missing calls into
DebugInfoFinder for functions w/o DISubprogram's attached, but still
referring DISubprogram's from within (case 1). This patch fixes that.

The fix above, however, exposes another issue: if a module contains a
DISubprogram referenced only indirectly from other debug info
metadata, but not attached to any Function defined within the module
(case 2), cloning such a module causes a DICompileUnit duplication: it
will be moved in indirecty via a DISubprogram by DebugInfoFinder first
(because of the first bug fix described above), without being
self-mapped within the shared ValueMap, and then will be copied during
named metadata cloning. So this patch makes sure DebugInfoFinder
visits DICompileUnit's referenced from DISubprogram's as it goes w/o
re-processing llvm.dbg.cu list over and over again for every function
cloned, and makes sure that CloneFunctionInto self-maps
DICompileUnit's referenced from the entire function, not just its own
DISubprogram attached that may also be missing.

The most convenient way of tesing CloneModule I found is to rely on
CloneModule call from `opt -run-twice`, instead of writing tedious
unit tests. That feature has a couple of properties that makes it hard
to use for this purpose though:

1. CloneModule doesn't copy source filename, making `opt -run-twice`
  report it as a difference.
2. `opt -run-twice` does the second run on the original module, not
  its clone, making the result of cloning completely invisible in opt's
  actual output with and without `-run-twice` both, which directly
  contradicts `opt -run-twice`s own error message.

This patch fixes this as well.

Reviewed By: aprantl

Reviewers: loladiro, GorNishanov, espindola, echristo, dexonsmith

Subscribers: vsk, debug-info, JDevlieghere, llvm-commits

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

llvm-svn: 330069

6 years ago[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings;...
Eugene Zelenko [Fri, 13 Apr 2018 21:12:33 +0000 (21:12 +0000)]
[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 330068

6 years agoUse InitLLVM in clang as well.
Rui Ueyama [Fri, 13 Apr 2018 20:57:57 +0000 (20:57 +0000)]
Use InitLLVM in clang as well.

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

llvm-svn: 330067

6 years ago[debugserver] Remove dead function call. NFCI.
Davide Italiano [Fri, 13 Apr 2018 20:47:25 +0000 (20:47 +0000)]
[debugserver] Remove dead function call. NFCI.

llvm-svn: 330066

6 years ago[Hexagon] Initial instruction cost model for auto-vectorization
Krzysztof Parzyszek [Fri, 13 Apr 2018 20:46:50 +0000 (20:46 +0000)]
[Hexagon] Initial instruction cost model for auto-vectorization

llvm-svn: 330065

6 years ago[Analyzer] Fix for SValBuilder expressions rearrangement
Adam Balogh [Fri, 13 Apr 2018 20:23:02 +0000 (20:23 +0000)]
[Analyzer] Fix for SValBuilder expressions rearrangement

Expression rearrangement in SValBuilder (see rL329780) crashes with an assert if the type of the integer is different from the type of the symbol. This fix adds a check that prevents rearrangement in such cases.

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

llvm-svn: 330064

6 years agoRevert r329956, "AArch64: Introduce a DAG combine for folding offsets into addresses."
Peter Collingbourne [Fri, 13 Apr 2018 20:21:00 +0000 (20:21 +0000)]
Revert r329956, "AArch64: Introduce a DAG combine for folding offsets into addresses."

Caused a hang and eventually an assertion failure in LTO builds
of 7zip-benchmark on aarch64 iOS targets.
http://green.lab.llvm.org/green/job/lnt-ctmark-aarch64-O3-flto/2024/

llvm-svn: 330063

6 years ago[LV] Introduce TTI::getMinimumVF
Krzysztof Parzyszek [Fri, 13 Apr 2018 20:16:32 +0000 (20:16 +0000)]
[LV] Introduce TTI::getMinimumVF

The function getMinimumVF(ElemWidth) will return the minimum VF for
a vector with elements of size ElemWidth bits. This value will only
apply to targets for which TTI::shouldMaximizeVectorBandwidth returns
true. The value of 0 indicates that there is no minimum VF.

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

llvm-svn: 330062

6 years ago[DebugInfo] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Fri, 13 Apr 2018 19:50:51 +0000 (19:50 +0000)]
[DebugInfo] Change std::sort to llvm::sort in response to r327219

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.

llvm-svn: 330061

6 years ago[Power9] Add the TLS store instructions to the Power 9 model
Stefan Pintilie [Fri, 13 Apr 2018 19:49:58 +0000 (19:49 +0000)]
[Power9] Add the TLS store instructions to the Power 9 model

The Power 9 scheduler model should now include the TLS instructions.
We can now, once again, mark the model as complete.
From now on, if instructions are added to Power 9 but are not
added to the model the build should produce an error. Hopefully
that will alert the developer who is adding new instructions
that they should also be added to the scheulder model.

llvm-svn: 330060

6 years ago[Transforms] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Fri, 13 Apr 2018 19:47:57 +0000 (19:47 +0000)]
[Transforms] 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: kcc, pcc, danielcdh, jmolloy, sanjoy, dberlin, ruiu

Reviewed By: ruiu

Subscribers: ruiu, llvm-commits

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

llvm-svn: 330059

6 years ago[MC] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Fri, 13 Apr 2018 19:47:01 +0000 (19:47 +0000)]
[MC] 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: grosbach, void, ruiu

Reviewed By: ruiu

Subscribers: llvm-commits

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

llvm-svn: 330058

6 years ago[ProfileData] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Fri, 13 Apr 2018 19:46:36 +0000 (19:46 +0000)]
[ProfileData] 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: bogner, vsk, eraman, ruiu

Reviewed By: ruiu

Subscribers: ruiu, llvm-commits

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

llvm-svn: 330057

6 years ago[CostModel][X86] Add some specific cpu targets to the cost models
Simon Pilgrim [Fri, 13 Apr 2018 19:30:15 +0000 (19:30 +0000)]
[CostModel][X86] Add some specific cpu targets to the cost models

We're mostly testing with generic isa attributes, but PR36550 will require testing of specific target's scheduler models as well.

llvm-svn: 330056

6 years ago[sanitizer] Allow for the allocator "names" to be set by the tools
Kostya Kortchinsky [Fri, 13 Apr 2018 19:21:27 +0000 (19:21 +0000)]
[sanitizer] Allow for the allocator "names" to be set by the tools

Summary:
In the same spirit of SanitizerToolName, allow the Primary & Secondary
allocators to have names that can be set by the tools via PrimaryAllocatorName
and SecondaryAllocatorName.

Additionally, set a non-default name for Scudo.

Reviewers: alekseyshl, vitalybuka

Reviewed By: alekseyshl, vitalybuka

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

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

llvm-svn: 330055

6 years ago[CostModel][X86] Split fma arith costs tests from other fp tests
Simon Pilgrim [Fri, 13 Apr 2018 19:12:32 +0000 (19:12 +0000)]
[CostModel][X86] Split fma arith costs tests from other fp tests

Was proving cumbersome to test with/without fma

llvm-svn: 330054

6 years ago[LTO] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Fri, 13 Apr 2018 19:12:20 +0000 (19:12 +0000)]
[LTO] 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 D44363 for a list of all the required patches.

Reviewers: pcc, mehdi_amini, ruiu

Reviewed By: ruiu

Subscribers: ruiu, inglorion, eraman, llvm-commits

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

llvm-svn: 330053

6 years ago[CostModel][X86] Regenerate latency/codesize cost tests
Simon Pilgrim [Fri, 13 Apr 2018 18:56:58 +0000 (18:56 +0000)]
[CostModel][X86] Regenerate latency/codesize cost tests

llvm-svn: 330052

6 years ago[CostModel][X86] Regenerate cast conversion cost tests
Simon Pilgrim [Fri, 13 Apr 2018 18:56:05 +0000 (18:56 +0000)]
[CostModel][X86] Regenerate cast conversion cost tests

llvm-svn: 330051

6 years ago[CostModel][X86] Regenerate masked intrinsic cost tests
Simon Pilgrim [Fri, 13 Apr 2018 18:54:16 +0000 (18:54 +0000)]
[CostModel][X86] Regenerate masked intrinsic cost tests

llvm-svn: 330050

6 years ago[sanitizer] Fix __sanitizer::Vector::Resize vector
Vitaly Buka [Fri, 13 Apr 2018 18:41:52 +0000 (18:41 +0000)]
[sanitizer] Fix __sanitizer::Vector::Resize vector

Implemented downsizing

Patch by Oleg Doronin

Reviewers: kcc, vitalybuka

Reviewed By: kcc, vitalybuka

Subscribers: llvm-commits

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

llvm-svn: 330049

6 years ago[sanitizer] Replace cast with unsigned literals in tests
Vitaly Buka [Fri, 13 Apr 2018 18:41:41 +0000 (18:41 +0000)]
[sanitizer] Replace cast with unsigned literals in tests

llvm-svn: 330048

6 years ago[Command] Simplify the code and make it less error prone. NFCI.
Davide Italiano [Fri, 13 Apr 2018 18:37:14 +0000 (18:37 +0000)]
[Command] Simplify the code and make it less error prone. NFCI.

Pointed out by Jim.

llvm-svn: 330047

6 years agoDefine InitLLVM to do common initialization all at once.
Rui Ueyama [Fri, 13 Apr 2018 18:26:06 +0000 (18:26 +0000)]
Define InitLLVM to do common initialization all at once.

We have a few functions that virtually all command wants to run on
process startup/shutdown. This patch adds InitLLVM class to do that
all at once, so that we don't need to copy-n-paste boilerplate code
to each llvm command's main() function.

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

llvm-svn: 330046

6 years agosupport: add missing locale stubs for android L, M
Saleem Abdulrasool [Fri, 13 Apr 2018 18:14:57 +0000 (18:14 +0000)]
support: add missing locale stubs for android L, M

The strto* family was introduced in android O (API Level 26).  However,
the support headers were adjusted to indicate that all locale aware
functions were added in L.  Provide stubs for the locale aware strto*
family until O.

llvm-svn: 330045

6 years agohwasan: add -fsanitize=kernel-hwaddress flag
Andrey Konovalov [Fri, 13 Apr 2018 18:05:21 +0000 (18:05 +0000)]
hwasan: add -fsanitize=kernel-hwaddress flag

This patch adds -fsanitize=kernel-hwaddress flag, that essentially enables
-hwasan-kernel=1 -hwasan-recover=1 -hwasan-match-all-tag=0xff.

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

llvm-svn: 330044

6 years ago[Command] Implement `statistics` command.
Davide Italiano [Fri, 13 Apr 2018 18:02:39 +0000 (18:02 +0000)]
[Command] Implement `statistics` command.

This allows us to collect useful metrics about lldb debugging sessions.

I thought that an example would be better than a thousand words:

  Process 19705 stopped
  * thread #1, queue = 'com.apple.main-thread', stop reason = step in
      frame #0: 0x0000000100000fb4 blah`main at blah.c:3
     1    int main(void) {
     2      int a = 6;
  -> 3      return 0;
     4    }
  (lldb) statistics enable
  (lldb) frame var a
  (int) a = 6
  (lldb) expr a
  (int) $1 = 6
  (lldb) statistics disable
  (lldb) statistics dump
  Number of expr evaluation successes : 1
  Number of expr evaluation failures : 0
  Number of frame var successes : 1
  Number of frame var failures : 0

Future improvements might include:

1. Passing a file, or implementing categories. The way this patch has
been implemented is generic enough to allow this to be extended
easily without breaking the grammar.
2. Adding an SBAPI and Python API for use in scripts.

Thanks to Jim Ingham for discussing the design with me.

<rdar://problem/36555975>

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

llvm-svn: 330043

6 years ago[OPENMP] Replace push_back by emplace_back, NFC.
Alexey Bataev [Fri, 13 Apr 2018 17:48:43 +0000 (17:48 +0000)]
[OPENMP] Replace push_back by emplace_back, NFC.

llvm-svn: 330042

6 years agoFix evaluation of `__has_include_next` during -frewrite-includes.
Volodymyr Sapsai [Fri, 13 Apr 2018 17:43:15 +0000 (17:43 +0000)]
Fix evaluation of `__has_include_next` during -frewrite-includes.

`__has_include_next` requires correct DirectoryLookup for being
evaluated correctly. We were using Preprocessor::GetCurDirLookup() but
we were calling it after the preprocessor finished its work. And in this
case CurDirLookup is always nullptr which makes `__has_include_next`
behave as `__has_include`.

Fix by storing and using CurDirLookup when preprocessor enters a file,
not when we rewrite the includes.

rdar://problem/36305026

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: jkorous-apple, cfe-commits

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

llvm-svn: 330041

6 years ago[OPENMP] Code cleanup + formatting, NFC.
Alexey Bataev [Fri, 13 Apr 2018 17:31:06 +0000 (17:31 +0000)]
[OPENMP] Code cleanup + formatting, NFC.

llvm-svn: 330040

6 years ago[InstCombine][NFC] masked-merge: commutativity tests: ensure the ordering.
Roman Lebedev [Fri, 13 Apr 2018 17:15:55 +0000 (17:15 +0000)]
[InstCombine][NFC] masked-merge: commutativity tests: ensure the ordering.

This was intended since initially, but i did not really think
about it, and did not know how to force that. Now that the
xor->or fold is working (patch upcoming), this came up
to improve the test coverage.

A followup for rL330003, rL330007
https://bugs.llvm.org/show_bug.cgi?id=6773

llvm-svn: 330039

6 years agoAdd PPC64_GLINK dynamic tag.
Sean Fertile [Fri, 13 Apr 2018 16:42:48 +0000 (16:42 +0000)]
Add PPC64_GLINK dynamic tag.

Add support for the PPC64_GLINK dynamic tag which is used in the ElfV2 abi.

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

llvm-svn: 330038

6 years ago[mips] Materialize constants for multiplication
Simon Dardis [Fri, 13 Apr 2018 16:09:07 +0000 (16:09 +0000)]
[mips] Materialize constants for multiplication

Previously, the MIPS backend would alwyas break down constant multiplications
into a series of shifts, adds, and subs. This patch changes that so the cost of
doing so is estimated.

The cost is estimated against worst case constant materialization and retrieving
the results from the HI/LO registers.

For cases where the value type of the multiplication is not legal, the cost of
legalization is estimated and is accounted for before performing the
optimization of breaking down the constant

This resolves PR36884.

Thanks to npl for reporting the issue!

Reviewers: abeserminji, smaksimovic

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

llvm-svn: 330037

6 years agoReduce code duplication.
Rafael Espindola [Fri, 13 Apr 2018 16:07:27 +0000 (16:07 +0000)]
Reduce code duplication.

getVA was already implemented in the base class.

llvm-svn: 330036

6 years ago[X86] Remove remaining itinerary support from instructions and target (PR37093)
Simon Pilgrim [Fri, 13 Apr 2018 15:37:56 +0000 (15:37 +0000)]
[X86] Remove remaining itinerary support from instructions and target (PR37093)

llvm-svn: 330035

6 years ago[ARM] FP16 vmaxnm/vminnm scalar instructions
Sjoerd Meijer [Fri, 13 Apr 2018 15:34:26 +0000 (15:34 +0000)]
[ARM] FP16 vmaxnm/vminnm scalar instructions

This adds code generation support for the FP16 vmaxnm/vminnm scalar
instructions.

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

llvm-svn: 330034

6 years agoRevert r330027: "[llvm-exegesis] re-enable failing tests after r330026."
Clement Courbet [Fri, 13 Apr 2018 15:19:16 +0000 (15:19 +0000)]
Revert r330027: "[llvm-exegesis] re-enable failing tests after r330026."

The tests are still failing on some bots.

llvm-svn: 330033

6 years ago[llvm-mca] Ensure that instructions with a schedule read-advance are always issued...
Andrea Di Biagio [Fri, 13 Apr 2018 15:19:07 +0000 (15:19 +0000)]
[llvm-mca] Ensure that instructions with a schedule read-advance are always issued in the right order.

Normally, the Scheduler prioritizes older instructions over younger instructions
during the instruction issue stage. In one particular case where a dependent
instruction had a schedule read-advance associated to one of the input operands,
this rule was not correctly applied.

This patch fixes the issue and adds a test to verify that we don't regress that
particular case.

llvm-svn: 330032

6 years ago[ARC] Add LImm support for J/JL
Yan Luo [Fri, 13 Apr 2018 15:10:34 +0000 (15:10 +0000)]
[ARC] Add LImm support for J/JL

llvm-svn: 330031

6 years ago[X86] Generalize X86FixupLEAs to work with TargetSchedModel
Simon Pilgrim [Fri, 13 Apr 2018 15:09:39 +0000 (15:09 +0000)]
[X86] Generalize X86FixupLEAs to work with TargetSchedModel

Similar to rL329834, don't rely on itinerary scheduler model to determine latencies for LEA thresholds, use the generic TargetSchedModel::computeInstrLatency call.

llvm-svn: 330030

6 years ago[profile] Fix binary format reader error propagation.
Mircea Trofin [Fri, 13 Apr 2018 15:04:36 +0000 (15:04 +0000)]
[profile] Fix binary format reader error propagation.

Summary:
This was originally part of rL328132, and led to the discovery
of the issues addressed in rL328987. Re-landing.

Reviewers: xur, davidxl, bkramer

Reviewed By: bkramer

Subscribers: llvm-commits

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

llvm-svn: 330029

6 years agoAllow relative file paths when settings source breakpoints
Greg Clayton [Fri, 13 Apr 2018 14:52:54 +0000 (14:52 +0000)]
Allow relative file paths when settings source breakpoints

Many IDEs set breakpoints using absolute paths and this causes problems when the full path of the source file path doesn't match what is in the debug info. This can be due to different build systems and do or do not resolve symlinks. This patch allows relative breakpoint to be set correctly without needing to do any target.source-map tricks. If IDEs want to, they can send down relative paths like:

./main.c
./src/main.c
src/main.c
foo/bar/src/main.c

I used the breakpoint resolver to match on the file basename and then we weed out anything whose relative paths don't match. This will be a huge improvement for IDEs as they can specify as much of a relative path as desired to uniquely identify a source file in the current project.

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

llvm-svn: 330028

6 years ago[llvm-exegesis] re-enable failing tests after r330026.
Clement Courbet [Fri, 13 Apr 2018 14:50:10 +0000 (14:50 +0000)]
[llvm-exegesis] re-enable failing tests after r330026.

llvm-svn: 330027

6 years ago[llvm-exegesis] Fix use after free.
Clement Courbet [Fri, 13 Apr 2018 14:46:48 +0000 (14:46 +0000)]
[llvm-exegesis] Fix use after free.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 330026

6 years agoRemove comment reference to itineraries. NFCI.
Simon Pilgrim [Fri, 13 Apr 2018 14:42:48 +0000 (14:42 +0000)]
Remove comment reference to itineraries. NFCI.

llvm-svn: 330025

6 years ago[AArch64][SVE] Asm: Support for contiguous LD1 (scalar+imm) load instructions
Sander de Smalen [Fri, 13 Apr 2018 14:41:36 +0000 (14:41 +0000)]
[AArch64][SVE] Asm: Support for contiguous LD1 (scalar+imm) load instructions

Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro

Reviewed By: rengolin

Subscribers: tschuett, llvm-commits, kristof.beyls

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

llvm-svn: 330024

6 years ago[X86][AVX512] UNPCKL/H PS and PD should be scheduled with WriteFShuffle not WriteFAdd
Simon Pilgrim [Fri, 13 Apr 2018 14:41:05 +0000 (14:41 +0000)]
[X86][AVX512] UNPCKL/H PS and PD should be scheduled with WriteFShuffle not WriteFAdd

llvm-svn: 330023

6 years ago[X86] Remove remaining OpndItins/SizeItins from all instruction defs (PR37093)
Simon Pilgrim [Fri, 13 Apr 2018 14:36:59 +0000 (14:36 +0000)]
[X86] Remove remaining OpndItins/SizeItins from all instruction defs (PR37093)

llvm-svn: 330022

6 years agoRemove comment references to itineraries. NFCI.
Simon Pilgrim [Fri, 13 Apr 2018 14:31:57 +0000 (14:31 +0000)]
Remove comment references to itineraries. NFCI.

llvm-svn: 330021

6 years ago[llvm-exegesis][NFC] Add more logging in case target creation fails.
Clement Courbet [Fri, 13 Apr 2018 14:29:52 +0000 (14:29 +0000)]
[llvm-exegesis][NFC] Add more logging in case target creation fails.

llvm-svn: 330020

6 years agoRemove out of data comment. NFCI.
Simon Pilgrim [Fri, 13 Apr 2018 14:24:06 +0000 (14:24 +0000)]
Remove out of data comment. NFCI.

llvm-svn: 330019

6 years ago[PostRASink]Add register dependency check for implicit operands
Jun Bum Lim [Fri, 13 Apr 2018 14:23:09 +0000 (14:23 +0000)]
[PostRASink]Add register dependency check for implicit operands

Summary:
This change extend the register dependency check for implicit operands in Copy instructions.
Fixes PR36902.

Reviewers: thegameg, sebpop, uweigand, jnspaulsson, gberry, mcrosier, qcolombet, MatzeB

Reviewed By: thegameg

Subscribers: llvm-commits

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

llvm-svn: 330018

6 years ago[InstCombine][NFC] Regenerate logical-select.ll test
Roman Lebedev [Fri, 13 Apr 2018 14:07:29 +0000 (14:07 +0000)]
[InstCombine][NFC] Regenerate logical-select.ll test

llvm-svn: 330017

6 years ago[clang-format] Improve Incomplete detection for (text) protos
Krasimir Georgiev [Fri, 13 Apr 2018 13:37:09 +0000 (13:37 +0000)]
[clang-format] Improve Incomplete detection for (text) protos

Summary:
This patch improves detection of incomplete code for protos and text protos.
This is especially important for text protos in raw string literals, since they
might be partial strings concatenated, and we'd like to disable formatting in
these cases.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

llvm-svn: 330016

6 years ago[llvm-exegesis] Create test files in temporary directory.
Clement Courbet [Fri, 13 Apr 2018 13:37:07 +0000 (13:37 +0000)]
[llvm-exegesis] Create test files in temporary directory.

Currently the test fails in sandboxed environnements.

llvm-svn: 330015

6 years ago[AArch64][SVE] Asm: Support for contiguous ST1 (scalar+imm) store instructions.
Sander de Smalen [Fri, 13 Apr 2018 12:56:14 +0000 (12:56 +0000)]
[AArch64][SVE] Asm: Support for contiguous ST1 (scalar+imm) store instructions.

Summary:
Added instructions for contiguous stores, ST1, with scalar+imm addressing
modes and corresponding tests. The patch also adds parsing of
'mul vl' as needed for the VL-scaled immediate.

This is patch [6/6] in a series to add assembler/disassembler support for
SVE's contiguous ST1 (scalar+imm) instructions.

Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro

Reviewed By: rengolin

Subscribers: tschuett, llvm-commits, kristof.beyls

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

llvm-svn: 330014

6 years ago[X86] Remove OpndItins/SizeItins from all sse instruction defs (PR37093)
Simon Pilgrim [Fri, 13 Apr 2018 12:50:31 +0000 (12:50 +0000)]
[X86] Remove OpndItins/SizeItins from all sse instruction defs (PR37093)

llvm-svn: 330013

6 years ago[NEON] Support vrndns_f32 intrinsic
Ivan A. Kosarev [Fri, 13 Apr 2018 12:46:02 +0000 (12:46 +0000)]
[NEON] Support vrndns_f32 intrinsic

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

llvm-svn: 330012

6 years ago[NEON] Support intrinsic for scalar and vector versions of the VRINTN instruction
Ivan A. Kosarev [Fri, 13 Apr 2018 12:45:12 +0000 (12:45 +0000)]
[NEON] Support intrinsic for scalar and vector versions of the VRINTN instruction

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

llvm-svn: 330011

6 years agoPartially revert r330008.
Clement Courbet [Fri, 13 Apr 2018 12:43:55 +0000 (12:43 +0000)]
Partially revert r330008.

llvm-svn: 330010

6 years ago[analyzer] Fix null deref in AnyFunctionCall::getRuntimeDefinition
Gabor Horvath [Fri, 13 Apr 2018 12:36:08 +0000 (12:36 +0000)]
[analyzer] Fix null deref in AnyFunctionCall::getRuntimeDefinition

Patch by: Rafael Stahl!

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

llvm-svn: 330009

6 years ago[llvm-exegesis] Run unit tests on more platforms.
Clement Courbet [Fri, 13 Apr 2018 12:20:30 +0000 (12:20 +0000)]
[llvm-exegesis] Run unit tests on more platforms.

Summary:
 - Target-independent tests are run all the time.
 - Tests that codegen X86 code are run when X86 is in build targets.
 - Tests that run X86 jitted code are run only on X86 hosts.

Reviewers: gchatelet

Subscribers: mgorny, llvm-commits, tschuett

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

llvm-svn: 330008

6 years ago[InstCombine][NFC] Add last few tests with constant mask for masked merge folding.
Roman Lebedev [Fri, 13 Apr 2018 12:00:00 +0000 (12:00 +0000)]
[InstCombine][NFC] Add last few tests with constant mask for masked merge folding.

A followup for rL330003
https://bugs.llvm.org/show_bug.cgi?id=6773

llvm-svn: 330007

6 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Fri, 13 Apr 2018 11:37:06 +0000 (11:37 +0000)]
[NFC] fix trivial typos in comments

"the the" -> "the", "we we" -> "we", etc

llvm-svn: 330006

6 years agoRe-land "Don't assume backing thread shares protocol ID."
Jonas Devlieghere [Fri, 13 Apr 2018 11:31:34 +0000 (11:31 +0000)]
Re-land "Don't assume backing thread shares protocol ID."

When we're dealing with virtual (memory) threads created by the OS
plugins, there's no guarantee that the real thread and the backing
thread share a protocol ID. Instead, we should iterate over the memory
threads to find the virtual thread that is backed by the current real
thread.

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

rdar://36485830

The original revision (r329891) was reverted because the associated
tests ran into a deadlock on the Linux bots. That problem was resolved
by r330002.

llvm-svn: 330005

6 years ago[clangd] Match AST and Index label for template Symbols
Ilya Biryukov [Fri, 13 Apr 2018 11:03:07 +0000 (11:03 +0000)]
[clangd] Match AST and Index label for template Symbols

Summary:
Previsouly, class completions items from the index were missing
template parameters in both the snippet and the label.

Reviewers: sammccall, hokein

Reviewed By: sammccall

Subscribers: klimek, jkorous-apple, ioeric, MaskRay, cfe-commits

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

llvm-svn: 330004

6 years ago[InstCombine][NFC] Add tests for masked merge folding.
Roman Lebedev [Fri, 13 Apr 2018 10:56:35 +0000 (10:56 +0000)]
[InstCombine][NFC] Add tests for masked merge folding.

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

As discussed there, some backends may want to undo this fold
(x86+bmi for scalars, x86+sse for vectors, ...)
https://bugs.llvm.org/show_bug.cgi?id=37104

https://rise4fun.com/Alive/JXt

llvm-svn: 330003

6 years agoPrevent deadlock in OS Plugins
Jonas Devlieghere [Fri, 13 Apr 2018 10:25:23 +0000 (10:25 +0000)]
Prevent deadlock in OS Plugins

Summary:
When performing a synchronous resume, the API mutex is held until the
process is stopped. This is fine, except for when the OS plugins are processing
an event before the main thread is aware of it, in which case we end up with a
deadlock because in the internal thread we acquire a resource lock first, and
then wait for the API lock, while in the main thread we do the opposite, we
already hold the API mutex but are now waiting for the event mutex to handle
the event.

This patch fixes this by relaxing the need for the API lock in the OS plugins.
We can get away with this because we now this code is executed in the main
thread. As stated in the comment above, we just want to ensure nobody else
messes with the API while we're making a change. In theory it's possible that
the main thread would release the lock while we're executing the function, but
prevent this would require a more structural solution (which we want, but do
not have today).

The same workaround was already present, but this patch generalizes it to the
whole file.

This will allow me to re-land r329891.

Reviewers: clayborg, jingham, labath

Subscribers: llvm-commits, lldb-commits

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

llvm-svn: 330002

6 years ago[InstCombine]: foldSelectICmpAndAnd(): and is commutative
Roman Lebedev [Fri, 13 Apr 2018 09:57:57 +0000 (09:57 +0000)]
[InstCombine]: foldSelectICmpAndAnd(): and is commutative

Summary:
The fold added in D45108 did not account for the fact that
the and instruction is commutative, and if the mask is a variable,
the mask variable and the fold variable may be swapped.

I have noticed this by accident when looking into [[ https://bugs.llvm.org/show_bug.cgi?id=6773 | PR6773 ]]

This extends/generalizes that fold, so it is handled too.

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 330001

6 years ago[AArch64][SVE] Asm: Add support for parsing and printing SVE vector lists.
Sander de Smalen [Fri, 13 Apr 2018 09:11:53 +0000 (09:11 +0000)]
[AArch64][SVE] Asm: Add support for parsing and printing SVE vector lists.

Summary:
Added Z_(b|h|s|d) vector list RegisterOperands along with support to
add/print the vector lists.

This is patch [5/6] in a series to add assembler/disassembler support for
SVE's contiguous ST1 (scalar+imm) instructions.

Reviewers: fhahn, rengolin, javed.absar, huntergr, SjoerdMeijer, t.p.northover, echristo, evandro

Reviewed By: fhahn

Subscribers: tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 330000

6 years ago[clang-tidy] Fix ParentVirtualCallCheck for old MSVS compilers
Zinovy Nis [Fri, 13 Apr 2018 08:43:47 +0000 (08:43 +0000)]
[clang-tidy] Fix ParentVirtualCallCheck for old MSVS compilers

llvm-svn: 329999

6 years ago[XRay] [compiler-rt] reformat and clarify CMakeLists.txt [NFC]
Martin Pelikan [Fri, 13 Apr 2018 08:33:46 +0000 (08:33 +0000)]
[XRay] [compiler-rt] reformat and clarify CMakeLists.txt [NFC]

Summary:
- last change (+ the Apple support change) missed a lot of indentation
- shorten architecture SOURCES definitions as most fit 1 line/arch
- comment in English what's where, and where the different .a come from
  (using only the word "runtime" in the comment isn't useful, since the
  CMake primitive itself says "runtime" in its name)
- skip unsupported architectures quickly, to avoid extra indentation

Reviewers: dberris, eizan, kpw

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

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

llvm-svn: 329998

6 years ago[clangd] Add line and column number to the index symbol.
Haojian Wu [Fri, 13 Apr 2018 08:30:39 +0000 (08:30 +0000)]
[clangd] Add line and column number to the index symbol.

Summary:
LSP is using Line & column as symbol position, clangd needs to transfer file
offset to Line & column when sending results back to LSP client, which is a high
cost, especially for finding workspace symbol -- we have to read the file
content from disk (if it isn't loaded in memory).

Saving these information in the index will make the clangd life eaiser.

Reviewers: sammccall

Subscribers: klimek, ilya-biryukov, jkorous-apple, ioeric, MaskRay, cfe-commits

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

llvm-svn: 329997

6 years ago[ELF][MIPS] Support linking of PIE for MIPS
Simon Atanasyan [Fri, 13 Apr 2018 08:15:01 +0000 (08:15 +0000)]
[ELF][MIPS] Support linking of PIE for MIPS

MIPS ABI requires creation of the MIPS_RLD_MAP dynamic tag for non-PIE
executables only and MIPS_RLD_MAP_REL tag for both PIE and non-PIE
executables. The patch skips definition of the MIPS_RLD_MAP for PIE
files and defines MIPS_RLD_MAP_REL.

The MIPS_RLD_MAP_REL tag stores the offset to the .rld_map section
relative to the address of the tag itself.

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

llvm-svn: 329996

6 years ago[X86] Fix cldemote builtin signature
Gabor Buella [Fri, 13 Apr 2018 08:14:21 +0000 (08:14 +0000)]
[X86] Fix cldemote builtin signature

Fix for r329993

llvm-svn: 329995

6 years ago[clang-tidy] [bugprone-parent-virtual-call] Minor cosmetic changes. NFC
Zinovy Nis [Fri, 13 Apr 2018 07:46:27 +0000 (07:46 +0000)]
[clang-tidy] [bugprone-parent-virtual-call] Minor cosmetic changes. NFC

llvm-svn: 329994

6 years ago[X86] Introduce cldemote intrinsic
Gabor Buella [Fri, 13 Apr 2018 07:37:24 +0000 (07:37 +0000)]
[X86] Introduce cldemote intrinsic

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

llvm-svn: 329993

6 years ago[X86] Introduce cldemote instruction
Gabor Buella [Fri, 13 Apr 2018 07:35:08 +0000 (07:35 +0000)]
[X86] Introduce cldemote instruction

Hint to hardware to move the cache line containing the
address to a more distant level of the cache without
writing back to memory.

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

llvm-svn: 329992

6 years ago[Support] Fix building for Windows on ARM
Martin Storsjo [Fri, 13 Apr 2018 06:38:02 +0000 (06:38 +0000)]
[Support] Fix building for Windows on ARM

The commit in SVN r310001 that added support for this actually didn't
use the right struct field for the frame pointer - for ARM, there is
no register named Fp in the CONTEXT struct. On Windows, the R11
register is used as frame pointer.

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

llvm-svn: 329991