platform/upstream/llvm.git
5 years agoadd postfixexpression.cpp.
Jason Molenda [Wed, 24 Apr 2019 19:50:53 +0000 (19:50 +0000)]
add postfixexpression.cpp.

llvm-svn: 359130

5 years ago[X86] Prevent folding a load into an AND if that AND is really a ZEXT_INREG that...
Craig Topper [Wed, 24 Apr 2019 19:28:38 +0000 (19:28 +0000)]
[X86] Prevent folding a load into an AND if that AND is really a ZEXT_INREG that should use movzx.

This can save a 32-bit immediate move.

We would shrink the load and fold it if it was non-volatile, but that's trickier to check for.

llvm-svn: 359129

5 years agollvm-cvtres: Remove a default argument. No behavior change.
Nico Weber [Wed, 24 Apr 2019 19:13:38 +0000 (19:13 +0000)]
llvm-cvtres: Remove a default argument. No behavior change.

llvm-svn: 359128

5 years agoRevert using fcopyfile(3) to implement sys::fs::copy_file(Twine, int) on macOS
Adrian Prantl [Wed, 24 Apr 2019 19:08:43 +0000 (19:08 +0000)]
Revert using fcopyfile(3) to implement sys::fs::copy_file(Twine, int) on macOS

It turns out that I mesread the man page and fcopyfile(3) does not
actually support COPYFILE_CLONE for files.

<rdar://problem/50148757>

llvm-svn: 359127

5 years ago[fuzzer] Fix reload.test on Linux/aarch64
Adhemerval Zanella [Wed, 24 Apr 2019 19:02:54 +0000 (19:02 +0000)]
[fuzzer] Fix reload.test on Linux/aarch64

The compiler generates a 'brk' instruction for __builtin_trap on aarch64
and Linux kernel issues a SIGTRAP. It is different from x86, where
compiler emits an 'ud2' and kernel issues a SIGILL.

A straightforward is to use abort instead.

llvm-svn: 359126

5 years ago[compiler-rt] Fix warning about virtual destructor in sanitizer_flag_parser.h
Vitaly Buka [Wed, 24 Apr 2019 19:01:04 +0000 (19:01 +0000)]
[compiler-rt] Fix warning about virtual destructor in sanitizer_flag_parser.h

llvm-svn: 359125

5 years ago[EditLineTests] Call setenv() before editline is initialized.
Davide Italiano [Wed, 24 Apr 2019 18:39:39 +0000 (18:39 +0000)]
[EditLineTests] Call setenv() before editline is initialized.

llvm-svn: 359124

5 years ago[llvm-symbolizer] Quick fix for broken sanitizer bot
Mitch Phillips [Wed, 24 Apr 2019 18:37:55 +0000 (18:37 +0000)]
[llvm-symbolizer] Quick fix for broken sanitizer bot
(sanitizer-x86_64-linux) until I can triage the issue properly. The
build has been broken due to the symbolizer build checks failing.

As the symbolizer build script relies on the old svn repo layout, it may
take a little while longer to find the responsible patch for the
breakage. This may be a completely valid fix, but I will need to confirm
it. For now, it unbreaks the build.

Tracking data:
Build where the break first occurred: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/21211
Changelist authors: @grimar, @maskray, @whitequark, @spatel, @dpreobra

For the authors, no action needed (yet). Will follow up when I can
identify the cause.

llvm-svn: 359123

5 years agoDebugInfo: Emit only declarations (not whole definitions) of non-unit user defined...
David Blaikie [Wed, 24 Apr 2019 18:09:44 +0000 (18:09 +0000)]
DebugInfo: Emit only declarations (not whole definitions) of non-unit user defined types into type units

While this doesn't come up in reasonable cases currently (the only user
defined types not in type units are ones without linkage - which makes
for near-ODR violations, because it'd be a type with linkage referencing
a type without linkage - such a type can't be validly defined in more
than one TU, so arguably it shouldn't be in a type unit to begin with -
but it's a convenient way to demonstrate an issue that will become more
revalent with homed modular debug info type definitions - which also
don't need to be in type units but more legitimately so).

Precursor to the Clang change to de-type-unit (by omitting the
'identifier') types homed due to strong linkage vtables. (making that
change without this one would lead to major type duplication in type
units)

llvm-svn: 359122

5 years ago[X86] Remove dead nodes left after ReplaceAllUsesWith calls during address matching
Craig Topper [Wed, 24 Apr 2019 18:02:07 +0000 (18:02 +0000)]
[X86] Remove dead nodes left after ReplaceAllUsesWith calls during address matching

ReplaceAllUsesWith doesn't remove the node that was replaced. So its left around in the graph messing up use counts on other nodes.

One thing to note, is that this isn't valid if the node being deleted is the root node of an LEA match that gets rejected. In that case the node needs to stay alive because the isel table walking code would still have a reference to it that its going to try to match next. I don't think that's the case here though because the nodes being deleted here should be "and", "srl", and "zero_extend" none of which can be the root node of an LEA match.

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

llvm-svn: 359121

5 years ago[lldb] Use local definition of get_cpuid_count
Joseph Tremoulet [Wed, 24 Apr 2019 18:00:12 +0000 (18:00 +0000)]
[lldb] Use local definition of get_cpuid_count

Summary:
This is needed for gcc/cstdlib++ 5.4.0, where __get_cpuid_count is not
defined in cpuid.h.

Reviewers: labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 359120

5 years agoAdd std::is_constant_evaluated.
Eric Fiselier [Wed, 24 Apr 2019 17:54:25 +0000 (17:54 +0000)]
Add std::is_constant_evaluated.

Clang recently added __builtin_is_constant_evaluated() and GCC 9.0
has it as well.

This patch adds support for it in libc++.

llvm-svn: 359119

5 years ago[DataFormatters] Adjusting libc++ std::list formatter to act better with pointers...
Shafik Yaghmour [Wed, 24 Apr 2019 17:38:40 +0000 (17:38 +0000)]
[DataFormatters] Adjusting libc++ std::list formatter to act better with pointers and references and adding a test to cover a previous related fix

Summary:
This previous fix https://github.com/llvm-mirror/lldb/commit/5469bda296c183d1b6bf74597c88c9ed667b3145 did not have a test since we did not have a reproducer.

This is related to how formatters deal with pointers and references. The added tests both the new behavior and covers the previous bug fix as well.

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

llvm-svn: 359118

5 years ago[AMDGPU] gfx1010 sgpr register changes
Stanislav Mekhanoshin [Wed, 24 Apr 2019 17:28:30 +0000 (17:28 +0000)]
[AMDGPU] gfx1010 sgpr register changes

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

llvm-svn: 359117

5 years ago[X86][SSE] Add tests for bitcasting vXi1 bool vectors to non-simple types.
Simon Pilgrim [Wed, 24 Apr 2019 17:25:45 +0000 (17:25 +0000)]
[X86][SSE] Add tests for bitcasting vXi1 bool vectors to non-simple types.

llvm-svn: 359116

5 years ago[JITLink] Add support for passing arguments to jit-linked code.
Lang Hames [Wed, 24 Apr 2019 17:23:05 +0000 (17:23 +0000)]
[JITLink] Add support for passing arguments to jit-linked code.

The --args option can now be used to pass arguments to code linked with
llvm-jitlink. E.g.

$ llvm-jitlink file1.o file2.o --args a b c

is equivalent to:

$ ld -o program file1.o file2.o
$ ./program a b c

llvm-svn: 359115

5 years ago[LLVM-C] Deprecate the LLVMValueRef-returning metadata creation functions
Robert Widmann [Wed, 24 Apr 2019 17:05:08 +0000 (17:05 +0000)]
[LLVM-C] Deprecate the LLVMValueRef-returning metadata creation functions

Summary: There is still some value in using these functions while the remaining LLVMValueRef-based accessors are still around, but LLVMMDNodeInContext in particular has some wonky semantics that make it worth replacing outright.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 359114

5 years ago[AMDGPU] Add gfx1010 target definitions
Stanislav Mekhanoshin [Wed, 24 Apr 2019 17:03:15 +0000 (17:03 +0000)]
[AMDGPU] Add gfx1010 target definitions

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

llvm-svn: 359113

5 years ago[clangd] Fix broken helper deep in unit test. NFC
Sam McCall [Wed, 24 Apr 2019 17:00:38 +0000 (17:00 +0000)]
[clangd] Fix broken helper deep in unit test. NFC

llvm-svn: 359112

5 years ago[InstCombine][X86] Use generic expansion of PACKSS/PACKUS for constant folding. NFCI.
Simon Pilgrim [Wed, 24 Apr 2019 16:53:17 +0000 (16:53 +0000)]
[InstCombine][X86] Use generic expansion of PACKSS/PACKUS for constant folding. NFCI.

This patch rewrites the existing PACKSS/PACKUS constant folding code to expand as a generic expansion.

This is a first NFCI step toward expanding PACKSS/PACKUS intrinsics which are acting as non-saturating truncations (although technically the expansion could be used in all cases - but we'll probably want to be conservative).

llvm-svn: 359111

5 years agoRevert "[llvm-objdump] errorToErrorCode+message -> toString"
JF Bastien [Wed, 24 Apr 2019 16:49:30 +0000 (16:49 +0000)]
Revert "[llvm-objdump] errorToErrorCode+message -> toString"

Revert r359100

It breaks llvm/test/Object/elf-invalid-phdr.test

llvm-svn: 359110

5 years agollvm-undname: Fix assert-on->4GiB-string-literal, found by oss-fuzz
Nico Weber [Wed, 24 Apr 2019 16:09:38 +0000 (16:09 +0000)]
llvm-undname: Fix assert-on->4GiB-string-literal, found by oss-fuzz

llvm-svn: 359109

5 years agoMake the test object callable. libstdc++'s bind checks that (libc++ currently does...
Marshall Clow [Wed, 24 Apr 2019 15:33:55 +0000 (15:33 +0000)]
Make the test object callable. libstdc++'s bind checks that (libc++ currently does not). Thanks to Jonathan Wakely for the fix.

llvm-svn: 359108

5 years agoclang-cl: List valid values for /std: in /? output
Nico Weber [Wed, 24 Apr 2019 15:31:13 +0000 (15:31 +0000)]
clang-cl: List valid values for /std: in /? output

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

llvm-svn: 359107

5 years agoFix a one more compare test that assumed -1/0/1 instsad of <0/0/>0. NFC.
Marshall Clow [Wed, 24 Apr 2019 15:26:45 +0000 (15:26 +0000)]
Fix a one more compare test that assumed -1/0/1 instsad of <0/0/>0. NFC.

llvm-svn: 359106

5 years ago[JITLink] Refer to FDE's CIE (not the most recent CIE) when parsing eh-frame.
Lang Hames [Wed, 24 Apr 2019 15:15:55 +0000 (15:15 +0000)]
[JITLink] Refer to FDE's CIE (not the most recent CIE) when parsing eh-frame.

Frame Descriptor Entries (FDEs) have a pointer back to a Common Information
Entry (CIE) that describes how the rest FDE should be parsed. JITLink had been
assuming that FDEs always referred to the most recent CIE encountered, but the
spec allows them to point back to any previously encountered CIE. This patch
fixes JITLink to look up the correct CIE for the FDE.

The testcase is a MachO binary with an FDE that refers to a CIE that is not the
one immediately proceeding it (the layout can be viewed wit
'dwarfdump --eh-frame <testcase>'. This test case had to be a binary as llvm-mc
now sorts FDEs (as of r356216) to ensure FDEs *do* point to the most recent CIE.

llvm-svn: 359105

5 years agoFix a couple of tests that assumed that compare retunred -1/0/1 instead of <0/0/...
Marshall Clow [Wed, 24 Apr 2019 15:14:14 +0000 (15:14 +0000)]
Fix a couple of tests that assumed that compare retunred -1/0/1 instead of <0/0/>0. Thanks to Jonathan Wakely for the report.

llvm-svn: 359104

5 years ago[docs] Copy-edit lld/docs/WebAssembly.rst
Sam Clegg [Wed, 24 Apr 2019 15:13:35 +0000 (15:13 +0000)]
[docs] Copy-edit lld/docs/WebAssembly.rst

Fixes small typos in WebAssembly documentation. I first noticed the
sub-heading "Bahavior", and then decided to review the whole file.

Patch by Christoph Siedentop!

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

llvm-svn: 359103

5 years ago[llvm-objdump] Delete redundant check
Fangrui Song [Wed, 24 Apr 2019 15:09:23 +0000 (15:09 +0000)]
[llvm-objdump] Delete redundant check

llvm-svn: 359102

5 years ago[obj2yamp] - Simplify and cleanup the code in ELFDumper<ELFT>::dumpGroup a bit. NFC.
George Rimar [Wed, 24 Apr 2019 15:03:53 +0000 (15:03 +0000)]
[obj2yamp] - Simplify and cleanup the code in ELFDumper<ELFT>::dumpGroup a bit. NFC.

This makes the variables naming to match LLVM style,
simplifies the code used to extract the group members,
simplifies the loop and reorders the code around a bit.

llvm-svn: 359101

5 years ago[llvm-objdump] errorToErrorCode+message -> toString
Fangrui Song [Wed, 24 Apr 2019 15:03:46 +0000 (15:03 +0000)]
[llvm-objdump] errorToErrorCode+message -> toString

llvm-svn: 359100

5 years ago[ELF] Delete a redundant SHT_NOBITS -> SHT_PROGBITS after D60131
Fangrui Song [Wed, 24 Apr 2019 14:44:07 +0000 (14:44 +0000)]
[ELF] Delete a redundant SHT_NOBITS -> SHT_PROGBITS after D60131

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

llvm-svn: 359099

5 years agoUse llvm::stable_sort
Fangrui Song [Wed, 24 Apr 2019 14:43:05 +0000 (14:43 +0000)]
Use llvm::stable_sort

llvm-svn: 359098

5 years ago[scudo][standalone] Introduce the Secondary allocator
Kostya Kortchinsky [Wed, 24 Apr 2019 14:20:49 +0000 (14:20 +0000)]
[scudo][standalone] Introduce the Secondary allocator

Summary:
The Secondary allocator wraps the platform allocation primitives. It is
meant to be used for larger sizes that the Primary can't fullfill, as
it will be slower, and sizes are multiple of the system page size.

This also changes some of the existing code, notably the opaque
platform data being passed to the platform specific functions: we can
shave a couple of syscalls on Fuchsia by storing additional data (this
addresses a TODO).

Reviewers: eugenis, vitalybuka, hctim, morehouse

Reviewed By: morehouse

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

Tags: #llvm, #sanitizers

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

llvm-svn: 359097

5 years ago[AMDGPU][MC] Parser cleanup and refactoring
Dmitry Preobrazhensky [Wed, 24 Apr 2019 14:06:15 +0000 (14:06 +0000)]
[AMDGPU][MC] Parser cleanup and refactoring

Reviewers: artem.tamazov, arsenm

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

llvm-svn: 359096

5 years ago[x86] make sure horizontal op and broadcast types match to simplify (PR41414)
Sanjay Patel [Wed, 24 Apr 2019 14:05:08 +0000 (14:05 +0000)]
[x86] make sure horizontal op and broadcast types match to simplify (PR41414)

If the types don't match, we can't just remove the shuffle.
There may be some other opportunity for optimization here,
but this should prevent the crashing seen in:
https://bugs.llvm.org/show_bug.cgi?id=41414

llvm-svn: 359095

5 years ago[PPC64] Consider localentry offset when computing branch distance
Fangrui Song [Wed, 24 Apr 2019 14:03:30 +0000 (14:03 +0000)]
[PPC64] Consider localentry offset when computing branch distance

Summary:
We don't take localentry offset into account, and thus may fail to
create a long branch when the gap is just a few bytes smaller than 2^25.

relocation R_PPC64_REL24 out of range: 33554432 is not in [-3355443233554431]
relocation R_PPC64_REL24 out of range: 33554436 is not in [-3355443233554431]

Fix that by adding the offset to the symbol VA.

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

llvm-svn: 359094

5 years ago[LLVM-C] Use dyn_cast instead of unwrap in LLVMGetDebugLoc functions
whitequark [Wed, 24 Apr 2019 13:30:03 +0000 (13:30 +0000)]
[LLVM-C] Use dyn_cast instead of unwrap in LLVMGetDebugLoc functions

Summary:
The `unwrap<Type>` calls can assert with:
```
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast
```
so replace them with `dyn_cast`.

Reviewers: whitequark, abdulras, hiraditya, compnerd

Reviewed By: whitequark

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 359093

5 years agoKill modify-python-lldb.py
Pavel Labath [Wed, 24 Apr 2019 13:23:19 +0000 (13:23 +0000)]
Kill modify-python-lldb.py

Summary:
After the last round of cleanups, this script was almost a no-op. The
only piece of functionality that remained was the one which tried to
make the swig-generated function signatures more pythonic.

The "tried" part is important here, as it wasn't doing a really good job
and the end result was not valid python nor c (e.g.,
SetExecutable(SBAttachInfo self, str const * path)).

Doing these transformations another way is not possible, as these
signatures are generated by swig, and not present in source. However,
given that this is the only reason why we need a swig post-process step,
and that the current implementation is pretty sub-optimal, this patch
simply abandons the signature fixup idea, and chooses to simplify our
build process instead.

Reviewers: amccarth, jingham, clayborg

Subscribers: mgorny, lldb-commits

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

llvm-svn: 359092

5 years ago[yaml2obj] Replace num_zeros with write_zeros
Fangrui Song [Wed, 24 Apr 2019 13:23:15 +0000 (13:23 +0000)]
[yaml2obj] Replace num_zeros with write_zeros

llvm-svn: 359091

5 years ago[yaml2elf] - Replace a loop with write_zeros(). NFC.
George Rimar [Wed, 24 Apr 2019 13:02:15 +0000 (13:02 +0000)]
[yaml2elf] - Replace a loop with write_zeros(). NFC.

And apply clang-format to the method changed.

llvm-svn: 359090

5 years agoMinor code style fix in ClangUserExpression.cpp [NFC]
Raphael Isemann [Wed, 24 Apr 2019 12:55:00 +0000 (12:55 +0000)]
Minor code style fix in ClangUserExpression.cpp [NFC]

llvm-svn: 359089

5 years ago[X86] Add shouldFoldConstantShiftPairToMask override placeholder. NFCI.
Simon Pilgrim [Wed, 24 Apr 2019 12:34:08 +0000 (12:34 +0000)]
[X86] Add shouldFoldConstantShiftPairToMask override placeholder. NFCI.

Prep work toward fixing PR40758

llvm-svn: 359088

5 years agoShorten comment line to be below 80 characters [NFC]
Raphael Isemann [Wed, 24 Apr 2019 12:21:03 +0000 (12:21 +0000)]
Shorten comment line to be below 80 characters [NFC]

llvm-svn: 359087

5 years ago[LLD][ELF] - Remove binding.elf binary from test case. NFCI.
George Rimar [Wed, 24 Apr 2019 12:16:39 +0000 (12:16 +0000)]
[LLD][ELF] - Remove binding.elf binary from test case. NFCI.

This introduces YAML based invalid-binding.test instead.

llvm-svn: 359086

5 years agoAdd an any_cast test for array types. Thanks to Jonathan Wakely for the suggestion.
Marshall Clow [Wed, 24 Apr 2019 12:11:12 +0000 (12:11 +0000)]
Add an any_cast test for array types. Thanks to Jonathan Wakely for the suggestion.

llvm-svn: 359085

5 years ago[LLD][ELD] - Remove excessive lines from test. NFC.
George Rimar [Wed, 24 Apr 2019 12:00:09 +0000 (12:00 +0000)]
[LLD][ELD] - Remove excessive lines from test. NFC.

They are not used.

llvm-svn: 359084

5 years agoLet llvm-cvtres (and lld-link) report duplicate resources
Nico Weber [Wed, 24 Apr 2019 11:42:59 +0000 (11:42 +0000)]
Let llvm-cvtres (and lld-link) report duplicate resources

If two .res files contain the same resource, cvtres.exe (and hence
link.exe) reject the input with this message:

    CVTRES : fatal error CVT1100: duplicate resource.  type:STRING, name:101, language:0x0409
    LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

llvm-cvtres (and lld-link) used to silently pick one of the duplicate
resources instead. This patch makes them report an error as well.
We slightly improve on cvtres by printing the name of two .res files
containing duplicate entries as well.

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

llvm-svn: 359083

5 years ago[X86][SSE] Add masked bit test cases for PR26697
Simon Pilgrim [Wed, 24 Apr 2019 10:34:15 +0000 (10:34 +0000)]
[X86][SSE] Add masked bit test cases for PR26697

llvm-svn: 359082

5 years agoAdd 'REQUIRES: shell' to verbose-output-quoting.c
Hans Wennborg [Wed, 24 Apr 2019 10:12:30 +0000 (10:12 +0000)]
Add 'REQUIRES: shell' to verbose-output-quoting.c

The lit shell couldn't handle these run lines.

llvm-svn: 359081

5 years agoAvoid name conflict with kernel headers
Eric Fiselier [Wed, 24 Apr 2019 09:43:44 +0000 (09:43 +0000)]
Avoid name conflict with kernel headers

llvm-svn: 359080

5 years ago[clangd] Fix handling of include paths in windows tests
Kadir Cetinkaya [Wed, 24 Apr 2019 09:42:53 +0000 (09:42 +0000)]
[clangd] Fix handling of include paths in windows tests

llvm-svn: 359079

5 years ago[clang][HeaderSuggestion] Handle the case of dotdot with an absolute path
Kadir Cetinkaya [Wed, 24 Apr 2019 09:23:31 +0000 (09:23 +0000)]
[clang][HeaderSuggestion] Handle the case of dotdot with an absolute path

Summary:
Include insertion in clangd was inserting absolute paths when the
include directory was an absolute path with a double dot. This patch makes sure
double dots are handled both with absolute and relative paths.

Reviewers: sammccall

Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 359078

5 years agoFix unquoted spaces in args in clang --verbose output
Hans Wennborg [Wed, 24 Apr 2019 09:06:03 +0000 (09:06 +0000)]
Fix unquoted spaces in args in clang --verbose output

The behaviour of not quoting spaces appears to have been introduced by
mistake in r190620.

Patch by Brad Moody!

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

llvm-svn: 359077

5 years agoRevert r359048: C++ DR2387: a variable template declared wthi
Ilya Biryukov [Wed, 24 Apr 2019 08:50:24 +0000 (08:50 +0000)]
Revert r359048: C++ DR2387: a variable template declared wthi

The change breaks libc++ with the follwing error:

In file included from valarray:4:
.../include/c++/v1/valarray:1062:60: error: explicit instantiation declaration of 'valarray<_Tp>' with internal linkage
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
                                                           ^
.../include/c++/v1/valarray:1063:60: error: explicit instantiation declaration of '~valarray<_Tp>' with internal linkage
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())

llvm-svn: 359076

5 years ago[clang][HeaderSearch] Make sure there are no backslashes in suggestedPath
Kadir Cetinkaya [Wed, 24 Apr 2019 08:45:03 +0000 (08:45 +0000)]
[clang][HeaderSearch] Make sure there are no backslashes in suggestedPath

Reviewers: sammccall

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

llvm-svn: 359075

5 years agoyamlify lit/Minidump tests
Pavel Labath [Wed, 24 Apr 2019 08:09:36 +0000 (08:09 +0000)]
yamlify lit/Minidump tests

Replace checked-in binaries by their yaml equivalents.

llvm-svn: 359074

5 years agoPostfixExpression: move parser out of NativePDB internals
Pavel Labath [Wed, 24 Apr 2019 07:27:05 +0000 (07:27 +0000)]
PostfixExpression: move parser out of NativePDB internals

Summary:
The postfix expressions in PDB and breakpad symbol files are similar
enough that they can be parsed by the same parser. This patch
generalizes the parser in the NativePDB plugin and moves it into the
PostfixExpression file created in the previous commit (r358976).

The generalization consists of treating any unrecognised token as a
"symbol" node (previously these would only be created for tokens
starting with "$", and other token would abort the parse). This is
needed because breakpad symbols can also contain ".cfa" tokens, which
refer to the frame's CFA.

The cosmetic changes include:
- using a factory function instead of a class for creating nodes (this
  is more generic as it allows the same BumpPtrAllocator to be used for
  other things too)
- using dedicated function for parsing operator tokens instead of a
  DenseMap (more efficient as we don't need to create the DenseMap every
  time).

Reviewers: amccarth, clayborg, JDevlieghere, aleksandr.urakov

Subscribers: jasonmolenda, lldb-commits, markmentovai, mgorny

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

llvm-svn: 359073

5 years agoAdd "const" in GetUnderlyingObjects. NFC
Bjorn Pettersson [Wed, 24 Apr 2019 06:55:50 +0000 (06:55 +0000)]
Add "const" in GetUnderlyingObjects. NFC

Summary:
Both the input Value pointer and the returned Value
pointers in GetUnderlyingObjects are now declared as
const.

It turned out that all current (in-tree) uses of
GetUnderlyingObjects were trivial to update, being
satisfied with have those Value pointers declared
as const. Actually, in the past several of the users
had to use const_cast, just because of ValueTracking
not providing a version of GetUnderlyingObjects with
"const" Value pointers. With this patch we get rid
of those const casts.

Reviewers: hfinkel, materi, jkorous

Reviewed By: jkorous

Subscribers: dexonsmith, jkorous, jholewinski, sdardis, eraman, hiraditya, jrtc27, atanasyan, llvm-commits

Tags: #llvm

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

llvm-svn: 359072

5 years ago[Mips][CodeGen] Remove MachineFunction::setSubtarget. Change Mips to just copy the...
Craig Topper [Wed, 24 Apr 2019 06:48:31 +0000 (06:48 +0000)]
[Mips][CodeGen] Remove MachineFunction::setSubtarget. Change Mips to just copy the subtarget from the MachineFunction instead of recalculating it.

Summary:
The MachineFunction should have been created with the correct subtarget. As
long as there is no way to change it, MipsTargetMachine can just capture it
directly from the MachineFunction without calling getSubtargetImpl again.

While there, const correct the Subtarget pointer to avoid a const_cast.

I believe the Mips16Subtarget and NoMips16Subtarget members are never used, but
I'll leave there removal for a separate patch.

Reviewers: echristo, atanasyan

Reviewed By: atanasyan

Subscribers: sdardis, arichardson, hiraditya, jrtc27, llvm-commits

Tags: #llvm

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

llvm-svn: 359071

5 years ago[ELF] Fix a gcc -Wextra warning
Fangrui Song [Wed, 24 Apr 2019 05:33:33 +0000 (05:33 +0000)]
[ELF] Fix a gcc -Wextra warning

Extracted from D61046.

warning: enumeral and non-enumeral type in conditional expression [-Wextra]

Cast SHF_ALLOC to avoid that.

llvm-svn: 359070

5 years agoCleanup new cxa guard implementation.
Eric Fiselier [Wed, 24 Apr 2019 04:21:05 +0000 (04:21 +0000)]
Cleanup new cxa guard implementation.

* Add TSAN annotations around the futex syscalls.
* Test that the futex syscall wrappers actually work.
* Fix bad names.

llvm-svn: 359069

5 years ago[CommandLine] Provide parser<unsigned long> instantiation to allow cl::opt<uint64_t...
Fangrui Song [Wed, 24 Apr 2019 02:40:20 +0000 (02:40 +0000)]
[CommandLine] Provide parser<unsigned long> instantiation to allow cl::opt<uint64_t> on LP64 platforms

Summary:
And migrate opt<unsigned long long> to opt<uint64_t>

Fixes PR19665

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

llvm-svn: 359068

5 years ago[Builtins] Implement __builtin_is_constant_evaluated for use in C++2a
Eric Fiselier [Wed, 24 Apr 2019 02:23:30 +0000 (02:23 +0000)]
[Builtins] Implement __builtin_is_constant_evaluated for use in C++2a

Summary:
This patch implements `__builtin_is_constant_evaluated` as specifier by [P0595R2](https://wg21.link/p0595r2). It is built on the back of Bill Wendling's work for `__builtin_constant_p()`.

More tests to come, but early feedback is appreciated.

I plan to implement warnings for common mis-usages like those belowe in a following patch:
```
void foo(int x) {
  if constexpr (std::is_constant_evaluated())) { // condition is always `true`. Should use plain `if` instead.
   foo_constexpr(x);
  } else {
    foo_runtime(x);
  }
}
```

Reviewers: rsmith, MaskRay, bruno, void

Reviewed By: rsmith

Subscribers: dexonsmith, zoecarver, fdeazeve, kristina, cfe-commits

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

llvm-svn: 359067

5 years agoRevert r350917 "[Sema] If CheckPlaceholderExpr rewrites the initializer
Richard Smith [Wed, 24 Apr 2019 02:22:38 +0000 (02:22 +0000)]
Revert r350917 "[Sema] If CheckPlaceholderExpr rewrites the initializer
of an auto"

This commit changed the initializer expression passed into
initialization (stripping off an enclosing pair of parentheses or
braces) and subtly changing the meaning of programs, typically by
inserting bogus calls to copy constructors.

See the added testcase in test/SemaCXX/cxx1y-init-captures.cpp for an
example of the breakage.

llvm-svn: 359066

5 years agoWork around GCC test failure.
Eric Fiselier [Wed, 24 Apr 2019 02:21:13 +0000 (02:21 +0000)]
Work around GCC test failure.

llvm-svn: 359065

5 years agollvm-cvtres: Accept /? as help flag, like cvtres.exe
Nico Weber [Wed, 24 Apr 2019 02:11:24 +0000 (02:11 +0000)]
llvm-cvtres: Accept /? as help flag, like cvtres.exe

llvm-svn: 359064

5 years ago[Docs] Add more redirects
Jonas Devlieghere [Wed, 24 Apr 2019 01:58:17 +0000 (01:58 +0000)]
[Docs] Add more redirects

Found two more broken links.

llvm-svn: 359063

5 years ago[Docs] Update the CI page
Jonas Devlieghere [Wed, 24 Apr 2019 01:48:43 +0000 (01:48 +0000)]
[Docs] Update the CI page

 - Add the Sphinx bot
 - Add a little more info

llvm-svn: 359062

5 years ago[Docs] Move external links up
Jonas Devlieghere [Wed, 24 Apr 2019 01:48:40 +0000 (01:48 +0000)]
[Docs] Move external links up

With a duplicate link removed and the API reference moved up, the page
didn't make much sense anymore.

llvm-svn: 359061

5 years agoRewrite cxa guard implementation.
Eric Fiselier [Wed, 24 Apr 2019 01:47:30 +0000 (01:47 +0000)]
Rewrite cxa guard implementation.

This patch does three main things:
  (1) It re-writes the cxa guard implementation to make it testable.
  (2) Adds support for recursive init detection on non-apple platforms.
  (3) It adds a futex based implementation.

The futex based implementation locks and notifies on a per-object basis, unlike the
current implementation which uses a global lock for all objects. Once this patch settles
I'll turn it on by default when supported.

llvm-svn: 359060

5 years agoFix interactions between __builtin_constant_p and constexpr to match
Richard Smith [Wed, 24 Apr 2019 01:29:28 +0000 (01:29 +0000)]
Fix interactions between __builtin_constant_p and constexpr to match
current trunk GCC.

GCC permits information from outside the operand of
__builtin_constant_p (but in the same constant evaluation context) to be
used within that operand; clang now does so too. A few other minor
deviations from GCC's behavior showed up in my testing and are also
fixed (matching GCC):
 * Clang now supports nullptr_t as the argument type for
   __builtin_constant_p
 * Clang now returns true from __builtin_constant_p if called with a
   null pointer
 * Clang now returns true from __builtin_constant_p if called with an
   integer cast to pointer type

llvm-svn: 359059

5 years agogn build: Merge r359050 more
Nico Weber [Wed, 24 Apr 2019 00:59:24 +0000 (00:59 +0000)]
gn build: Merge r359050 more

llvm-svn: 359058

5 years agoFix test after r359009 on platforms where %ms_abi_triple is 32-bit
Nico Weber [Wed, 24 Apr 2019 00:48:04 +0000 (00:48 +0000)]
Fix test after r359009 on platforms where %ms_abi_triple is 32-bit

llvm-svn: 359057

5 years agogn build: Merge r359050
Nico Weber [Wed, 24 Apr 2019 00:44:14 +0000 (00:44 +0000)]
gn build: Merge r359050

llvm-svn: 359056

5 years agoRevert [AliasAnalysis] AAResults preserves AAManager.
Alina Sbirlea [Wed, 24 Apr 2019 00:28:29 +0000 (00:28 +0000)]
Revert [AliasAnalysis] AAResults preserves AAManager.

Triggers use-after-free.

llvm-svn: 359055

5 years agoFixes in creduce-clang-crash.py for clang crash message parsing and reading the comma...
Amy Huang [Wed, 24 Apr 2019 00:28:23 +0000 (00:28 +0000)]
Fixes in creduce-clang-crash.py for clang crash message parsing and reading the command from the repro script.

llvm-svn: 359054

5 years ago[Remarks] Fix documentation indentation
Francis Visoiu Mistrih [Wed, 24 Apr 2019 00:27:59 +0000 (00:27 +0000)]
[Remarks] Fix documentation indentation

Fix the documentation bot:

http://lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/30450/steps/docs-llvm-html/logs/stdio

llvm-svn: 359053

5 years ago[Docs] Fix link to C++ docs
Jonas Devlieghere [Wed, 24 Apr 2019 00:10:23 +0000 (00:10 +0000)]
[Docs] Fix link to C++ docs

... and add a redirect for the old URL.

llvm-svn: 359052

5 years agoAdd missing diagnostic for anonymous struct/union definitions that don't
Richard Smith [Wed, 24 Apr 2019 00:08:02 +0000 (00:08 +0000)]
Add missing diagnostic for anonymous struct/union definitions that don't
introduce any names.

llvm-svn: 359051

5 years ago[Remarks] Add string deduplication using a string table
Francis Visoiu Mistrih [Wed, 24 Apr 2019 00:06:24 +0000 (00:06 +0000)]
[Remarks] Add string deduplication using a string table

* Add support for uniquing strings in the remark streamer and emitting the string table in the remarks section.

* Add parsing support for the string table in the RemarkParser.

From this remark:

```
--- !Missed
Pass:     inline
Name:     NoDefinition
DebugLoc: { File: 'test-suite/SingleSource/UnitTests/2002-04-17-PrintfChar.c',
            Line: 7, Column: 3 }
Function: printArgsNoRet
Args:
  - Callee:   printf
  - String:   ' will not be inlined into '
  - Caller:   printArgsNoRet
    DebugLoc: { File: 'test-suite/SingleSource/UnitTests/2002-04-17-PrintfChar.c',
                Line: 6, Column: 0 }
  - String:   ' because its definition is unavailable'
...
```

to:

```
--- !Missed
Pass: 0
Name: 1
DebugLoc: { File: 3, Line: 7, Column: 3 }
Function: 2
Args:
  - Callee:   4
  - String:   5
  - Caller:   2
    DebugLoc: { File: 3, Line: 6, Column: 0 }
  - String:   6
...
```

And the string table in the .remarks/__remarks section containing:

```
inline\0NoDefinition\0printArgsNoRet\0
test-suite/SingleSource/UnitTests/2002-04-17-PrintfChar.c\0printf\0
will not be inlined into \0 because its definition is unavailable\0
```

This is mostly supposed to be used for testing purposes, but it gives us
a 2x reduction in the remark size, and is an incremental change for the
updates to the remarks file format.

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

llvm-svn: 359050

5 years agoImprove -Wuninitialized warning under ARC for block variables that are
Akira Hatanaka [Tue, 23 Apr 2019 23:52:02 +0000 (23:52 +0000)]
Improve -Wuninitialized warning under ARC for block variables that are
recursively captured.

Under ARC, a block variable is zero-initialized when it is recursively
captured by the block literal initializer.

rdar://problem/11022762

llvm-svn: 359049

5 years agoC++ DR2387: a variable template declared wtih (or instantiated with) a
Richard Smith [Tue, 23 Apr 2019 23:48:00 +0000 (23:48 +0000)]
C++ DR2387: a variable template declared wtih (or instantiated with) a
const-qualified type is not implicitly given internal linkage. But a
variable template declared 'static' is.

llvm-svn: 359048

5 years ago[Lint] Permit aliasing noalias readonly arguments
Josh Stone [Tue, 23 Apr 2019 23:43:47 +0000 (23:43 +0000)]
[Lint] Permit aliasing noalias readonly arguments

Summary:
If two arguments are both readonly, then they have no memory dependency
that would violate noalias, even if they do actually overlap.

Reviewers: hfinkel, efriedma

Reviewed By: efriedma

Subscribers: efriedma, hiraditya, llvm-commits, tstellar

Tags: #llvm

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

llvm-svn: 359047

5 years ago[AArch64][GlobalISel] Select G_INTRINSIC_ROUND
Jessica Paquette [Tue, 23 Apr 2019 23:03:03 +0000 (23:03 +0000)]
[AArch64][GlobalISel] Select G_INTRINSIC_ROUND

Add selection support for G_INTRINSIC_ROUND, add a selection test, and add
check lines to arm64-vfloatintrinsics.ll and f16-instructions.ll.

llvm-svn: 359046

5 years ago[libcxx] Use relative path for libc++ library when generating script
Petr Hosek [Tue, 23 Apr 2019 22:55:28 +0000 (22:55 +0000)]
[libcxx] Use relative path for libc++ library when generating script

This addresses the issue introduced in D60309 which leads to linker
scripts being generated with absolute paths.

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

llvm-svn: 359045

5 years ago[AArch64][GlobalISel] Mark G_INTRINSIC_ROUND as a pre-isel floating point opcode
Jessica Paquette [Tue, 23 Apr 2019 22:47:00 +0000 (22:47 +0000)]
[AArch64][GlobalISel] Mark G_INTRINSIC_ROUND as a pre-isel floating point opcode

Add G_INTRINSIC_ROUND to isPreISelGenericFloatingPointOpcode to ensure that its
input and output are assigned the correct register bank.

Add a regbankselect test to verify that we get what we expect here.

llvm-svn: 359044

5 years agoThe error message for mismatched value sites is very cryptic.
Dmitry Mikulin [Tue, 23 Apr 2019 22:26:55 +0000 (22:26 +0000)]
The error message for mismatched value sites is very cryptic.
Make it more readable for an average user.

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

llvm-svn: 359043

5 years ago[CMake] Use add_dependencies in add_llvm_install_targets
Alex Langford [Tue, 23 Apr 2019 21:59:07 +0000 (21:59 +0000)]
[CMake] Use add_dependencies in add_llvm_install_targets

Summary:
The CMake documentation says that the `DEPENDS` field of
add_custom_target is for files and output of custom commands. Adding a
dependency on a target should be done with `add_dependency`.

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

llvm-svn: 359042

5 years ago[CGP] Look through bitcasts when duplicating returns for tail calls
Francis Visoiu Mistrih [Tue, 23 Apr 2019 21:57:46 +0000 (21:57 +0000)]
[CGP] Look through bitcasts when duplicating returns for tail calls

The simple case of:

```
int *callee();
void *caller(void *a) {
  if (a == NULL)
    return callee();
  return a;
}
```

would generate a regular call instead of a tail call because we don't
look through the bitcast of the call to `callee` when duplicating the
return blocks.

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

llvm-svn: 359041

5 years ago[X86] Add codegen prepare test exercising a bitcast + tail call
Francis Visoiu Mistrih [Tue, 23 Apr 2019 21:57:43 +0000 (21:57 +0000)]
[X86] Add codegen prepare test exercising a bitcast + tail call

In preparation of https://reviews.llvm.org/D60837, add this test where
we don't perform a tail call because we don't look through a bitcast.

llvm-svn: 359040

5 years agoMove setTargetAttributes after setGVProperties in SetFunctionAttributes
Scott Linder [Tue, 23 Apr 2019 21:50:11 +0000 (21:50 +0000)]
Move setTargetAttributes after setGVProperties in SetFunctionAttributes

AMDGPU currently relies on global properties being set before
setTargetProperties is called. Existing targets like MIPS which rely on
setTargetProperties do not rely on the current behavior, so this patch
moves the call later in SetFunctionAttributes.

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

llvm-svn: 359039

5 years ago[WebAssembly] Emit br_table for most switch instructions
Heejin Ahn [Tue, 23 Apr 2019 21:30:30 +0000 (21:30 +0000)]
[WebAssembly] Emit br_table for most switch instructions

Summary:
Always convert switches to br_tables unless there is only one case,
which is equivalent to a simple branch. This reduces code size for wasm,
and we defer possible jump table optimizations to the VM.
Addresses PR41502.

Reviewers: kripken, sunfish

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

Tags: #llvm

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

llvm-svn: 359038

5 years ago[analyzer] Fix macro names in diagnostics within bigger macros.
Artem Dergachev [Tue, 23 Apr 2019 21:30:30 +0000 (21:30 +0000)]
[analyzer] Fix macro names in diagnostics within bigger macros.

If macro "CHECK_X(x)" expands to something like "if (x != NULL) ...",
the "Assuming..." note no longer says "Assuming 'x' is equal to CHECK_X".

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

llvm-svn: 359037

5 years ago[WebAssembly] Make LBB markers not affected by test order
Heejin Ahn [Tue, 23 Apr 2019 21:17:03 +0000 (21:17 +0000)]
[WebAssembly] Make LBB markers not affected by test order

Summary:
This way we can change the order of tests or delete some of them without
affecting tests for other functions.

Reviewers: tlively

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

Tags: #llvm

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

llvm-svn: 359036

5 years agoRe-apply r357823 "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."
Artem Dergachev [Tue, 23 Apr 2019 21:15:26 +0000 (21:15 +0000)]
Re-apply r357823 "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()."

It now comes with a follow-up fix for the clients of this API
in clangd and clang-tidy.

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

llvm-svn: 359035

5 years agoRevert "[MS] Emit S_HEAPALLOCSITE debug info" because of ToTWin64(db)
Amy Huang [Tue, 23 Apr 2019 21:12:58 +0000 (21:12 +0000)]
Revert "[MS] Emit S_HEAPALLOCSITE debug info" because of ToTWin64(db)
buildbot failure.

This reverts commit d07d6d617713bececf57f3547434dd52f0f13f9e and
c774f687b6880484a126ed3e3d737e74c926f0ae.

llvm-svn: 359034

5 years ago[AArch64][GlobalISel] Legalize G_INTRINSIC_ROUND
Jessica Paquette [Tue, 23 Apr 2019 21:11:57 +0000 (21:11 +0000)]
[AArch64][GlobalISel] Legalize G_INTRINSIC_ROUND

Add it to the same rule as G_FCEIL etc. Add a legalizer test, and add a missing
switch case to AArch64LegalizerInfo.cpp.

llvm-svn: 359033

5 years ago[MemorySSA] LCSSA preserves MemorySSA.
Alina Sbirlea [Tue, 23 Apr 2019 20:59:44 +0000 (20:59 +0000)]
[MemorySSA] LCSSA preserves MemorySSA.

Summary:
Enabling MemorySSA in the old pass manager leads to MemorySSA being run
twice due to the fact that LCSSA and LoopSimplify do not preserve
MemorySSA. This is the first step to address that: target LCSSA.

LCSSA does not make any changes that invalidate MemorySSA, so it
preserves it by design. It must preserve AA as well, for this to hold.

After this patch, MemorySSA is still run twice in the old pass manager.
Step two follows: target LoopSimplify.

Subscribers: mehdi_amini, jlebar, Prazek, llvm-commits, george.burgess.iv, chandlerc

Tags: #llvm

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

llvm-svn: 359032

5 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Tue, 23 Apr 2019 20:52:00 +0000 (20:52 +0000)]
[X86] Autogenerate complete checks. NFC

Prep for D60993

llvm-svn: 359031