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

6 years ago[X86] Remove the pmuldq/pmuldq intrinsics and replace with native IR.
Craig Topper [Fri, 13 Apr 2018 06:07:18 +0000 (06:07 +0000)]
[X86] Remove the pmuldq/pmuldq intrinsics and replace with native IR.

This completes the work started in r329604 and r329605 when we changed clang to no longer use the intrinsics.

We lost some InstCombine SimplifyDemandedBit optimizations through this change as we aren't able to fold 'and', bitcast, shuffle very well.

llvm-svn: 329990

6 years ago[XRay][clang] Make -fxray-modes= additive
Dean Michael Berris [Fri, 13 Apr 2018 05:59:57 +0000 (05:59 +0000)]
[XRay][clang] Make -fxray-modes= additive

Summary:
This allows us to do the following:

  clang -fxray-modes=none ... -fxray-modes=xray-basic

It's important to be able to do this in cases where we'd like to
specialise the configuration for the invocation of the compiler, in
various scripting environments.

This is related to llvm.org/PR37066, a follow-up to D45474.

Reviewers: eizan, kpw, pelikan

Subscribers: cfe-commits

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

llvm-svn: 329989

6 years agoEnable debug fission for thinLTO linked via gold-plugin
Yunlian Jiang [Fri, 13 Apr 2018 05:03:28 +0000 (05:03 +0000)]
Enable debug fission for thinLTO linked via gold-plugin

Summary: This enables debug fission on implicit ThinLTO when linked with gold. It will put the .dwo files in a directory specified by user.

Reviewers: tejohnson, pcc, dblaikie

Reviewed By: pcc

Subscribers: JDevlieghere, mehdi_amini, inglorion

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

llvm-svn: 329988

6 years ago[CallSiteSplit] Fix comment. NFC
Xin Tong [Fri, 13 Apr 2018 04:35:38 +0000 (04:35 +0000)]
[CallSiteSplit] Fix comment. NFC

llvm-svn: 329987

6 years agoFix another bot failure from r329951.
Erik Pilkington [Fri, 13 Apr 2018 02:53:26 +0000 (02:53 +0000)]
Fix another bot failure from r329951.

llvm-svn: 329986

6 years ago[XRay][clang] Add flag to choose instrumentation bundles
Dean Michael Berris [Fri, 13 Apr 2018 02:31:58 +0000 (02:31 +0000)]
[XRay][clang] Add flag to choose instrumentation bundles

Summary:
This change addresses http://llvm.org/PR36926 by allowing users to pick
which instrumentation bundles to use, when instrumenting with XRay. In
particular, the flag `-fxray-instrumentation-bundle=` has four valid
values:

- `all`: the default, emits all instrumentation kinds
- `none`: equivalent to -fnoxray-instrument
- `function`: emits the entry/exit instrumentation
- `custom`: emits the custom event instrumentation

These can be combined either as comma-separated values, or as
repeated flag values.

Reviewers: echristo, kpw, eizan, pelikan

Reviewed By: pelikan

Subscribers: mgorny, cfe-commits

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

llvm-svn: 329985

6 years ago[CMake][Fuchsia] Don't specify libc++ ABI version for Fuchsia
Petr Hosek [Fri, 13 Apr 2018 02:02:13 +0000 (02:02 +0000)]
[CMake][Fuchsia] Don't specify libc++ ABI version for Fuchsia

This is now set automatically in libc++ config header.

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

llvm-svn: 329984

6 years ago[CMake] Set the default ABI version for Fuchsia in CMake as well
Petr Hosek [Fri, 13 Apr 2018 01:59:15 +0000 (01:59 +0000)]
[CMake] Set the default ABI version for Fuchsia in CMake as well

This is neeeded since the CMake value is used for the SOVERSION.

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

llvm-svn: 329983

6 years ago[tsan] Add interceptors for objc_sync_enter and objc_sync_exit
Kuba Mracek [Fri, 13 Apr 2018 01:05:29 +0000 (01:05 +0000)]
[tsan] Add interceptors for objc_sync_enter and objc_sync_exit

Objective-C's @synchronize synchronization primitive uses calls to objc_sync_enter and objc_sync_exit runtime functions. In most cases, they end up just calling pthread_mutex_lock/pthread_mutex_unlock, but there are some cases where the synchronization from pthread_mutex_lock/pthread_mutex_unlock interceptors isn't enough. Let's add explicit interceptors for objc_sync_enter and objc_sync_exit to handle all cases.

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

llvm-svn: 329982

6 years ago[AMDGPU] Update relocation record description
Tony Tye [Fri, 13 Apr 2018 01:01:27 +0000 (01:01 +0000)]
[AMDGPU] Update relocation record description

Document which relocation records are static and dynamic.

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

llvm-svn: 329981

6 years ago[asan] Reduce flakiness in stack-overflow detection
Kuba Mracek [Fri, 13 Apr 2018 00:29:24 +0000 (00:29 +0000)]
[asan] Reduce flakiness in stack-overflow detection

IsStackOverflow only treats accesses within 512 bytes of SP as stack-overflow. This should really be the size of a page instead.

The scariness_score_test.cc triggers stack overflow with frames that are even larger than a page, which can also trigger a fault that will not be recognized as stack-overflow. Let's just use smaller frames.

llvm-svn: 329980

6 years ago[libcxx] [test] Use TEST_IGNORE_NODISCARD.
Stephan T. Lavavej [Fri, 13 Apr 2018 00:07:48 +0000 (00:07 +0000)]
[libcxx] [test] Use TEST_IGNORE_NODISCARD.

Fixes D45595.

llvm-svn: 329979

6 years ago[libcxx] [test] Fix whitespace, NFC.
Stephan T. Lavavej [Thu, 12 Apr 2018 23:56:22 +0000 (23:56 +0000)]
[libcxx] [test] Fix whitespace, NFC.

test/std almost always uses spaces; now it is entirely tab-free.

llvm-svn: 329978

6 years ago[libcxx] [test] Use TEST_COMPILER_C1XX.
Stephan T. Lavavej [Thu, 12 Apr 2018 23:56:17 +0000 (23:56 +0000)]
[libcxx] [test] Use TEST_COMPILER_C1XX.

Also TEST_COMPILER_CLANG in one place. (More could be changed.)

llvm-svn: 329977

6 years ago[libcxx] [test] Silence MSVC warning C4146.
Stephan T. Lavavej [Thu, 12 Apr 2018 23:56:14 +0000 (23:56 +0000)]
[libcxx] [test] Silence MSVC warning C4146.

This test code triggers the MSVC warning:

"unary minus operator applied to unsigned type, result still unsigned"

Although it would be possible to change the test code to avoid
this warning, I have chosen to simply silence it.

Fixes D45594.

llvm-svn: 329976

6 years ago[libcxx] [test] Fix nodiscard warnings.
Stephan T. Lavavej [Thu, 12 Apr 2018 23:56:12 +0000 (23:56 +0000)]
[libcxx] [test] Fix nodiscard warnings.

MSVC's STL has marked to_bytes/from_bytes as nodiscard.

Fixes D45595.

llvm-svn: 329975

6 years ago[libcxx] [test] Avoid unary_function.
Stephan T. Lavavej [Thu, 12 Apr 2018 23:56:10 +0000 (23:56 +0000)]
[libcxx] [test] Avoid unary_function.

Replace unary_function inheritance (which was never required,
even in C++98) with argument_type and result_type typedefs.
This increases portability, as unary_function was removed in C++17
and MSVC has implemented that removal.

Fixes D45596.

llvm-svn: 329974

6 years ago[libcxx] [test] Avoid MSVC truncation warnings.
Stephan T. Lavavej [Thu, 12 Apr 2018 23:56:07 +0000 (23:56 +0000)]
[libcxx] [test] Avoid MSVC truncation warnings.

MSVC emits "warning C4244: 'initializing': conversion from 'int'
to 'short', possible loss of data" when it sees pair<Whatever, short>
constructed from (whatever, 4), because int is being truncated to
short within pair's constructor. (The compiler doesn't take into
account the fact that 4 is a literal at the callsite; it generates
this warning when the constructor is instantiated, because it might
be called with a runtime-valued int that would actually truncate.)

Instead of static_cast<short>, we can simply change short to int
in these tests, without affecting the pair operations that they're
trying to test: move assignment, convert copy construction, and
convert move construction.

Fixes D45016.

llvm-svn: 329973

6 years ago[lit] Remove duplicate to_string method
Aaron Smith [Thu, 12 Apr 2018 23:45:15 +0000 (23:45 +0000)]
[lit] Remove duplicate to_string method

There are two versions of to_string used by TestRunner.py. The one defined
in TestRunner.py and the one defined in utils/lit/lit/util.py. The util.py
version is superior to the TestRunner.py version.

This change removes the duplicate to_string in TestRunner.py in favor of
always using the version from util.py. Beside removing duplicate code, this
makes it easier to debug TestRunner.py since only one version of to_string
is used.

Patch by Stella Stamenova!

llvm-svn: 329972

6 years ago[docs] Add LLDB_TEST_USE_CUSTOM_C_COMPILER and LLDB_TEST_USE_CUSTOM_CXX_COMPILER...
Aaron Smith [Thu, 12 Apr 2018 23:29:49 +0000 (23:29 +0000)]
[docs] Add LLDB_TEST_USE_CUSTOM_C_COMPILER and LLDB_TEST_USE_CUSTOM_CXX_COMPILER to the build and test hmtl pages

llvm-svn: 329971

6 years ago[X86] Remove unused MoveLoadStoreItins/ShiftOpndItins schedule class wrappers.
Simon Pilgrim [Thu, 12 Apr 2018 22:57:34 +0000 (22:57 +0000)]
[X86] Remove unused MoveLoadStoreItins/ShiftOpndItins schedule class wrappers.

Was being used to move around empty/unused itineraries...

llvm-svn: 329970

6 years agoFree a pointer, fix a bot.
Erik Pilkington [Thu, 12 Apr 2018 22:54:47 +0000 (22:54 +0000)]
Free a pointer, fix a bot.

llvm-svn: 329969

6 years agoFix test failure caused by r329965.
Eli Friedman [Thu, 12 Apr 2018 22:50:50 +0000 (22:50 +0000)]
Fix test failure caused by r329965.

"-mllvm" options get parsed slightly earlier, and -arm-restrict-it is
only available if the ARM target is compiled in. Invoke "clang -cc1"
directly to avoid the issue.

llvm-svn: 329968

6 years ago[X86] Remove x86 InstrItinClass entries (PR37093)
Simon Pilgrim [Thu, 12 Apr 2018 22:44:47 +0000 (22:44 +0000)]
[X86] Remove x86 InstrItinClass entries (PR37093)

This removes the last of the x86 schedule itineraries, I'm intending to cleanup the remaining uses of NoItinerary/OpndItins/etc. before resolving PR37093.

llvm-svn: 329967

6 years ago[CachePruning] Clarify the per-directory entry limit on Linux ext4.
Fangrui Song [Thu, 12 Apr 2018 22:27:38 +0000 (22:27 +0000)]
[CachePruning] Clarify the per-directory entry limit on Linux ext4.

Summary:
508   root node entries (root_limit)
510   internal node entries (node_limit)

For a filename with 40 bytes, its sizeof(ext4_dir_entry_2) = 48, a linear directory can contain at most floor(4096/48)=85 of them.
The real per-directory entry limit should be 508*510*85 = 22021800
The limit varies with the average length of filenames.

However, the Linux ext4 code does not try rebalancing the htree, so we will not be able to create filenames in a full leaf node. This is demonstrated with the following example, certain filenames cannot be used while others can:

  % touch d/0000000000000000000000000000000000816a6f
  touch: cannot touch 'd/0000000000000000000000000000000000816a6f': No
  space left on device
  % touch d/0000000000000000000000000000000000816a70
  # succeeded

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 329966

6 years agoRemove -cc1 option "-backend-option".
Eli Friedman [Thu, 12 Apr 2018 22:21:36 +0000 (22:21 +0000)]
Remove -cc1 option "-backend-option".

It means the same thing as -mllvm; there isn't any reason to have two
options which do the same thing.

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

llvm-svn: 329965

6 years ago[DAGCombiner] simplify code; NFC
Sanjay Patel [Thu, 12 Apr 2018 22:14:58 +0000 (22:14 +0000)]
[DAGCombiner] simplify code; NFC

llvm-svn: 329964

6 years ago[PowerPC] add fsub-fneg test; NFC
Sanjay Patel [Thu, 12 Apr 2018 22:14:23 +0000 (22:14 +0000)]
[PowerPC] add fsub-fneg test; NFC

This is a test for a transform that was suggested in the post-commit
mailing list thread for rL329821. The target in question is not in
trunk, so PPC gets to stand in for it because it's the only in-tree
target that sets 'isFPExtFree()' to 'true'.

llvm-svn: 329963

6 years ago[asan] Remove malloc_context_size=0 from asan_device_setup.
Evgeniy Stepanov [Thu, 12 Apr 2018 22:06:18 +0000 (22:06 +0000)]
[asan] Remove malloc_context_size=0 from asan_device_setup.

This line was added in
  r243679 - [asan] Support arm64 devices in asan_device_setup
without any good reason.

llvm-svn: 329962

6 years agoDon't call skipModule for CFI lowering passes.
Eli Friedman [Thu, 12 Apr 2018 22:04:11 +0000 (22:04 +0000)]
Don't call skipModule for CFI lowering passes.

opt-bisect shouldn't skip these passes; they lower intrinsics which
no other pass can handle.

llvm-svn: 329961

6 years agoDo not keep shared symbols created from garbage-collected eliminated DSOs.
Rui Ueyama [Thu, 12 Apr 2018 21:57:04 +0000 (21:57 +0000)]
Do not keep shared symbols created from garbage-collected eliminated DSOs.

If all references to a DSO happen to be weak, and if the DSO is
specified with --as-needed, the DSO is not added to DT_NEEDED.
If that happens, we also need to eliminate shared symbols created
from the DSO. Otherwise, they become dangling references that point
to non-exsitent DSO.

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

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

llvm-svn: 329960

6 years ago[ProfileSummary] Remove repeated cutoffs; NFCI
George Burgess IV [Thu, 12 Apr 2018 21:38:43 +0000 (21:38 +0000)]
[ProfileSummary] Remove repeated cutoffs; NFCI

I'm told the repeat of "500000, 600000," is accidental, and should be
removed.

llvm-svn: 329959

6 years ago[clangd][nfc] Simplify readDelimitedMessage()
Jan Korous [Thu, 12 Apr 2018 21:33:24 +0000 (21:33 +0000)]
[clangd][nfc] Simplify readDelimitedMessage()

istream::eof() is always false after successful getline()

llvm-svn: 329958

6 years agoLet llvm-diff correctly deal with Undef/ConstantAggregateZero/ConstantVector/IndirectBr
Brian Gesiak [Thu, 12 Apr 2018 21:28:04 +0000 (21:28 +0000)]
Let llvm-diff correctly deal with Undef/ConstantAggregateZero/ConstantVector/IndirectBr

Summary:
llvm-diff incorrectly reports that there's a diff when input IR contains undef/zeroinitializer/constantvector/indirectbr.
(This happens even if two identical files are given, e.g. `llvm-diff x.ll x.ll`)

This is fix to the bug report https://bugs.llvm.org/show_bug.cgi?id=33623 .

Reviewers: dexonsmith, rjmccall

Reviewed By: rjmccall

Subscribers: chenwj, mgrang, llvm-commits

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

llvm-svn: 329957

6 years agoAArch64: Introduce a DAG combine for folding offsets into addresses.
Peter Collingbourne [Thu, 12 Apr 2018 21:23:55 +0000 (21:23 +0000)]
AArch64: Introduce a DAG combine for folding offsets into addresses.

This is a code size win in code that takes offseted addresses
frequently, such as C++ constructors that typically need to compute
an offseted address of a vtable. This reduces the size of Chromium
for Android's .text section by 108KB.

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

llvm-svn: 329956

6 years ago[DebugInfo] Create merged locations for instructions other than calls
Vedant Kumar [Thu, 12 Apr 2018 20:58:24 +0000 (20:58 +0000)]
[DebugInfo] Create merged locations for instructions other than calls

This lifts a restriction on DILocation::getMergedLocation(), allowing it
to create merged locations for instructions other than calls.

Instruction::applyMergedLocation() now defaults to creating merged
locations for all instructions.

The default behavior of getMergedLocation() is unchanged: callers which
invoke it directly are unaffected.

This change will enable a follow-up Mem2Reg fix which improves crash
reporting.

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

llvm-svn: 329955

6 years ago[ProfileSummary] Move a vector we're about to destroy anyway; NFC
George Burgess IV [Thu, 12 Apr 2018 20:54:05 +0000 (20:54 +0000)]
[ProfileSummary] Move a vector we're about to destroy anyway; NFC

llvm-svn: 329954

6 years ago[X86] Remove InstrItinClass entries from all x86 instruction defs (PR37093)
Simon Pilgrim [Thu, 12 Apr 2018 20:47:34 +0000 (20:47 +0000)]
[X86] Remove InstrItinClass entries from all x86 instruction defs (PR37093)

llvm-svn: 329953

6 years ago[NFC] Fix terrible formatting of CGRecordLower constructor.
Erich Keane [Thu, 12 Apr 2018 20:46:31 +0000 (20:46 +0000)]
[NFC] Fix terrible formatting of CGRecordLower constructor.

llvm-svn: 329952