platform/upstream/llvm.git
6 years agoamdgcn-amdhsa: Convert get_{global,local}_size to clc for all llvm versions
Jan Vesely [Sun, 4 Nov 2018 00:39:30 +0000 (00:39 +0000)]
amdgcn-amdhsa: Convert get_{global,local}_size to clc for all llvm versions

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

6 years agoamdgcn: Move __clc_amdgcn_s_waitcnt definition to clc file
Jan Vesely [Sun, 4 Nov 2018 00:39:27 +0000 (00:39 +0000)]
amdgcn: Move __clc_amdgcn_s_waitcnt definition to clc file

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

6 years agoamdgcn: Convert get_num_groups to clc
Jan Vesely [Sun, 4 Nov 2018 00:39:25 +0000 (00:39 +0000)]
amdgcn: Convert get_num_groups to clc

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

6 years agoamdgcn: Convert get_global_size to clc
Jan Vesely [Sun, 4 Nov 2018 00:39:20 +0000 (00:39 +0000)]
amdgcn: Convert get_global_size to clc

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

6 years agoamdgcn: Convert get_local_size to clc
Jan Vesely [Sun, 4 Nov 2018 00:39:16 +0000 (00:39 +0000)]
amdgcn: Convert get_local_size to clc

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

6 years agor600: Convert barrier to clc
Jan Vesely [Sun, 4 Nov 2018 00:35:15 +0000 (00:35 +0000)]
r600: Convert barrier to clc

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 346078

6 years agor600: Convert get_num_groups to clc
Jan Vesely [Sun, 4 Nov 2018 00:35:12 +0000 (00:35 +0000)]
r600: Convert get_num_groups to clc

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 346077

6 years agor600: Convert get_global_size to clc
Jan Vesely [Sun, 4 Nov 2018 00:35:08 +0000 (00:35 +0000)]
r600: Convert get_global_size to clc

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 346076

6 years agor600: Convert get_local_size to clc
Jan Vesely [Sun, 4 Nov 2018 00:35:03 +0000 (00:35 +0000)]
r600: Convert get_local_size to clc

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 346075

6 years ago[coroutines] Fix fallthrough warning on try/catch
Brian Gesiak [Sat, 3 Nov 2018 22:35:17 +0000 (22:35 +0000)]
[coroutines] Fix fallthrough warning on try/catch

Summary:
The test case added in this diff would incorrectly warn that control
flow may fall through without returning. Here's a standalone example:
https://godbolt.org/z/dCwXEi

The same program, but using `return` instead of `co_return`, does not
produce a warning: https://godbolt.org/z/mVldqQ

The issue was in how Clang analysis would structure its representation
of the control-flow graph. Specifically, when constructing the CFG,
`CFGBuilder::Visit` had special handling of a `ReturnStmt`, in which it
would place object destructors in the same CFG block as a `return` statement,
immediately after it. Doing so would allow the logic in
`lib/Sema/AnalysisBasedWarning.cpp` `CheckFallThrough` to work properly in the
program that used `return`, correctly determining that no "plain edges" preceded
the exit block of the function.

Because a `co_return` statement would not enjoy the same treatment when
it was being built into the control-flow graph, object destructors
would not be placed in the same CFG block as the `co_return`, thus
resulting in a "plain edge" preceding the exit block of the function,
and so the warning logic would be triggered.

Add special casing for `co_return` to Clang analysis, thereby
remedying the mistaken warning.

Test Plan: `check-clang`

Reviewers: GorNishanov, tks2103, rsmith

Reviewed By: GorNishanov

Subscribers: EricWF, lewissbaker, cfe-commits

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

llvm-svn: 346074

6 years ago[X86] Update comment I forgot to change in r346043. NFC
Craig Topper [Sat, 3 Nov 2018 19:49:13 +0000 (19:49 +0000)]
[X86] Update comment I forgot to change in r346043. NFC

llvm-svn: 346073

6 years ago[NFC] Fix incorrect comment in std::list
Louis Dionne [Sat, 3 Nov 2018 17:51:09 +0000 (17:51 +0000)]
[NFC] Fix incorrect comment in std::list

llvm-svn: 346072

6 years ago[ValueTracking] peek through 2-input shuffles in ComputeNumSignBits
Sanjay Patel [Sat, 3 Nov 2018 13:18:55 +0000 (13:18 +0000)]
[ValueTracking] peek through 2-input shuffles in ComputeNumSignBits

This patch gives the IR ComputeNumSignBits the same functionality as the
DAG version (the code is derived from the existing code).

This an extension of the single input shuffle analysis added with D53659.

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

llvm-svn: 346071

6 years agoFix test on Windows.
Douglas Yung [Sat, 3 Nov 2018 08:51:27 +0000 (08:51 +0000)]
Fix test on Windows.

This test checks the entire output of a help option, the problem
is that on Windows, the line break occurs in a different place
causing the CHECK to fail because it is not expecting a line break.

llvm-svn: 346070

6 years agoAdd /Zc:DllexportInlines option to clang-cl
Takuto Ikuta [Sat, 3 Nov 2018 06:45:00 +0000 (06:45 +0000)]
Add /Zc:DllexportInlines option to clang-cl

Summary:
This CL adds /Zc:DllexportInlines flag to clang-cl.
When Zc:DllexportInlines- is specified, inline class member function is not exported if the function does not have local static variables.

By not exporting inline function, code for those functions are not generated and that reduces both compile time and obj size. Also this flag does not import inline functions from dllimported class if the function does not have local static variables.

On my 24C48T windows10 machine, build performance of chrome target in chromium repository is like below.
These stats are come with 'target_cpu="x86" enable_nacl = false is_component_build=true dcheck_always_on=true` build config and applied
* https://chromium-review.googlesource.com/c/chromium/src/+/1212379
* https://chromium-review.googlesource.com/c/v8/v8/+/1186017

Below stats were taken with this patch applied on https://github.com/llvm-project/llvm-project-20170507/commit/a05115cd4c57ff76b0f529e38118765b58ed7f2e

| config                          | build time | speedup | build dir size |
| with patch, PCH on, debug       | 1h10m0s    | x1.13   | 35.6GB         |
| without patch, PCH on, debug    | 1h19m17s   |         | 49.0GB         |
| with patch, PCH off, debug      | 1h15m45s   | x1.16   | 33.7GB         |
| without patch, PCH off, debug   | 1h28m10s   |         | 52.3GB         |
| with patch, PCH on, release     | 1h13m13s   | x1.22   | 26.2GB         |
| without patch, PCH on, release  | 1h29m57s   |         | 37.5GB         |
| with patch, PCH off, release    | 1h23m38s   | x1.32   | 23.7GB         |
| without patch, PCH off, release | 1h50m50s   |         | 38.7GB         |

This patch reduced obj size and the number of exported symbols largely, that improved link time too.
e.g. link time stats of blink_core.dll become like below
|                              | cold disk cache | warm disk cache |
| with patch, PCH on, debug    | 71s             | 30s             |
| without patch, PCH on, debug | 111s            | 48s             |

This patch's implementation is based on Nico Weber's patch. I modified to support static local variable, added tests and took stats.

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

Reviewers: hans, thakis, rnk, javed.absar

Reviewed By: hans

Subscribers: kristof.beyls, smeenai, dschuff, probinson, cfe-commits, eraman

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

llvm-svn: 346069

6 years agoHandle OUTPUT_FORMAT arguments in quotation marks
Galina Kistanova [Sat, 3 Nov 2018 05:25:49 +0000 (05:25 +0000)]
Handle OUTPUT_FORMAT arguments in quotation marks

llvm-svn: 346068

6 years agoTest commit
Nathan Lanza [Sat, 3 Nov 2018 05:12:15 +0000 (05:12 +0000)]
Test commit

llvm-svn: 346067

6 years ago[debuginfo-tests] commands.getoutput -> subprocess.check_output
Fangrui Song [Sat, 3 Nov 2018 04:52:32 +0000 (04:52 +0000)]
[debuginfo-tests] commands.getoutput -> subprocess.check_output

We should also make Darwin Python3 happy after r346059
The output has an extra newline but it is fine in this particular case.

llvm-svn: 346066

6 years agoRevert r345562: "PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of...
Richard Smith [Sat, 3 Nov 2018 02:23:33 +0000 (02:23 +0000)]
Revert r345562: "PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type"

This exposes a (known) CodeGen bug: it can't cope with emitting lvalue
expressions that denote non-odr-used but usable-in-constant-expression
variables. See PR39528 for a testcase.

Reverted for now until that issue can be fixed.

llvm-svn: 346065

6 years ago[Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia
Petr Hosek [Sat, 3 Nov 2018 01:43:25 +0000 (01:43 +0000)]
[Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia

This avoids introducing unnecessary DT_NEEDED entries when using
C++ driver for linking C code or C++ code that doesn't use C++
standard library.

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

llvm-svn: 346064

6 years ago[compiler-rt] Support for passing through linker flags to libc++ build
Petr Hosek [Sat, 3 Nov 2018 01:38:26 +0000 (01:38 +0000)]
[compiler-rt] Support for passing through linker flags to libc++ build

This may be needed when cross-compiling to certain platforms.

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

llvm-svn: 346063

6 years ago[codeview] Let the X86 backend tell us the VFRAME offset adjustment
Reid Kleckner [Sat, 3 Nov 2018 00:41:52 +0000 (00:41 +0000)]
[codeview] Let the X86 backend tell us the VFRAME offset adjustment

Use MachineFrameInfo's OffsetAdjustment field to pass this information
from the target to CodeViewDebug.cpp. The X86 backend doesn't use it for
any other purpose.

This fixes PR38857 in the case where there is a non-aligned quantity of
CSRs and a non-aligned quantity of locals.

llvm-svn: 346062

6 years ago[DWARF v5] Verifier: Add checks for DW_FORM_strx* forms.
Wolfgang Pieb [Sat, 3 Nov 2018 00:27:35 +0000 (00:27 +0000)]
[DWARF v5] Verifier: Add checks for DW_FORM_strx* forms.

Adding functionality to the DWARF verifier for DWARF v5 strx* forms which
index into the string offsets table.

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

llvm-svn: 346061

6 years agoUpdate debuginfo tests lit for r341135
Reid Kleckner [Sat, 3 Nov 2018 00:22:03 +0000 (00:22 +0000)]
Update debuginfo tests lit for r341135

llvm-svn: 346060

6 years ago[debuginfo-tests] Avoid "import commands" which was deprecated in Py3
Reid Kleckner [Sat, 3 Nov 2018 00:16:23 +0000 (00:16 +0000)]
[debuginfo-tests] Avoid "import commands" which was deprecated in Py3

llvm-svn: 346059

6 years agoFix some windows-specific fallout from the FileSpec change.
Zachary Turner [Sat, 3 Nov 2018 00:07:03 +0000 (00:07 +0000)]
Fix some windows-specific fallout from the FileSpec change.

llvm-svn: 346058

6 years agoMake sure to have lit load the configured site config first.
Zachary Turner [Sat, 3 Nov 2018 00:06:37 +0000 (00:06 +0000)]
Make sure to have lit load the configured site config first.

For the lldb unit test suite, we forgot to add the mapping from
site config to main config, so when it found the main config in
the source tree, it wasn't going and loading the configured version
in the build tree first, so the required properties weren't getting
set up properly.

llvm-svn: 346057

6 years ago[CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes
Petr Hosek [Fri, 2 Nov 2018 23:49:36 +0000 (23:49 +0000)]
[CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes

We set lld as the default linker on non-Darwin platforms, but we still
need to set -fuse-ld=lld explicitly in to support cross-compiling Linux
runtimes on Darwin.

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

llvm-svn: 346056

6 years ago[LTO] Fix a crash caused by accessing an empty ValueInfo
Teresa Johnson [Fri, 2 Nov 2018 23:49:21 +0000 (23:49 +0000)]
[LTO] Fix a crash caused by accessing an empty ValueInfo

ModuleSummaryIndex::exportToDot crashes when linking the Linux kernel
under ThinLTO using LLVMgold.so. This is due to the exportToDot
function trying to get the GUID of an empty ValueInfo. The root cause
related to the fact that we attempt to get the GUID of an aliasee
via its OriginalGUID recorded in the aliasee summary, and that is not
always possible. Specifically, we cannot do this mapping when the value
is internal linkage and there were other internal linkage symbols with
the same name.

There are 2 fixes for the problem included here.

1) In all cases where we can currently print the dot file from the
command line (which is only via save-temps), we have a valid AliaseeGUID
in the AliasSummary. Use that when it is available, so that we can get
the correct aliasee GUID whenever possible.

2) However, if we were to invoke exportToDot from the debugger right
after it is built during the initial analysis step (i.e. the per-module
summary), we won't have the AliaseeGUID field populated. In that case,
we have a fallback fix that will simply print "@"+GUID when we aren't
able to get the GUID from the OriginalGUID. It simply checks if the VI
is valid or not before attempting to get the name. Additionally, since
getAliaseeGUID will assert that the AliaseeGUID is non-zero, guard the
earlier fix #1 by a new function hasAliaseeGUID().

Reviewers: pcc, tmroeder

Subscribers: evgeny777, mehdi_amini, inglorion, dexonsmith, arphaman, llvm-commits

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

llvm-svn: 346055

6 years ago[clangd] don't buffer the input-mirror stream, it's used to diagnose crashes
Sam McCall [Fri, 2 Nov 2018 23:47:55 +0000 (23:47 +0000)]
[clangd] don't buffer the input-mirror stream, it's used to diagnose crashes

llvm-svn: 346054

6 years agoAdd an SBExpressionOptions setting mirroring the "exec" command's --allow-jit.
Jim Ingham [Fri, 2 Nov 2018 23:42:40 +0000 (23:42 +0000)]
Add an SBExpressionOptions setting mirroring the "exec" command's --allow-jit.

<rdar://problem/44809176>

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

llvm-svn: 346053

6 years ago[compiler-rt][Fuzzer] Fix the fuzzer test build
Petr Hosek [Fri, 2 Nov 2018 23:29:13 +0000 (23:29 +0000)]
[compiler-rt][Fuzzer] Fix the fuzzer test build

This fixes the issue introduced in r345765 which changed the way in
which the embedded libc++ is being built but omitted tests.

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

llvm-svn: 346052

6 years agoWorkaround using new Clang with an old NDK.
Dan Albert [Fri, 2 Nov 2018 22:57:04 +0000 (22:57 +0000)]
Workaround using new Clang with an old NDK.

We're using an old NDK and a new Clang. New Clangs default to
`-stdlib=libc++` for Android, but those libraries cannot be found by
default with an old NDK. Use an explicit `-stdlib=libstdc++` in the
cxx_mode_flags.

llvm-svn: 346051

6 years ago[X86] In LowerEXTEND_VECTOR_INREG, emit a vector shuffle instead of directly using...
Craig Topper [Fri, 2 Nov 2018 22:48:02 +0000 (22:48 +0000)]
[X86] In LowerEXTEND_VECTOR_INREG, emit a vector shuffle instead of directly using X86ISD::UNPCKL

The majority of the changes are because the rest of shuffle lowering/combining prefers to replace the undef input with the other operand. Using UNPCKL directly seemed to avoid this and just grabbed a randomish register for the undef which can create false dependencies.

llvm-svn: 346050

6 years ago[FileSystem] Open File instances through the FileSystem.
Jonas Devlieghere [Fri, 2 Nov 2018 22:34:51 +0000 (22:34 +0000)]
[FileSystem] Open File instances through the FileSystem.

This patch modifies how we open File instances in LLDB. Rather than
passing a path or FileSpec to the constructor, we now go through the
virtual file system. This is needed in order to make things work with
the VFS in the future.

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

llvm-svn: 346049

6 years agoAdd an explicit -std=c++14 to this test.
Adrian Prantl [Fri, 2 Nov 2018 22:19:02 +0000 (22:19 +0000)]
Add an explicit -std=c++14 to this test.

rdar://problem/45642490

llvm-svn: 346048

6 years ago[WebAssembly] Parsing missing directives to produce valid .o
Wouter van Oortmerssen [Fri, 2 Nov 2018 22:04:33 +0000 (22:04 +0000)]
[WebAssembly] Parsing missing directives to produce valid .o

Summary:
The assembler was able to assemble and then dump back to .s, but
was failing to parse certain directives necessary for valid .o
output:
- .type directives are now recognized to distinguish function symbols
  and others.
- .size is now parsed to provide function size.
- .globaltype (introduced in https://reviews.llvm.org/D54012) is now
  recognized to ensure symbols like __stack_pointer have a proper type
  set for both .s and .o output.

Also added tests for the above.

Reviewers: sbc100, dschuff

Subscribers: jgravelle-google, aheejin, dexonsmith, kristina, llvm-commits, sunfish

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

llvm-svn: 346047

6 years agoFix the lit test suite.
Zachary Turner [Fri, 2 Nov 2018 22:02:09 +0000 (22:02 +0000)]
Fix the lit test suite.

This change was accidentally missed from the original changeset.

llvm-svn: 346046

6 years agoRevert "[Symbol] Search symbols with name and type in a symbol file"
Davide Italiano [Fri, 2 Nov 2018 21:59:14 +0000 (21:59 +0000)]
Revert "[Symbol] Search symbols with name and type in a symbol file"

It broke MacOS buildbots.

llvm-svn: 346045

6 years ago[COFF, ARM64] Implement InterlockedExchange*_* builtins
Mandeep Singh Grang [Fri, 2 Nov 2018 21:18:23 +0000 (21:18 +0000)]
[COFF, ARM64] Implement InterlockedExchange*_* builtins

Summary: Windows SDK needs these intrinsics to be proper builtins.  This is second in a series of patches to move intrinsic defintions out of intrin.h.

Reviewers: rnk, mstorsjo, efriedma, TomTan

Reviewed By: rnk, efriedma

Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits

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

llvm-svn: 346044

6 years ago[X86] Don't emit *_extend_vector_inreg nodes when both the input and output types...
Craig Topper [Fri, 2 Nov 2018 21:09:49 +0000 (21:09 +0000)]
[X86] Don't emit *_extend_vector_inreg nodes when both the input and output types are legal with AVX1

We already have custom lowering for the AVX case in LegalizeVectorOps. So its better to keep the regular extend op around as long as possible.

I had to qualify one place in DAG combine that created illegal vector extending load operations. This change by itself had no effect on any tests which is why its included here.

I've made a few cleanups to the custom lowering. The sign extend code no longer creates an identity shuffle with undef elements. The zero extend code now emits a zero_extend_vector_inreg instead of an unpckl with a zero vector.

For the high half of the custom lowering of zero_extend/any_extend, we're now using an unpckh with a zero vector or undef. Previously we used used a pshufd to move the upper 64-bits to the lower 64-bits and then used a zero_extend_vector_inreg. I think the zero vector should require less execution resources and be smaller code size.

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

llvm-svn: 346043

6 years agoTry to unbreak the build of sanitizers on !NetBSD
Kamil Rytarowski [Fri, 2 Nov 2018 21:06:05 +0000 (21:06 +0000)]
Try to unbreak the build of sanitizers on !NetBSD

Include the build of unpoison_passwd() and unpoison_group() for
SANITIZER_INTERCEPT_FGETPWENT_R and SANITIZER_INTERCEPT_FGETGRENT_R.
 static void unpoison_passwd(

llvm-svn: 346042

6 years agoDiagnose parameter names that shadow the names of inherited fields under -Wshadow...
Aaron Ballman [Fri, 2 Nov 2018 21:04:44 +0000 (21:04 +0000)]
Diagnose parameter names that shadow the names of inherited fields under -Wshadow-field.

This addresses PR34120. Note, unlike GCC, we take into account the accessibility of the field when deciding whether to warn or not.

llvm-svn: 346041

6 years ago[DWARF] Fix typo, .gnu_index -> .gdb_index
Fangrui Song [Fri, 2 Nov 2018 20:34:42 +0000 (20:34 +0000)]
[DWARF] Fix typo, .gnu_index -> .gdb_index

llvm-svn: 346040

6 years ago[DWARF] Fix typo, .gnu_index -> .gdb_index
Fangrui Song [Fri, 2 Nov 2018 20:34:40 +0000 (20:34 +0000)]
[DWARF] Fix typo, .gnu_index -> .gdb_index

llvm-svn: 346039

6 years agoSplit getpwent and fgetgrent functions in interceptors
Kamil Rytarowski [Fri, 2 Nov 2018 20:28:10 +0000 (20:28 +0000)]
Split getpwent and fgetgrent functions in interceptors

Summary:
NetBSD does not ship with fgetpwent_r() and fgetgrent_r().
Split their interceptors from getpwent_r() and getgrent_r()
and disable for this OS.

Installation of supernumerary interceptors causes leaking of
errors to dlsym(3)-like operations.

No functional change for other OSes.

Reviewers: vitalybuka, joerg

Reviewed By: vitalybuka

Subscribers: srhines, kubamracek, fedor.sergeev, llvm-commits, #sanitizers, mgorny

Tags: #sanitizers

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

llvm-svn: 346038

6 years ago[AArch64] [Windows] Misc fixes for llvm-readobj -unwind.
Eli Friedman [Fri, 2 Nov 2018 19:59:08 +0000 (19:59 +0000)]
[AArch64] [Windows] Misc fixes for llvm-readobj -unwind.

Use getImageBase() helper to compute the image base. Fix various
offsets/addresses/masks so they're actually correct.

This allows decoding unwind info from DLLs, and unwind info from object
files containing multiple functions.

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

llvm-svn: 346036

6 years agoFix a bug in the lit test suite generation.
Zachary Turner [Fri, 2 Nov 2018 19:55:15 +0000 (19:55 +0000)]
Fix a bug in the lit test suite generation.

I'm not sure why this has to be CMAKE_CURRENT_SOURCE_DIR, but
it causes all kinds of strange cmake generation errors when it's
the binary dir.

llvm-svn: 346035

6 years ago[RISCV] Add some missing expansions for floating-point intrinsics
Alex Bradbury [Fri, 2 Nov 2018 19:50:38 +0000 (19:50 +0000)]
[RISCV] Add some missing expansions for floating-point intrinsics

A number of intrinsics, such as llvm.sin.f32, would result in a failure to
select. This patch adds expansions for the relevant selection DAG nodes, as
well as exhaustive testing for all f32 and f64 intrinsics.

The codegen for FMA remains a TODO item, pending support for the various
RISC-V FMA instruction variants.

The llvm.minimum.f32.* and llvm.maximum.* tests are commented-out, pending
upstream support for target-independent expansion, as discussed in
http://lists.llvm.org/pipermail/llvm-dev/2018-November/127408.html.

Differential Revision: https://reviews.llvm.org/D54034
Patch by Luís Marques.

llvm-svn: 346034

6 years agoAttempt to fix 'logical operation on address of string constant'
Kristof Umann [Fri, 2 Nov 2018 19:48:56 +0000 (19:48 +0000)]
Attempt to fix 'logical operation on address of string constant'

Caused a lot of warnings for Windows:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/21178/steps/build/logs/warnings%20%2867%29

llvm-svn: 346033

6 years ago[X86][AVX512] Change mask ops on vpermi2var tests to not use zeroinitializer.
Simon Pilgrim [Fri, 2 Nov 2018 19:39:41 +0000 (19:39 +0000)]
[X86][AVX512] Change mask ops on vpermi2var tests to not use zeroinitializer.

This is necessary as I'm wanting to remove the 'Constant Pool' shuffle decoding from getTargetShuffleMask - but using getTargetShuffleMaskIndices allows the shuffle combiner to realize that these calls are really broadcasts.....

As with a lot of the X86ISD::VPERMV3 code this causes some vperm2i/vperm2t shuffles to flip depending on optimal commutation.

llvm-svn: 346032

6 years ago[WebAssembly] Change indices types to unsined int (NFC)
Heejin Ahn [Fri, 2 Nov 2018 19:25:09 +0000 (19:25 +0000)]
[WebAssembly] Change indices types to unsined int (NFC)

Summary:
This changes int types to unsigned int in a few places: function indices
and `wasm::Valtype` (which is unsigend int enum).  Currently these
values cannot have negative values anyway, so this should not be a
functional change for now.

Reviewers: sbc100

Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 346031

6 years ago[PowerPC]Disable randomized address space on Linux ppc64le
Lei Huang [Fri, 2 Nov 2018 19:00:23 +0000 (19:00 +0000)]
[PowerPC]Disable randomized address space on Linux ppc64le

Recent versions of Ubuntu (17.04 and 18.04) on PowerPC have introduced changes
to Address Space Layout Randomization (ASLR) that is causing 500+ sanitizer
failures. This patch disables ASLR when running the sanitizers on PowerPC 64bit
LE.

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

llvm-svn: 346030

6 years ago[WebAssembly] Fix bugs in rethrow depth counting and InstPrinter
Heejin Ahn [Fri, 2 Nov 2018 18:38:52 +0000 (18:38 +0000)]
[WebAssembly] Fix bugs in rethrow depth counting and InstPrinter

Summary:
EH stack depth is incremented at `try` and decremented at `catch`. When
there are more than two catch instructions for a try instruction, we
shouldn't count non-first catches when calculating EH stack depths.

This patch fixes two bugs:
- CFGStackify: Exclude `catch_all` in the terminate catch pad when
  calculating EH pad stack, because when we have multiple catches for a
  try we should count only the first catch instruction when calculating
  EH pad stack.
- InstPrinter: The initial intention was also to exclude non-first
  catches, but it didn't account nested try-catches, so it failed on
  this case:
```
try
  try
  catch
  end
catch    <-- (1)
end
```
In the example, when we are at the catch (1), the last seen EH
instruction is not `try` but `end_try`, violating the wrong assumption.

We don't need these after we switch to the second proposal because there
is gonna be only one `catch` instruction. But anyway before then these
bugfixes are necessary for keep trunk in working state.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 346029

6 years ago[analyzer] Fixup of the module build after https://reviews.llvm.org/D53277
George Karpenkov [Fri, 2 Nov 2018 18:28:52 +0000 (18:28 +0000)]
[analyzer] Fixup of the module build after https://reviews.llvm.org/D53277

Adds AnalyzerOptions.def to the list of textual headers.

llvm-svn: 346028

6 years ago[DebugInfo][InstMerge] Fix -debugify for phi node created by -mldst-motion
Jordan Rupprecht [Fri, 2 Nov 2018 18:25:41 +0000 (18:25 +0000)]
[DebugInfo][InstMerge] Fix -debugify for phi node created by -mldst-motion

Summary:
-mldst-motion creates a new phi node without any debug info. Use the merged debug location from the incoming stores to fix this.

Fixes PR38177. The test case here is (somewhat) simplified from:

```
struct S {
  int foo;
  void fn(int bar);
};
void S::fn(int bar) {
  if (bar)
    foo = 1;
  else
    foo = 0;
}
```

Reviewers: dblaikie, gbedwell, aprantl, vsk

Reviewed By: vsk

Subscribers: vsk, JDevlieghere, llvm-commits

Tags: #debug-info

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

llvm-svn: 346027

6 years agoARMExpandPseudoInsts: Fix CMP_SWAP expansion adding a kill flag to a def
Matthias Braun [Fri, 2 Nov 2018 18:22:15 +0000 (18:22 +0000)]
ARMExpandPseudoInsts: Fix CMP_SWAP expansion adding a kill flag to a def

llvm-svn: 346026

6 years ago[ValueTracking] add test for non-canonical shuffle; NFC
Sanjay Patel [Fri, 2 Nov 2018 18:14:24 +0000 (18:14 +0000)]
[ValueTracking] add test for non-canonical shuffle; NFC

llvm-svn: 346025

6 years ago[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry
Mandeep Singh Grang [Fri, 2 Nov 2018 18:10:07 +0000 (18:10 +0000)]
[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry

Summary: ARM64 setjmp expects sp on entry instead of framepointer.

Patch by: Yin Ma (yinma@codeaurora.org)

Reviewers: mgrang, eli.friedman, ssijaric, mstorsjo, rnk, compnerd

Reviewed By: mgrang

Subscribers: efriedma, javed.absar, kristof.beyls, chrib, cfe-commits

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

llvm-svn: 346024

6 years agoFix a few small issues in llvm-pdbutil
Leonard Mosescu [Fri, 2 Nov 2018 18:00:37 +0000 (18:00 +0000)]
Fix a few small issues in llvm-pdbutil

Running "llvm-pdbutil dump -all" on linux (using the native PDB reader),
over a few PDBs pulled from the Microsoft public symbol store uncovered
a few small issues:

- stripped PDBs might not have the strings stream (/names)
- stripped PDBs might not have the "module info" stream

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

llvm-svn: 346010

6 years ago[SystemZ::TTI] Improve cost handling of uint/sint to fp conversions.
Jonas Paulsson [Fri, 2 Nov 2018 17:53:31 +0000 (17:53 +0000)]
[SystemZ::TTI]  Improve cost handling of uint/sint to fp conversions.

Let i8/i16 uint/sint to fp conversions cost 1 if operand is a load.

Since the load already does the extension, there is no extra cost (previously
returned 2).

Review: Ulrich Weigand
https://reviews.llvm.org/D54028

llvm-svn: 346009

6 years agoRefactor the lit configuration files
Zachary Turner [Fri, 2 Nov 2018 17:49:01 +0000 (17:49 +0000)]
Refactor the lit configuration files

A year or so ago, I re-wrote most of the lit infrastructure in LLVM so
that it wasn't so boilerplate-y. I added lots of common helper type
stuff, simplifed usage patterns, and made the code more elegant and
maintainable.

We migrated to this in LLVM, clang, and lld's lit files, but not in
LLDBs. This started to bite me recently, as the 4 most recent times I
tried to run the lit test suite in LLDB on a fresh checkout the first
thing that would happen is that python would just start crashing with
unhelpful backtraces and I would have to spend time investigating.

You can reproduce this today by doing a fresh cmake generation, doing
ninja lldb and then python bin/llvm-lit.py -sv ~/lldb/lit/SymbolFile at
which point you'll get a segfault that tells you nothing about what your
problem is.

I started trying to fix the issues with bandaids, but it became clear
that the proper solution was to just bring in the work I did in the rest
of the projects. The side benefit of this is that the lit configuration
files become much cleaner and more understandable as a result.

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

llvm-svn: 346008

6 years agoReland "Change the timestamp of llvmcache-foo file to meet the thinLTO prune policy"
Fangrui Song [Fri, 2 Nov 2018 17:44:30 +0000 (17:44 +0000)]
Reland "Change  the timestamp of llvmcache-foo file to meet the thinLTO prune policy"

Summary:
It is difficult to touch a file with a relative mtime across different OSes as POSIX touch -d is rigid. While we may construct relative timestamps with `date`, POSIX date is inadequate to do so as various OSes' date do not agree on a common format (OpenBSD uses `date -r seconds`, FreeBSD uses `date -v-2M` while GNU accepts `-d '-2 min'`)

Just use python os.utime()

Original description:

    The case may randomly fail if we test it with command "
     while llvm-lit tools/lld/test/ELF/lto/cache.ll; do true; done". It is because the llvmcache-foo file is younger than llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6. But due to timestamp precision reason their timestamp is the same. Given the same timestamp, the file prune policy is to remove bigger size file first, so mostly foo file is removed for its bigger size. And the files size is under threshold after deleting foo file. That's what test case expect.

    However sometimes, the precision is enough to measure that timestamp of llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are smaller than foo, so llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are deleted first. Since the files size is still above the file size threshold after deleting the 2 files, the foo file is also deleted. And then the test case fails, because it expect only one file should be deleted instead of 3.

    The fix is to change the timestamp of llvmcache-foo file to meet the thinLTO prune policy.
    The same fix is applied to llvm code at https://reviews.llvm.org/D52452.

    Patch by Luo Yuanke.

Reviewers: ruiu, craig.topper, smaslov, Jianping, espindola, LuoYuanke, tejohnson

Reviewed By: tejohnson

Subscribers: sbc100, krytarowski, aheejin, llvm-commits, dexonsmith, steven_wu, arichardson, inglorion, emaste, bjope, rupprecht

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

llvm-svn: 346006

6 years ago[ProfileSummary] Add options to override hot and cold count thresholds.
Easwaran Raman [Fri, 2 Nov 2018 17:39:31 +0000 (17:39 +0000)]
[ProfileSummary] Add options to override hot and cold count thresholds.

Summary:
The hot and cold count thresholds are derived from the summary, but for
debugging purposes it is convenient to provide the actual thresholds.

Reviewers: davidxl

Subscribers: llvm-commits

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

llvm-svn: 346005

6 years ago[CodeGen] Fix a crash when updating a designated initializer
Erik Pilkington [Fri, 2 Nov 2018 17:36:58 +0000 (17:36 +0000)]
[CodeGen] Fix a crash when updating a designated initializer

We need to handle the ConstantAggregateZero case here too.

rdar://45691981

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

llvm-svn: 346004

6 years ago[FileSystem] Remove `SetFileSystem` method.
Jonas Devlieghere [Fri, 2 Nov 2018 17:34:17 +0000 (17:34 +0000)]
[FileSystem] Remove `SetFileSystem` method.

This is no longer relevant with the new way we initialize the
FileSystem.

llvm-svn: 346003

6 years ago[FileSystme] Move ::open abstraction into FileSystem.
Jonas Devlieghere [Fri, 2 Nov 2018 17:34:16 +0000 (17:34 +0000)]
[FileSystme] Move ::open abstraction into FileSystem.

This moves the abstraction around ::open into the FileSystem, as is
already the case for ::fopen.

llvm-svn: 346002

6 years agoChange -fsanitize-address-poison-class-member-array-new-cookie to -fsanitize-address...
Filipe Cabecinhas [Fri, 2 Nov 2018 17:29:04 +0000 (17:29 +0000)]
Change -fsanitize-address-poison-class-member-array-new-cookie to -fsanitize-address-poison-custom-array-cookie

Handle it in the driver and propagate it to cc1

Reviewers: rjmccall, kcc, rsmith

Subscribers: cfe-commits

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

llvm-svn: 346001

6 years agoFixed inclusion of M_PI fow MinGW-w64
Sylvestre Ledru [Fri, 2 Nov 2018 17:25:40 +0000 (17:25 +0000)]
Fixed inclusion of M_PI fow MinGW-w64

Patch by KOLANICH

llvm-svn: 346000

6 years ago[SystemZ] Rework getInterleavedMemoryOpCost()
Jonas Paulsson [Fri, 2 Nov 2018 17:15:36 +0000 (17:15 +0000)]
[SystemZ] Rework getInterleavedMemoryOpCost()

Model this function more closely after the BasicTTIImpl version, with
separate handling of loads and stores. For loads, the set of actually loaded
vectors is checked.

This makes it more readable and just slightly more accurate generally.

Review: Ulrich Weigand
https://reviews.llvm.org/D53071

llvm-svn: 345998

6 years agoRemove the duplicated definition of size_t
Kristof Umann [Fri, 2 Nov 2018 17:00:07 +0000 (17:00 +0000)]
Remove the duplicated definition of size_t

So hopefully windows won't complain.

llvm-svn: 345997

6 years ago[MachineSink][DebugInfo] Correctly sink DBG_VALUEs
Jeremy Morse [Fri, 2 Nov 2018 16:52:48 +0000 (16:52 +0000)]
[MachineSink][DebugInfo] Correctly sink DBG_VALUEs

As reported in PR38952, postra-machine-sink relies on DBG_VALUE insns being
adjacent to the def of the register that they reference. This is not always
true, leading to register copies being sunk but not the associated DBG_VALUEs,
which gives the debugger a bad variable location.

This patch collects DBG_VALUEs as we walk through a BB looking for copies to
sink, then passes them down to performSink. Compile-time impact should be
negligable.

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

llvm-svn: 345996

6 years ago[fix][clang-tidy] fix for r345961 that introduced a test failure on Windows builds
Jonas Toth [Fri, 2 Nov 2018 16:36:21 +0000 (16:36 +0000)]
[fix][clang-tidy] fix for r345961 that introduced a test failure on Windows builds

r345961 introduced a path check in
.\tools\clang\tools\extra\test\clang-tidy\clang-tidy-run-with-database.cpp.

r345961 added a check line for a path that only handled / on unix
machines and not \ on windows machines.

This patch handles both cases.

Patch by TWeaver.

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

llvm-svn: 345995

6 years agoDidn't -> didnt, because #errors complains about untermianted '
Kristof Umann [Fri, 2 Nov 2018 16:32:15 +0000 (16:32 +0000)]
Didn't -> didnt, because #errors complains about untermianted '

llvm-svn: 345993

6 years ago[analyzer] Fix diagnostics/explicit-suppression.cpp
Fangrui Song [Fri, 2 Nov 2018 16:23:37 +0000 (16:23 +0000)]
[analyzer] Fix diagnostics/explicit-suppression.cpp

*OI++ = *II++ is on line 670, not 668

llvm-svn: 345992

6 years ago[OPENMP][NVPTX]Use __kmpc_data_sharing_coalesced_push_stack function.
Alexey Bataev [Fri, 2 Nov 2018 16:08:31 +0000 (16:08 +0000)]
[OPENMP][NVPTX]Use __kmpc_data_sharing_coalesced_push_stack function.

Coalesced memory access requires use of the new function
`__kmpc_data_sharing_coalesced_push_stack` instead of the
`__kmpc_data_sharing_push_stack`.

llvm-svn: 345991

6 years ago[analyzer] Put llvm.Conventions back in alpha
Kristof Umann [Fri, 2 Nov 2018 16:02:10 +0000 (16:02 +0000)]
[analyzer] Put llvm.Conventions back in alpha

Interestingly, this many year old (when I last looked I remember 2010ish)
checker was committed without any tests, so I thought I'd implement them, but I
was shocked to see how I barely managed to get it working. The code is severely
outdated, I'm not even sure it has ever been used, so I'd propose to move it
back into alpha, and possibly even remove it.

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

llvm-svn: 345990

6 years ago[analyzer] New flag to print all -analyzer-config options
Kristof Umann [Fri, 2 Nov 2018 15:59:37 +0000 (15:59 +0000)]
[analyzer] New flag to print all -analyzer-config options

A new -cc1 flag is avaible for the said purpose: -analyzer-config-help

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

llvm-svn: 345989

6 years ago[ValueTracking] allow non-canonical shuffles when computing signbits
Sanjay Patel [Fri, 2 Nov 2018 15:51:47 +0000 (15:51 +0000)]
[ValueTracking] allow non-canonical shuffles when computing signbits

This possibility is noted in D53987 for a different case,
so we need to adjust the existing code.

llvm-svn: 345988

6 years ago[NFC] Remove some extra characters from docs/LangRef.rst
Cameron McInally [Fri, 2 Nov 2018 15:51:43 +0000 (15:51 +0000)]
[NFC] Remove some extra characters from docs/LangRef.rst

llvm-svn: 345987

6 years ago[analyzer][NFC] Collect all -analyzer-config options in a .def file
Kristof Umann [Fri, 2 Nov 2018 15:50:44 +0000 (15:50 +0000)]
[analyzer][NFC] Collect all -analyzer-config options in a .def file

I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-config option is given from the
command line, and be able to list them all.

In this patch, I'm moving all analyzer options to a def file, and move 2 enums
to global namespace.

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

llvm-svn: 345986

6 years ago[analyzer][NFC] Fix some incorrect uses of -analyzer-config options
Kristof Umann [Fri, 2 Nov 2018 15:48:10 +0000 (15:48 +0000)]
[analyzer][NFC] Fix some incorrect uses of -analyzer-config options

I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-config option is given from
the command line, and be able to list them all.

In this patch, I found some flags that should've been used as checker options,
or have absolutely no mention of in AnalyzerOptions, or are nonexistent.

- NonLocalizedStringChecker now uses its "AggressiveReport" flag as a checker
    option
- lib/StaticAnalyzer/Frontend/ModelInjector.cpp now accesses the "model-path"
    option through a getter in AnalyzerOptions
- -analyzer-config path-diagnostics-alternate=false is not a thing, I removed it,
- lib/StaticAnalyzer/Checkers/AllocationDiagnostics.cpp and
    lib/StaticAnalyzer/Checkers/AllocationDiagnostics.h are weird, they actually
    only contain an option getter. I deleted them, and fixed RetainCountChecker
    to get it's "leak-diagnostics-reference-allocation" option as a checker option,
- "region-store-small-struct-limit" has a proper getter now.

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

llvm-svn: 345985

6 years ago[clang-tidy] Fixed code sample in a comment. NFC
Alexander Kornienko [Fri, 2 Nov 2018 15:29:37 +0000 (15:29 +0000)]
[clang-tidy] Fixed code sample in a comment. NFC

llvm-svn: 345984

6 years ago[NFC] Refactor initialisation of Darwin malloc zone fields into separate function...
Dan Liew [Fri, 2 Nov 2018 15:28:11 +0000 (15:28 +0000)]
[NFC] Refactor initialisation of Darwin malloc zone fields into separate function called `InitMallocZoneFields()` which is now called from `ReplaceSystemMalloc()`.

Summary:
The motivation here is to be able support initialisation of the
malloc zone on other code paths.

rdar://problem/45284065

Reviewers: kubamracek, george.karpenkov

Subscribers: llvm-commits, #sanitizers

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

llvm-svn: 345983

6 years ago[OPENMP]Change the mapping type for lambda captures.
Alexey Bataev [Fri, 2 Nov 2018 15:25:06 +0000 (15:25 +0000)]
[OPENMP]Change the mapping type for lambda captures.

The previously used combination `PTR_AND_OBJ | PRIVATE` could be used for mapping of some data in Fortran. Changed it to `PTR_AND_OBJ | LITERAL`.

llvm-svn: 345982

6 years ago[OPENMP][OFFLOADING]Change the lambda capturing flags.
Alexey Bataev [Fri, 2 Nov 2018 15:24:47 +0000 (15:24 +0000)]
[OPENMP][OFFLOADING]Change the lambda capturing flags.

Summary:
The previously used combination `PTR_AND_OBJ | PRIVATE` could be used
for mapping of some data in Fortran. Changed it to `PTR_AND_OBJ |
  LITERAL`.

Reviewers: gtbercea

Subscribers: guansong, caomhin, openmp-commits

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

llvm-svn: 345981

6 years agoRevert "Change the timestamp of llvmcache-foo file to meet the thinLTO prune policy"
Teresa Johnson [Fri, 2 Nov 2018 15:22:19 +0000 (15:22 +0000)]
Revert "Change  the timestamp of llvmcache-foo file to meet the thinLTO prune policy"

This reverts commit r345977.

A few bots failing because the invocation of "touch" is not accepted on
a couple other OSes. Specifically the -d argument is not accepted or requires
a different format.

http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27103/steps/test_lld/logs/stdio
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/24974/steps/test_lld/logs/stdio

llvm-svn: 345980

6 years ago[clang-tidy] .reset(new X) -> make_unique<X>() in a comment. NFC
Alexander Kornienko [Fri, 2 Nov 2018 15:03:43 +0000 (15:03 +0000)]
[clang-tidy] .reset(new X) -> make_unique<X>() in a comment. NFC

llvm-svn: 345979

6 years ago[OPENMP][NVPTX]Improve emission of the globalized variables for
Alexey Bataev [Fri, 2 Nov 2018 14:54:07 +0000 (14:54 +0000)]
[OPENMP][NVPTX]Improve emission of the globalized variables for
target/teams/distribute regions.

Target/teams/distribute regions exist for all the time the kernel is
executed. Thus, if the variable is declared in their context and then
escape it, we can allocate global memory statically instead of
allocating it dynamically.
Patch captures all the globalized variables in target/teams/distribute
contexts, merges them into the records, one per each target region.
Those records are then joined into the union, one per compilation unit
(to save the global memory). Those units are organized into
2 x dimensional arrays, where the first dimension is
the number of blocks per SM and the second one is the number of SMs.
Runtime functions manage this global memory space between the executing
teams.

llvm-svn: 345978

6 years agoChange the timestamp of llvmcache-foo file to meet the thinLTO prune policy
Teresa Johnson [Fri, 2 Nov 2018 14:52:10 +0000 (14:52 +0000)]
Change  the timestamp of llvmcache-foo file to meet the thinLTO prune policy

Summary:

The case may randomly fail if we test it with command "
 while llvm-lit tools/lld/test/ELF/lto/cache.ll; do true; done". It is because the llvmcache-foo file is younger than llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6. But due to timestamp precision reason their timestamp is the same. Given the same timestamp, the file prune policy is to remove bigger size file first, so mostly foo file is removed for its bigger size. And the files size is under threshold after deleting foo file. That's what test case expect.

However sometimes, the precision is enough to measure that timestamp of llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are smaller than foo, so llvmcache-349F039B8EB076D412007D82778442BED3148C4E and llvmcache-A8107945C65C2B2BBEE8E61AA604C311D60D58D6 are deleted first. Since the files size is still above the file size threshold after deleting the 2 files, the foo file is also deleted. And then the test case fails, because it expect only one file should be deleted instead of 3.

The fix is to change the timestamp of llvmcache-foo file to meet the thinLTO prune policy.
The same fix is applied to llvm code at https://reviews.llvm.org/D52452.

Patch by Luo Yuanke.

Reviewers: ruiu, craig.topper, smaslov, Jianping, espindola, LuoYuanke

Subscribers: rupprecht, bjope, emaste, inglorion, arichardson, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 345977

6 years ago[OPENMP][NVPTX]Fixed/improved support for globalization in team contexts.
Alexey Bataev [Fri, 2 Nov 2018 14:43:23 +0000 (14:43 +0000)]
[OPENMP][NVPTX]Fixed/improved support for globalization in team contexts.

Summary:
Current globalization scheme works correctly only for SPMD+lightweight
runtime mode and does not work for full runtime. Patch improves support
for the globalization scheme + reduces global memory consumption in
  lightweight runtime mode.
Patch adds runtime functions to work with the statically allocated
global memory. It allows to improve performance and memory consumption.
This global memory must be allocated by the compiler.

Reviewers: grokos, kkwli0, gtbercea, caomhin

Subscribers: guansong, jfb, openmp-commits

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

llvm-svn: 345976

6 years ago[Hexagon] Do not reduce load size for globals in small-data
Krzysztof Parzyszek [Fri, 2 Nov 2018 14:17:47 +0000 (14:17 +0000)]
[Hexagon] Do not reduce load size for globals in small-data

Small-data (i.e. GP-relative) loads and stores allow 16-bit scaled
offset. For a load of a value of type T, the small-data area is
equivalent to an array "T sdata[65536]". This implies that objects
of smaller sizes need to be closer to the beginning of sdata,
while larger objects may be farther away, or otherwise the offset
may be insufficient to reach it. Similarly, an object of a larger
size should not be accessed via a load of a smaller size.

llvm-svn: 345975

6 years ago[NativePDB] Make tests work on x86 too
Aleksandr Urakov [Fri, 2 Nov 2018 14:15:29 +0000 (14:15 +0000)]
[NativePDB] Make tests work on x86 too

Summary:
This patch fixes the NativePDB tests to make them work from x86 command line too

Reviewers: zturner, stella.stamenova

Subscribers: aleksandr.urakov, teemperor, lldb-commits

Tags: #lldb

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

llvm-svn: 345974

6 years ago[clangd] Add fallbackFlags initialization extension.
Sam McCall [Fri, 2 Nov 2018 14:07:51 +0000 (14:07 +0000)]
[clangd] Add fallbackFlags initialization extension.

Summary:
This allows customizing the flags used when no compile database is
available. It addresses some uses of the old extraFlags extension.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 345973

6 years ago[DEBUGINFO, NVPTX]DO not emit ',debug' option if no debug info or only debug directiv...
Alexey Bataev [Fri, 2 Nov 2018 13:47:47 +0000 (13:47 +0000)]
[DEBUGINFO, NVPTX]DO not emit ',debug' option if no debug info or only debug directives are requested.

Summary:
If the output of debug directives only is requested, we should drop
emission of ',debug' option from the target directive. Required for
supporting of nvprof profiler.

Reviewers: probinson, echristo, dblaikie

Subscribers: Hahnfeld, jholewinski, llvm-commits, JDevlieghere, aprantl

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

llvm-svn: 345972

6 years agoReapply Logging: make os_log buffer size an integer constant expression.
Tim Northover [Fri, 2 Nov 2018 13:14:11 +0000 (13:14 +0000)]
Reapply Logging: make os_log buffer size an integer constant expression.

The size of an os_log buffer is known at any stage of compilation, so making it
a constant expression means that the common idiom of declaring a buffer for it
won't result in a VLA. That allows the compiler to skip saving and restoring
the stack pointer around such buffers.

This also moves the OSLog and other FormatString helpers from
libclangAnalysis to libclangAST to avoid a circular dependency.

llvm-svn: 345971

6 years ago[clangd] Make in-memory CDB always available as an overlay, refactor.
Sam McCall [Fri, 2 Nov 2018 13:09:36 +0000 (13:09 +0000)]
[clangd] Make in-memory CDB always available as an overlay, refactor.

Summary:
The new implementation is a GlobalCompilationDatabase that overlays a base.
Normally this is the directory-based CDB.
To preserve the behavior of compile_args_from=LSP, the base may be null.

The OverlayCDB is always present, and so the extensions to populate it
are always supported.

It also allows overriding the flags of the fallback command. This is
just unit-tested for now, but the plan is to expose this as an extension
on the initialize message. This addresses use cases like
https://github.com/thomasjo/atom-ide-cpp/issues/16

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 345970

6 years ago[clangd] Remove didOpen extraFlags extension.
Sam McCall [Fri, 2 Nov 2018 13:06:55 +0000 (13:06 +0000)]
[clangd] Remove didOpen extraFlags extension.

Summary:
This was added in D34947 to support YCM, but YCM actually provides *all* args,
and this was never actually used.
Meanwhile, we grew another extension that allows specifying all args.

I did find one user of this extension: https://github.com/thomasjo/atom-ide-cpp.
I'll reach out, there are multiple good alternatives:
 - compile_commands.txt can serve the same purpose as .clang_complete there
 - we can add an extension to support setting the fallback command

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 345969

6 years ago[clangd] Only log ignored diagnostics with -log=verbose.
Sam McCall [Fri, 2 Nov 2018 12:51:26 +0000 (12:51 +0000)]
[clangd] Only log ignored diagnostics with -log=verbose.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 345968

6 years agoAdd support for 'atomic_default_mem_order' clause on 'requires' directive. Also renam...
Patrick Lyster [Fri, 2 Nov 2018 12:18:11 +0000 (12:18 +0000)]
Add support for 'atomic_default_mem_order' clause on 'requires' directive. Also renamed test files relating to 'requires'. Differntial review: https://reviews.llvm.org/D53513

llvm-svn: 345967