platform/upstream/llvm.git
5 years ago[AArch64] Add support for MTE intrinsics
Javed Absar [Tue, 23 Apr 2019 09:39:58 +0000 (09:39 +0000)]
[AArch64] Add support for MTE intrinsics

This patch provides intrinsics support for Memory Tagging Extension (MTE),
which was introduced with the Armv8.5-a architecture.
The intrinsics are described in detail in the latest
ACLE Q1 2019 documentation: https://developer.arm.com/docs/101028/latest
Reviewed by: David Spickett
Differential Revision: https://reviews.llvm.org/D60486

llvm-svn: 358963

5 years ago[ARM][FIX] Add missing f16.lane.vldN/vstN lowering
Diogo N. Sampaio [Tue, 23 Apr 2019 09:36:39 +0000 (09:36 +0000)]
[ARM][FIX] Add missing f16.lane.vldN/vstN lowering

Summary:
Add missing D and Q lane VLDSTLane lowering
for fp16 elements.

Reviewers: efriedma, kosarev, SjoerdMeijer, ostannard

Reviewed By: efriedma

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

Tags: #llvm

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

llvm-svn: 358962

5 years ago[LLD][ELF] - Update test case after llvm-mc change.
George Rimar [Tue, 23 Apr 2019 09:30:26 +0000 (09:30 +0000)]
[LLD][ELF] - Update test case after llvm-mc change.

rL358960 "[llvm-mc] - Properly set the the address align field of the compressed sections."
changed the sh_addralign field of the "zlib" compressed debug sections.

llvm-svn: 358961

5 years ago[llvm-mc] - Properly set the the address align field of the compressed sections.
George Rimar [Tue, 23 Apr 2019 09:16:53 +0000 (09:16 +0000)]
[llvm-mc] - Properly set the the address align field of the compressed sections.

About the compressed sections spec says:
(https://docs.oracle.com/cd/E37838_01/html/E36783/section_compression.html)
sh_addralign fields of the section header for a compressed section
reflect the requirements of the compressed section.

Currently, llvm-mc always puts uncompressed section alignment to sh_addralign.
It is not correct. zlib styled section contains an Elfxx_Chdr header,
so we should either use 4 or 8 values depending on the target
(Uncompressed section alignment is stored in ch_addralign field of the compression header).

GNU assembler version 2.31.1 also has this issue,
but in 2.32.51 it was already fixed. This is how it was found
during debugging of the https://bugs.llvm.org/show_bug.cgi?id=40482
actually.

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

llvm-svn: 358960

5 years agoUnwindPlan: pretty-print dwarf expressions
Pavel Labath [Tue, 23 Apr 2019 09:16:51 +0000 (09:16 +0000)]
UnwindPlan: pretty-print dwarf expressions

Summary:
Previously we were printing the dwarf expressions in unwind rules simply
as "dwarf-expr". This patch uses the existing dwarf-printing
capabilities in lldb to enhance this dump output, and print the full
decoded dwarf expression.

Reviewers: jasonmolenda, clayborg

Subscribers: aprantl, lldb-commits

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

llvm-svn: 358959

5 years ago[LSR] Limit the recursion for setup cost
David Green [Tue, 23 Apr 2019 08:52:21 +0000 (08:52 +0000)]
[LSR] Limit the recursion for setup cost

In some circumstances we can end up with setup costs that are very complex to
compute, even though the scevs are not very complex to create. This can also
lead to setupcosts that are calculated to be exactly -1, which LSR treats as an
invalid cost. This patch puts a limit on the recursion depth for setup cost to
prevent them taking too long.

Thanks to @reames for the report and test case.

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

llvm-svn: 358958

5 years agoyamlify TestMiniDumpUUID binaries
Pavel Labath [Tue, 23 Apr 2019 08:49:39 +0000 (08:49 +0000)]
yamlify TestMiniDumpUUID binaries

Summary:
Instead of checking in raw minidump binaries, check in their yaml form,
and call yaml2obj in the test.

Reviewers: clayborg

Subscribers: javed.absar, lldb-commits

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

llvm-svn: 358957

5 years ago[Analyzer] Fix for previous commit
Adam Balogh [Tue, 23 Apr 2019 07:45:10 +0000 (07:45 +0000)]
[Analyzer] Fix for previous commit

A compilation warning was in my previous commit which broke the buildbot
because it is using `-Werror` for compilation. This patch fixes this
issue.

llvm-svn: 358955

5 years ago[PowerPC] Fix test with -fno-discard-value-names after rC358949
Fangrui Song [Tue, 23 Apr 2019 07:39:23 +0000 (07:39 +0000)]
[PowerPC] Fix test with -fno-discard-value-names after rC358949

For the clang driver, -DLLVM_ENABLE_ASSERTIONS=off builds default to discard value names.

llvm-svn: 358953

5 years ago[Analyzer] Instead of recording comparisons in interator checkers do an eager state...
Adam Balogh [Tue, 23 Apr 2019 07:15:55 +0000 (07:15 +0000)]
[Analyzer] Instead of recording comparisons in interator checkers do an eager state split

Currently iterator checkers record comparison of iterator positions
and process them for keeping track the distance between them (e.g.
whether a position is the same as the end position). However this
makes some processing unnecessarily complex and it is not needed at
all: we only need to keep track between the abstract symbols stored
in these iterator positions. This patch changes this and opens the
path to comparisons to the begin() and end() symbols between the
container (e.g. size, emptiness) which are stored as symbols, not
iterator positions. The functionality of the checker is unchanged.

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

llvm-svn: 358951

5 years ago[PPC64] Allow R_PPC64_DTPREL* to preemptable local-dynamic symbols
Fangrui Song [Tue, 23 Apr 2019 06:31:44 +0000 (06:31 +0000)]
[PPC64] Allow R_PPC64_DTPREL* to preemptable local-dynamic symbols

Similar to D60945.

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

llvm-svn: 358950

5 years ago[PowerPC] [Clang] Port MMX intrinsics and basic test cases to Power
Qiu Chaofan [Tue, 23 Apr 2019 05:50:24 +0000 (05:50 +0000)]
[PowerPC] [Clang] Port MMX intrinsics and basic test cases to Power

Port mmintrin.h which include x86 MMX intrinsics implementation to PowerPC platform (using Altivec).

To make the include process correct, PowerPC's toolchain class is overrided to insert new headers directory (named ppc_wrappers) into the path. Basic test cases for several intrinsic functions are added.

The header is mainly developed by Steven Munroe, with contributions from Paul Clarke, Bill Schmidt, Jinsong Ji and Zixuan Wu.

Reviewed By: Jinsong Ji

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

llvm-svn: 358949

5 years ago[WebAssembly] Bail out of fastisel earlier when computing PIC addresses
Sam Clegg [Tue, 23 Apr 2019 03:43:26 +0000 (03:43 +0000)]
[WebAssembly] Bail out of fastisel earlier when computing PIC addresses

This change partially reverts https://reviews.llvm.org/D54647 in favor
of bailing out during computeAddress instead.

This catches the condition earlier and handles more cases.

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

llvm-svn: 358948

5 years ago[analyzer] Unbreak body farms in presence of multiple declarations.
Artem Dergachev [Tue, 23 Apr 2019 02:56:00 +0000 (02:56 +0000)]
[analyzer] Unbreak body farms in presence of multiple declarations.

When growing a body on a body farm, it's essential to use the same redeclaration
of the function that's going to be used during analysis. Otherwise our
ParmVarDecls won't match the ones that are used to identify argument regions.

This boils down to trusting the reasoning in AnalysisDeclContext. We shouldn't
canonicalize the declaration before farming the body because it makes us not
obey the sophisticated decision-making process of AnalysisDeclContext.

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

llvm-svn: 358946

5 years ago[analyzer] PR41335: Fix crash when no-store event is in a body-farmed function.
Artem Dergachev [Tue, 23 Apr 2019 02:50:38 +0000 (02:50 +0000)]
[analyzer] PR41335: Fix crash when no-store event is in a body-farmed function.

Stuffing invalid source locations (such as those in functions produced by
body farms) into path diagnostics causes crashes.

Fix a typo in a nearby function name.

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

llvm-svn: 358945

5 years ago[analyzer] PR41269: Add a bit of C++ smart pointer modeling.
Artem Dergachev [Tue, 23 Apr 2019 02:45:42 +0000 (02:45 +0000)]
[analyzer] PR41269: Add a bit of C++ smart pointer modeling.

Implement cplusplus.SmartPtrModeling, a new checker that doesn't
emit any warnings but models methods of smart pointers more precisely.

For now the only thing it does is make `(bool) P` return false when `P`
is a freshly moved pointer. This addresses a false positive in the
use-after-move-checker.

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

llvm-svn: 358944

5 years agoUse llvm::stable_sort
Fangrui Song [Tue, 23 Apr 2019 02:42:06 +0000 (02:42 +0000)]
Use llvm::stable_sort

Make some small adjustment while touching the code: make parameters
const, use less_first(), etc.

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

llvm-svn: 358943

5 years agoadd Qiu Chaofan (qiucf@cn.ibm.com) to the CREDITS.txt
Qiu Chaofan [Tue, 23 Apr 2019 02:37:48 +0000 (02:37 +0000)]
add Qiu Chaofan (qiucf@cn.ibm.com) to the CREDITS.txt

llvm-svn: 358942

5 years agoRevert "Use const DebugLoc&"
Chandler Carruth [Tue, 23 Apr 2019 01:42:07 +0000 (01:42 +0000)]
Revert "Use const DebugLoc&"

This reverts r358910 (git commit 2b744665308fc8d30a3baecb4947f2bd81aa7d30)

While this patch *seems* trivial and safe and correct, it is not. The
copies are actually load bearing copies. You can observe this with MSan
or other ways of checking for use-after-destroy, but otherwise this may
result in ... difficult to debug inexplicable behavior.

I suspect the issue is that the debug location is used after the
original reference to it is removed. The metadata backing it gets
destroyed as its last references goes away, and then we reference it
later through these const references.

llvm-svn: 358940

5 years agoOne small tweak to LocateExecutableScriptingResources - I
Jason Molenda [Tue, 23 Apr 2019 01:13:27 +0000 (01:13 +0000)]
One small tweak to LocateExecutableScriptingResources - I
was still stat'ing the possibly-dSYM FileSpec before I
(more cheaply) checked the filepath for telltale dSYM
components.
<rdar://problem/50086007>

llvm-svn: 358939

5 years agoAdd a small check to PlatformDarwin::LoadScriptingResourceForModule
Jason Molenda [Tue, 23 Apr 2019 01:02:51 +0000 (01:02 +0000)]
Add a small check to PlatformDarwin::LoadScriptingResourceForModule
which reads the python files in a dSYM bundle, to check that the
SymbolFile is actually a dSYM bundle filepath; delay any fetching
of the ScriptInterpreter until after we've done that check.

When debugging a binary without a dSYM on darwin systems, the
SymbolFile we fetch is actually the ObjectFile -- so we would do
an unnecessary trip into Python land and stat around the filesystem
looking for a python file to read in.  There's no reason to do any
of this unless the SymbolFile's file path includes the .dSYM bundle
telltale path components.

<rdar://problem/50065315>

llvm-svn: 358938

5 years ago[libc++abi] Don't use a .sh.cpp test for uncaught_exception
Louis Dionne [Tue, 23 Apr 2019 00:03:34 +0000 (00:03 +0000)]
[libc++abi] Don't use a .sh.cpp test for uncaught_exception

Otherwise, we don't seem to get the DYLD_LIBRARY_PATH set up correctly
and the tests are run against the system libc++abi dylib.

llvm-svn: 358937

5 years ago[CMake] Replace the sanitizer support in runtimes build with multilib
Petr Hosek [Mon, 22 Apr 2019 23:31:39 +0000 (23:31 +0000)]
[CMake] Replace the sanitizer support in runtimes build with multilib

This is a more generic solution; while the sanitizer support can be used
only for sanitizer instrumented builds, the multilib support can be used
to build other variants such as noexcept which is what we would like to use
in Fuchsia.

The name CMake target name uses the target name, same as for the regular
runtimes build and the name of the multilib, concatenated with '+'. The
libraries are installed in a subdirectory named after the multilib.

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

llvm-svn: 358935

5 years agoFully qualify llvm::Optional, some compilers complain otherwise.
Adrian Prantl [Mon, 22 Apr 2019 22:51:34 +0000 (22:51 +0000)]
Fully qualify llvm::Optional, some compilers complain otherwise.

llvm-svn: 358933

5 years ago[c++2a] Implement semantic restrictions for 'export' declarations.
Richard Smith [Mon, 22 Apr 2019 22:50:11 +0000 (22:50 +0000)]
[c++2a] Implement semantic restrictions for 'export' declarations.

llvm-svn: 358932

5 years agoDebugInfo: Emit only one kind of accelerated access/name table
David Blaikie [Mon, 22 Apr 2019 22:45:11 +0000 (22:45 +0000)]
DebugInfo: Emit only one kind of accelerated access/name table

Currently to opt in to debug_names in DWARFv5, the IR must contain
'nameTableKind: Default' which also enables debug_pubnames.

Instead, only allow one of {debug_names, apple_names, debug_pubnames,
debug_gnu_pubnames}.

nameTableKind: Default gives debug_names in DWARFv5 and greater,
debug_pubnames in v4 and earlier - and apple_names when tuning for lldb
on MachO.
nameTableKind: GNU always gives gnu_pubnames

llvm-svn: 358931

5 years ago[SelectionDAG] move splat util functions up from x86 lowering
Sanjay Patel [Mon, 22 Apr 2019 22:43:36 +0000 (22:43 +0000)]
[SelectionDAG] move splat util functions up from x86 lowering

This was supposed to be NFC, but the change in SDLoc
definitions causes instruction scheduling changes.

There's nothing x86-specific in this code, and it can
likely be used from DAGCombiner's simplifyVBinOp().

llvm-svn: 358930

5 years agoFix a bug in my change to ModulesDidLoad in r357955.
Jason Molenda [Mon, 22 Apr 2019 22:42:29 +0000 (22:42 +0000)]
Fix a bug in my change to ModulesDidLoad in r357955.
In the process of hoisting the LoadScriptingResourceForModule
out of Target::ModuleAdded and into Target::ModulesDidLoad,
I had ModulesDidLoad fetching the Target's entire image list
and look for scripting resources in those -- instead of only
looking for scripting resources in the modules that had
been added to the target's image list.

<rdar://problem/50065315>

llvm-svn: 358929

5 years ago[Docs] Move API docs to the front page
Jonas Devlieghere [Mon, 22 Apr 2019 22:41:55 +0000 (22:41 +0000)]
[Docs] Move API docs to the front page

This moves the links to the C++ and Python API docs up to the main page.
As of now the links are still broken [1], but at least this will prevent
the additional frustration of searching for the links only to find out
they're broken.

[1] http://lists.llvm.org/pipermail/lldb-dev/2019-April/014992.html

llvm-svn: 358928

5 years agoTry to work around compile errors with older versions of GCC.
Adrian Prantl [Mon, 22 Apr 2019 22:40:37 +0000 (22:40 +0000)]
Try to work around compile errors with older versions of GCC.

llvm-svn: 358927

5 years agoRelax test to check for a valid number instead of a specific number.
Douglas Yung [Mon, 22 Apr 2019 22:31:57 +0000 (22:31 +0000)]
Relax test to check for a valid number instead of a specific number.

llvm-svn: 358926

5 years agoRename C++ TestGlobalVariables.py to have a distinct name from C version.
Adrian Prantl [Mon, 22 Apr 2019 22:16:33 +0000 (22:16 +0000)]
Rename C++ TestGlobalVariables.py to have a distinct name from C version.

llvm-svn: 358924

5 years ago[AMDGPU] Fix an issue in `op_sel_hi` skipping.
Michael Liao [Mon, 22 Apr 2019 22:05:49 +0000 (22:05 +0000)]
[AMDGPU] Fix an issue in `op_sel_hi` skipping.

Summary:
- Only apply packed literal `op_sel_hi` skipping on operands requiring
  packed literals. Even an instruction is `packed`, it may have operand
  requiring non-packed literal, such as `v_dot2_f32_f16`.

Reviewers: rampitec, arsenm, kzhuravl

Subscribers: jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 358922

5 years ago[dsymutil] Collect parseable Swift interfaces in the .dSYM bundle.
Adrian Prantl [Mon, 22 Apr 2019 21:33:22 +0000 (21:33 +0000)]
[dsymutil] Collect parseable Swift interfaces in the .dSYM bundle.

When a Swift module built with debug info imports a library without
debug info from a textual interface, the textual interface is
necessary to reconstruct types defined in the library's interface. By
recording the Swift interface files in DWARF dsymutil can collect them
and LLDB can find them.

This patch teaches dsymutil to look for DW_TAG_imported_modules and
records all references to parseable Swift ingterfrace files and copies
them to

  a.out.dSYM/Contents/Resources/<Arch>/<ModuleName>.swiftinterface

<rdar://problem/49751748>

llvm-svn: 358921

5 years ago[InstCombine] Eliminate stores to constant memory
Philip Reames [Mon, 22 Apr 2019 20:28:19 +0000 (20:28 +0000)]
[InstCombine] Eliminate stores to constant memory

If we have a store to a piece of memory which is known constant, then we know the store must be storing back the same value. As a result, the store (or memset, or memmove) must either be down a dead path, or a noop. In either case, it is valid to simply remove the store.

The motivating case for this involves a memmove to a buffer which is constant down a path which is dynamically dead.

Note that I'm choosing to implement the less aggressive of two possible semantics here. We could simply say that the store *is undefined*, and prune the path. Consensus in the review was that the more aggressive form might be a good follow on change at a later date.

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

llvm-svn: 358919

5 years ago[EditLineTest] Not always TERM is available, e.g. on some bots.
Davide Italiano [Mon, 22 Apr 2019 20:27:10 +0000 (20:27 +0000)]
[EditLineTest] Not always TERM is available, e.g. on some bots.

llvm-svn: 358918

5 years ago[VerifyDiagnosticConsumer] Document -verify=<prefixes> in doxygen
Joel E. Denny [Mon, 22 Apr 2019 20:25:06 +0000 (20:25 +0000)]
[VerifyDiagnosticConsumer] Document -verify=<prefixes> in doxygen

Previously, it was only documented by `-cc1 -help`, so people weren't
aware of it, as discussed in D60732.

Reviewed By: Charusso, NoQ

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

llvm-svn: 358917

5 years ago[Reproducers] Fix lifetime issue
Jonas Devlieghere [Mon, 22 Apr 2019 20:05:02 +0000 (20:05 +0000)]
[Reproducers] Fix lifetime issue

Deallocating the data recorder in during the ::Keep() operation causes
problems down the line when exiting the debugger. The command
interpreter still holds a pointer to the now deallocated object and has
no way to know it no longer exists. This is exactly what the m_record
flag was meant for, although it wasn't hooked up properly either.

llvm-svn: 358916

5 years ago[libcxx] Update gen_link_script.py to support different input and output
Petr Hosek [Mon, 22 Apr 2019 19:51:33 +0000 (19:51 +0000)]
[libcxx] Update gen_link_script.py to support different input and output

This enables the use of this script from other build systems like
GN which don't support post-build actions as well as for static
archives.

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

llvm-svn: 358915

5 years ago[Support] unflake TempFileCollisions test
Bob Haarman [Mon, 22 Apr 2019 19:46:25 +0000 (19:46 +0000)]
[Support] unflake TempFileCollisions test

Summary:
This test was added to verify that createUniqueEntity() does
not enter an infinite loop when all possible names are taken. However,
it also checked that all possible names are generated, which is flaky
(because the names are generated randomly). This change increases the
number of attempts we make to make flakes exceedingly
unlikely (3.88e-62).

Reviewers: fedor.sergeev, rsmith

Reviewed By: fedor.sergeev

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 358914

5 years ago[InstSimplify] Move masked.gather w/no active lanes handling to InstSimplify from...
Philip Reames [Mon, 22 Apr 2019 19:30:01 +0000 (19:30 +0000)]
[InstSimplify] Move masked.gather w/no active lanes handling to InstSimplify from InstCombine

In the process, use the existing masked.load combine which is slightly stronger, and handles a mix of zero and undef elements in the mask.

llvm-svn: 358913

5 years agogn build: Merge r358869
Nico Weber [Mon, 22 Apr 2019 19:25:40 +0000 (19:25 +0000)]
gn build: Merge r358869

llvm-svn: 358912

5 years agoUse correct way to test for MIPS arch after rOMP355687
Dimitry Andric [Mon, 22 Apr 2019 19:20:46 +0000 (19:20 +0000)]
Use correct way to test for MIPS arch after rOMP355687

Summary:
I ran into some issues after rOMP355687, where __atomic_fetch_add was
being used incorrectly on x86, and this turns out to be caused by the
following added conditionals:

```
#if defined(KMP_ARCH_MIPS)
```

The problem is, these macros are always defined, and are either 0 or 1
depending on the architecture.  E.g. the correct way to test for MIPS
is:

```
#if KMP_ARCH_MIPS
```

Reviewers: petarj, jlpeyton, Hahnfeld, AndreyChurbanov

Reviewed By: petarj, AndreyChurbanov

Subscribers: AndreyChurbanov, sdardis, arichardson, atanasyan, jfb, jdoerfert, openmp-commits, llvm-commits

Tags: #openmp

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

llvm-svn: 358911

5 years agoUse const DebugLoc&
Matt Arsenault [Mon, 22 Apr 2019 19:14:27 +0000 (19:14 +0000)]
Use const DebugLoc&

llvm-svn: 358910

5 years agoAMDGPU: Skip debug instructions in assert
Matt Arsenault [Mon, 22 Apr 2019 19:14:26 +0000 (19:14 +0000)]
AMDGPU: Skip debug instructions in assert

These are inserted after branch relaxation, and for some reason it's
decided to put them in the long branch expansion block. It's probably
not great to rely on the source block address, so this should probably
be switched to being PC relative instead of relying on the block
address

llvm-svn: 358909

5 years ago[libc++][test] Update some wstring_convert tests for MSVC quirks
Casey Carter [Mon, 22 Apr 2019 19:08:13 +0000 (19:08 +0000)]
[libc++][test] Update some wstring_convert tests for MSVC quirks

Due to MSVC's decision to encode `wchar_t` as UTF-16, it rejects wide
character/string literals that expect a character value greater than
`\xffff`. UTF-16 `wchar_t` is clearly non-conforming, given that the
standard requires wchar_t to be capable of representing all characters
in the supported wide character execution sets, but rejecting e.g.
`\x40003` is a reasonably sane compromise given that encoding choice:
there's an expectation that `\xFOO` produces a single character in the
resulting literal. Consequently `L'\x40003'`/`L"\x40003"` are ill-formed
literals on MSVC. `L'\U00040003'` is a high surrogate (and produces a
warning about ignoring the "second character" in a multi-character
literal), and `L"\U00040003"` is a perfectly-valid `const wchar_t[3]`.

This change updates these tests to use universal-character-names instead
of raw values for the intended character values, which technically makes
them portable even to implementations that don't use a unicode
transformation format encoding for their wide character execution
character set. The two-character literal `L"\u1005e"` is awkward - the
`e` looks like part of the UCN's hex encoding - but necessary to compile
in '03 mode since '03 didn't allow UCNs to be used for members of the
basic execution character set even in character/string literals.

I've also eliminated the extraneous `\x00` "bonus null-terminator" in
some of the string literals which doesn't affect the tested behavior.

I'm sorry about using `*L"\U00040003"` in `conversions.string/to_bytes.pass.cpp`,
but it's correct for platforms with 32-bit wchar_t, *and* doesn't
trigger narrowing warnings as did the prior `CharT(0x40003)`.

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

llvm-svn: 358908

5 years ago[Tests] Revise a test as requested by reviewer in D59703
Philip Reames [Mon, 22 Apr 2019 18:51:58 +0000 (18:51 +0000)]
[Tests] Revise a test as requested by reviewer in D59703

llvm-svn: 358907

5 years ago[Tests] Add a negative test for masked.gather part of D59703
Philip Reames [Mon, 22 Apr 2019 18:28:44 +0000 (18:28 +0000)]
[Tests] Add a negative test for masked.gather part of D59703

llvm-svn: 358906

5 years ago[ASTMatchers] Introduce Objective-C matchers `isClassMessage`, `isClassMethod`, and...
Ben Hamilton [Mon, 22 Apr 2019 17:54:11 +0000 (17:54 +0000)]
[ASTMatchers] Introduce Objective-C matchers `isClassMessage`, `isClassMethod`, and `isInstanceMethod`

Summary:
isClassMessage is an equivalent to isInstanceMessage for ObjCMessageExpr, but matches message expressions to classes.

isClassMethod and isInstanceMethod check whether a method declaration (or definition) is for a class method or instance method (respectively).

Contributed by @mywman!

Reviewers: benhamilton, klimek, mwyman

Reviewed By: benhamilton, mwyman

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 358904

5 years ago[IPSCCP] Add missing `AssumptionCacheTracker` dependency
Justin Bogner [Mon, 22 Apr 2019 17:38:29 +0000 (17:38 +0000)]
[IPSCCP] Add missing `AssumptionCacheTracker` dependency

Back in August, r340525 introduced a dependency on the assumption
cache tracker in the ipsccp pass, but that commit missed a call to
INITIALIZE_PASS_DEPENDENCY, which leaves the assumption cache
improperly registered if SCCP is the only thing that pulls it in.

llvm-svn: 358903

5 years ago[OPENMP][NVPTX] Fix the test, NFC.
Alexey Bataev [Mon, 22 Apr 2019 17:25:31 +0000 (17:25 +0000)]
[OPENMP][NVPTX] Fix the test, NFC.

Fix the test to run it really in SPMD mode without runtime. Previously
it was run in SPMD + full runtime mode and does not allow to cehck the
functionality correctly.

llvm-svn: 358902

5 years ago[LPM/BPI] Preserve BPI through trivial loop pass pipeline (e.g. LCSSA, LoopSimplify)
Philip Reames [Mon, 22 Apr 2019 17:13:43 +0000 (17:13 +0000)]
[LPM/BPI] Preserve BPI through trivial loop pass pipeline (e.g. LCSSA, LoopSimplify)

Currently, we do not expose BPI to loop passes at all. In the old pass manager, we appear to have been ignoring the fact that LCSSA and/or LoopSimplify didn't preserve BPI, and making it available to the following loop passes anyways.  In the new one, it's invalidated before running any loop pass if either LCSSA or LoopSimplify actually make changes. If they don't make changes, then BPI is valid and available.  So, we go ahead and teach LCSSA and LoopSimplify how to preserve BPI for consistency between old and new pass managers.

This patch avoids an invalidation between the two requires in the following trivial pass pipeline:
opt -passes="requires<branch-prob>,loop(no-op-loop),requires<branch-prob>"
(when the input file is one which requires either LCSSA or LoopSimplify to canonicalize the loops)

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

llvm-svn: 358901

5 years ago[PGO/SamplePGO][NFC] Move the function updateProfWeight from Instruction
Wei Mi [Mon, 22 Apr 2019 17:04:51 +0000 (17:04 +0000)]
[PGO/SamplePGO][NFC] Move the function updateProfWeight from Instruction
to CallInst.

The issue was raised here: https://reviews.llvm.org/D60903#1472783

The function Instruction::updateProfWeight is only used for CallInst in
profile update. From the current interface, it is very easy to think that
the function can also be used for branch instruction. However, Branch
instruction does't need the scaling the function provides for
branch_weights and VP (value profile), in addition, scaling may introduce
inaccuracy for branch probablity.

The patch moves the function updateProfWeight from Instruction class to
CallInst to remove the confusion. The patch also changes the scaling of
branch_weights from a loop to a block because we know that ProfileData
for branch_weights of CallInst will only have two operands at most.

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

llvm-svn: 358900

5 years ago[WebAssembly] Error on relocations against undefined data symbols.
Sam Clegg [Mon, 22 Apr 2019 16:12:54 +0000 (16:12 +0000)]
[WebAssembly] Error on relocations against undefined data symbols.

We can't (currently) meaningfully resolve certain types of relocations
against undefined data symbols.  Previously when `--allow-undefined` was
used we were treating such relocation much like weak data symbols and
simply inserting zeros.  This change turns such use cases in to an
error.

This means that `--allow-undefined` is no longer effective for data
symbols.

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

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

llvm-svn: 358899

5 years ago[sema][objc] Minor refactor to OverrideSearch. NFCI.
Matt Davis [Mon, 22 Apr 2019 16:04:44 +0000 (16:04 +0000)]
[sema][objc] Minor refactor to OverrideSearch. NFCI.

Summary:
* Removed a member that was only used during construction.
* Use range-based for iteration when accessing the result of the search.
* Require an `ObjCMethodDecl` reference upon construction of an
* Constify.

Reviewers: rjmccall

Reviewed By: rjmccall

Subscribers: llvm-commits

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

llvm-svn: 358898

5 years agoUse llvm::stable_sort. NFC
Fangrui Song [Mon, 22 Apr 2019 15:53:43 +0000 (15:53 +0000)]
Use llvm::stable_sort. NFC

llvm-svn: 358897

5 years ago[NFC] Fix typo in debug log
Louis Dionne [Mon, 22 Apr 2019 15:40:50 +0000 (15:40 +0000)]
[NFC] Fix typo in debug log

llvm-svn: 358896

5 years agoRemove spurious semicolons; NFC.
Aaron Ballman [Mon, 22 Apr 2019 15:31:09 +0000 (15:31 +0000)]
Remove spurious semicolons; NFC.

llvm-svn: 358895

5 years agoAMDGPU/GlobalISel: Fix non-power-of-2 G_EXTRACT sources
Matt Arsenault [Mon, 22 Apr 2019 15:22:46 +0000 (15:22 +0000)]
AMDGPU/GlobalISel: Fix non-power-of-2 G_EXTRACT sources

llvm-svn: 358894

5 years agoSTLExtras: add stable_sort wrappers
Fangrui Song [Mon, 22 Apr 2019 15:19:13 +0000 (15:19 +0000)]
STLExtras: add stable_sort wrappers

llvm-svn: 358893

5 years agoGlobalISel: Legalize scalar G_EXTRACT sources
Matt Arsenault [Mon, 22 Apr 2019 15:10:42 +0000 (15:10 +0000)]
GlobalISel: Legalize scalar G_EXTRACT sources

llvm-svn: 358892

5 years agollvm-undname: Fix an assert-on-invalid, found by oss-fuzz
Nico Weber [Mon, 22 Apr 2019 15:05:18 +0000 (15:05 +0000)]
llvm-undname: Fix an assert-on-invalid, found by oss-fuzz

llvm-svn: 358891

5 years agoAMDGPU: Fix not checking for copy when looking at copy src
Matt Arsenault [Mon, 22 Apr 2019 14:54:39 +0000 (14:54 +0000)]
AMDGPU: Fix not checking for copy when looking at copy src

Effectively reverts r356956. The check for isFullCopy was excessive,
but there still needs to be a check that this is a copy.

llvm-svn: 358890

5 years ago[LLD][ELF] - Remove a binary from the inputs. NFCI.
George Rimar [Mon, 22 Apr 2019 14:53:32 +0000 (14:53 +0000)]
[LLD][ELF] - Remove a binary from the inputs. NFCI.

section-index.elf was removed and the corresponding test
was replaced with a yaml2obj based test.

llvm-svn: 358889

5 years ago[AMDGPU][MC] Corrected parsing of SP3 'neg' modifier
Dmitry Preobrazhensky [Mon, 22 Apr 2019 14:35:47 +0000 (14:35 +0000)]
[AMDGPU][MC] Corrected parsing of SP3 'neg' modifier

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

Reviewers: artem.tamazov, arsenm

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

llvm-svn: 358888

5 years ago[TargetLowering][AMDGPU][X86] Improve SimplifyDemandedBits bitcast handling
Simon Pilgrim [Mon, 22 Apr 2019 14:04:35 +0000 (14:04 +0000)]
[TargetLowering][AMDGPU][X86] Improve SimplifyDemandedBits bitcast handling

This patch adds support for BigBitWidth -> SmallBitWidth bitcasts, splitting the DemandedBits/Elts accordingly.

The AMDGPU backend needed an extra  (srl (and x, c1 << c2), c2) -> (and (srl(x, c2), c1) combine to encourage BFE creation, I investigated putting this in DAGCombine but it caused a lot of noise on other targets - some improvements, some regressions.

The X86 changes are all definite wins.

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

llvm-svn: 358887

5 years ago[DAGCombiner] make variable name less ambiguous; NFC
Sanjay Patel [Mon, 22 Apr 2019 13:42:50 +0000 (13:42 +0000)]
[DAGCombiner] make variable name less ambiguous; NFC

llvm-svn: 358886

5 years ago[LLD][ELF] - Do not forget to use ch_addralign field after decompressing the sections.
George Rimar [Mon, 22 Apr 2019 13:40:42 +0000 (13:40 +0000)]
[LLD][ELF] - Do not forget to use ch_addralign field after decompressing the sections.

LLD did not use ELF::Chdr::ch_addralign for decompressed sections.
This resulted in a broken output.

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

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

llvm-svn: 358885

5 years ago[DAGCombiner] prepare shuffle-of-splat to handle more patterns; NFC
Sanjay Patel [Mon, 22 Apr 2019 13:36:07 +0000 (13:36 +0000)]
[DAGCombiner] prepare shuffle-of-splat to handle more patterns; NFC

llvm-svn: 358884

5 years ago[LLVM-C] Add accessors to the default floating-point metadata node
Robert Widmann [Mon, 22 Apr 2019 13:13:22 +0000 (13:13 +0000)]
[LLVM-C] Add accessors to the default floating-point metadata node

Summary: Add a getter and setter pair for floating-point accuracy metadata.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 358883

5 years ago[Sema] ADL: Associated namespaces for class types and enumeration types (CWG 1691)
Bruno Ricci [Mon, 22 Apr 2019 12:19:00 +0000 (12:19 +0000)]
[Sema] ADL: Associated namespaces for class types and enumeration types (CWG 1691)

CWG 1691 changed the definition of the namespaces associated with a class
type or enumeration type.

For a class type, the associated namespaces are the innermost enclosing
namespaces of the associated classes. For an enumeration type, the associated
namespace is the innermost enclosing namespace of its declaration.

This also fixes CWG 1690 and CWG 1692.

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

Reviewed By: rjmccall, rsmith

llvm-svn: 358882

5 years ago[Sema][NFC] Add more tests for the behavior of argument-dependent name lookup
Bruno Ricci [Mon, 22 Apr 2019 11:40:31 +0000 (11:40 +0000)]
[Sema][NFC] Add more tests for the behavior of argument-dependent name lookup

The goal here is to exercise each rule in [basic.lookup.argdep] at least once.
These new tests expose what I believe are 2 issues:

1. CWG 1691 needs to be implemented (p2:  [...] Its associated namespaces are
   the innermost enclosing namespaces of its associated classes [...]) The
   corresponding tests are adl_class_type::X2 and adl_class_type::X5.

2. The end of paragraph 2 ([...] Additionally, if the aforementioned set of
   overloaded functions is named with a template-id, its associated classes
   and namespaces also include those of its type template-arguments and its
   template template-arguments.) is not implemented. Closely related, the
   restriction on non-dependent parameter types in this same paragraph needs
   to be removed. The corresponding tests are in adl_overload_set (both issues
   are from CWG 997).

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

Reviewed By: riccibruno, Quuxplusone

llvm-svn: 358881

5 years ago[NewPM] Add Option handling for SimpleLoopUnswitch
Serguei Katkov [Mon, 22 Apr 2019 10:35:07 +0000 (10:35 +0000)]
[NewPM] Add Option handling for SimpleLoopUnswitch

This patch enables passing options to SimpleLoopUnswitch via the passes pipeline.

Reviewers: chandlerc, fedor.sergeev, leonardchan, philip.pfaffe
Reviewed By: fedor.sergeev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D60676

llvm-svn: 358880

5 years ago[AMDGPU] Regenerate uitofp i8 to float conversion tests.
Simon Pilgrim [Mon, 22 Apr 2019 10:19:09 +0000 (10:19 +0000)]
[AMDGPU] Regenerate uitofp i8 to float conversion tests.

Prep work for D60462

llvm-svn: 358879

5 years ago[NewPM] Add dummy Test for LoopVectorize option parsing.
Serguei Katkov [Mon, 22 Apr 2019 09:53:26 +0000 (09:53 +0000)]
[NewPM] Add dummy Test for LoopVectorize option parsing.

llvm-svn: 358878

5 years ago[analyzer][www] Moving MoveChecker out of alpha is no longer an open project.
Kristof Umann [Mon, 22 Apr 2019 09:20:23 +0000 (09:20 +0000)]
[analyzer][www] Moving MoveChecker out of alpha is no longer an open project.

llvm-svn: 358877

5 years agoRevert "[ConstantRange] Rename make{Guaranteed -> Exact}NoWrapRegion() NFC"
Nikita Popov [Mon, 22 Apr 2019 09:01:38 +0000 (09:01 +0000)]
Revert "[ConstantRange] Rename make{Guaranteed -> Exact}NoWrapRegion() NFC"

This reverts commit 7bf4d7c07f2fac862ef34c82ad0fef6513452445.

After thinking about this more, this isn't right, the range is not exact
in the same sense as makeExactICmpRegion(). This needs a separate
function.

llvm-svn: 358876

5 years ago[ConstantRange] Rename make{Guaranteed -> Exact}NoWrapRegion() NFC
Nikita Popov [Mon, 22 Apr 2019 08:36:05 +0000 (08:36 +0000)]
[ConstantRange] Rename make{Guaranteed -> Exact}NoWrapRegion() NFC

Following D60632 makeGuaranteedNoWrapRegion() always returns an
exact nowrap region. Rename the function accordingly. This is in
line with the naming of makeExactICmpRegion().

llvm-svn: 358875

5 years ago[LLD][ELF] - Handle quoted strings in the linker scripts correctly.
George Rimar [Mon, 22 Apr 2019 07:57:07 +0000 (07:57 +0000)]
[LLD][ELF] - Handle quoted strings in the linker scripts correctly.

This is the https://bugs.llvm.org/show_bug.cgi?id=41356,

Seems it is kind of unusual case but it is possible to
have sections that require quotes for their namings.
Like "aaa bbb".

This patch adds support for those.

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

llvm-svn: 358874

5 years ago[NativePDB] Add anonymous namespaces support
Aleksandr Urakov [Mon, 22 Apr 2019 07:14:40 +0000 (07:14 +0000)]
[NativePDB] Add anonymous namespaces support

Summary:
This patch adds anonymous namespaces support to the native PDB plugin.

I had to reference from the main function variables of the types that are inside
of the anonymous namespace to include them in debug info. Without the references
they are not included. I think it's because they are static, then are visible
only in the current translation unit, so they are not needed without any
references to them.

There is also the problem case with variables of types that are nested in
template structs. For now I've left FIXME in the test because this case is not
related to the change.

Reviewers: zturner, asmith, labath, stella.stamenova, amccarth

Reviewed By: amccarth

Subscribers: zloyrobot, aprantl, teemperor, lldb-commits, leonid.mashinskiy

Tags: #lldb

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

llvm-svn: 358873

5 years ago[X86] Reject 512-bit types in getRegForInlineAsmConstraint when AVX512 is not enabled...
Craig Topper [Mon, 22 Apr 2019 06:12:02 +0000 (06:12 +0000)]
[X86] Reject 512-bit types in getRegForInlineAsmConstraint when AVX512 is not enabled. Same for 256 bit and AVX.

llvm-svn: 358872

5 years ago[WebAssembly] Fix R_WASM_FUNCTION_OFFSET_I32 relocation warnings
Sam Clegg [Mon, 22 Apr 2019 05:26:44 +0000 (05:26 +0000)]
[WebAssembly] Fix R_WASM_FUNCTION_OFFSET_I32 relocation warnings

We were incorrectly used the symbol table version of the function rather
than the object-local version when checking the existing relocation
value.

This was causing erroneous warnings for comat symbols defined in
multiple object.s

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

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

llvm-svn: 358871

5 years ago[ELF][X86] Allow R_386_TLS_LDO_32 and R_X86_64_DTPOFF{32,64} to preemptable local...
Fangrui Song [Mon, 22 Apr 2019 03:10:40 +0000 (03:10 +0000)]
[ELF][X86] Allow R_386_TLS_LDO_32 and R_X86_64_DTPOFF{32,64} to preemptable local-dynamic symbols

Summary:
Fixes PR35242. A simplified reproduce:

    thread_local int i; int f() { return i; }

% {g++,clang++} -fPIC -shared -ftls-model=local-dynamic -fuse-ld=lld a.cc
ld.lld: error: can't create dynamic relocation R_X86_64_DTPOFF32 against symbol: i in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

In isStaticLinkTimeConstant(), Syn.IsPreemptible is true, so it is not
seen as a constant. The error is then issued in processRelocAux().

A symbol of the local-dynamic TLS model cannot be preempted but it can
preempt symbols of the global-dynamic TLS model in other DSOs.
So it makes some sense that the variable is not static.

This patch fixes the linking error by changing getRelExpr() on
R_386_TLS_LDO_32 and R_X86_64_DTPOFF{32,64} from R_ABS to R_DTPREL.
R_PPC64_DTPREL_* and R_MIPS_TLS_DTPREL_* need similar fixes, but they are not handled in this patch.

As a bonus, we use `if (Expr == R_ABS && !Config->Shared)` to find
ld-to-le opportunities. R_ABS is overloaded here for such STT_TLS symbols.
A dedicated R_DTPREL is clearer.

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

llvm-svn: 358870

5 years ago[JITLink] Remove a lot of reduntant 'JITLink_' prefixes. NFC.
Lang Hames [Mon, 22 Apr 2019 03:03:09 +0000 (03:03 +0000)]
[JITLink] Remove a lot of reduntant 'JITLink_' prefixes. NFC.

llvm-svn: 358869

5 years ago[ELF][X86] Rename R_RELAX_TLS_GD_TO_IE_END to R_RELAX_TLS_GD_TO_IE_GOTPLT
Fangrui Song [Mon, 22 Apr 2019 02:48:37 +0000 (02:48 +0000)]
[ELF][X86] Rename R_RELAX_TLS_GD_TO_IE_END to R_RELAX_TLS_GD_TO_IE_GOTPLT

Summary:
This relocation type is used by R_386_TLS_GD. Its formula is the same as
R_GOTPLT (e.g R_X86_64_GOT{32,64} R_386_TLS_GOTIE). Rename it to be clearer.

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

llvm-svn: 358868

5 years ago[cmake] Add llvm-jit to LLVM_TEST_DEPENDS
Fangrui Song [Mon, 22 Apr 2019 02:23:09 +0000 (02:23 +0000)]
[cmake] Add llvm-jit to LLVM_TEST_DEPENDS

Otherwise llvm-jit would say "utils/lit/lit/llvm/subst.py:127: note: Did not find llvm-jitlink in ..."

llvm-svn: 358867

5 years ago[clangd] Support dependent bases in type hierarchy
Fangrui Song [Mon, 22 Apr 2019 01:38:53 +0000 (01:38 +0000)]
[clangd] Support dependent bases in type hierarchy

Patch by Nathan Ridge!

Dependent bases are handled heuristically, by replacing them with the
class template that they are a specialization of, where possible. Care
is taken to avoid infinite recursion.

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

llvm-svn: 358866

5 years ago[JITLink] Fix section start address calculation in eh-frame recorder.
Lang Hames [Mon, 22 Apr 2019 01:35:16 +0000 (01:35 +0000)]
[JITLink] Fix section start address calculation in eh-frame recorder.

Section atoms are not sorted, so we need to scan the whole section to find the
start address.

No test case: Found by inspection, and any reproduction would depend on pointer
ordering.

llvm-svn: 358865

5 years agoAttemp get llvm-jitlink building on Windows
Nico Weber [Sun, 21 Apr 2019 23:50:24 +0000 (23:50 +0000)]
Attemp get llvm-jitlink building on Windows

By removing an include of dlfcn.h that looks unused.

And clang-format a too-long line while here.

llvm-svn: 358864

5 years ago[JITLink] Add an option to dump relocated section content.
Lang Hames [Sun, 21 Apr 2019 20:34:19 +0000 (20:34 +0000)]
[JITLink] Add an option to dump relocated section content.

The -dump-relocated-section-content option will dump the contents of each
section after relocations are applied, and before any checks are run or
code executed.

llvm-svn: 358863

5 years agogn build: Re-run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Sun, 21 Apr 2019 20:14:21 +0000 (20:14 +0000)]
gn build: Re-run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`

llvm-svn: 358862

5 years agogn build: Merge r358749
Nico Weber [Sun, 21 Apr 2019 20:08:45 +0000 (20:08 +0000)]
gn build: Merge r358749

Since the symlinks list for llvm-symbolizer is now never empty,
the :symlinks target no longer needs an explicit dep on :llvm-symbolizer
-- there will be at least one dep on a symlink, and each symlink depends
on :llvm-symbolizer already.

Since llvm-symbolizer:symlinks now produces symlinks that check-llvm
uses, make llvm/test depend on the symlink target.

llvm-svn: 358861

5 years agogn build: Merge r358818 (JITLink)
Nico Weber [Sun, 21 Apr 2019 19:45:37 +0000 (19:45 +0000)]
gn build: Merge r358818 (JITLink)

llvm-svn: 358860

5 years ago[cmake] Fix bug in r358779 - [CMake] Pass monorepo build settings in cross compile
Don Hinton [Sun, 21 Apr 2019 19:20:13 +0000 (19:20 +0000)]
[cmake] Fix bug in r358779 - [CMake] Pass monorepo build settings in cross compile

Escape semicolons in the targets list so that cmake doesn't expand
them to spaces.

llvm-svn: 358859

5 years agoAttempt to fix LLVM_ENABLE_THREADS=OFF build after r358665
Nico Weber [Sun, 21 Apr 2019 19:18:41 +0000 (19:18 +0000)]
Attempt to fix LLVM_ENABLE_THREADS=OFF build after r358665

llvm-svn: 358858

5 years agollvm-undname: Fix hex escapes in wchar_t, char16_t, char32_t strings
Nico Weber [Sun, 21 Apr 2019 17:19:27 +0000 (17:19 +0000)]
llvm-undname: Fix hex escapes in wchar_t, char16_t, char32_t strings

llvm-undname used to put '\x' in front of every pair of nibbles, but
u"\xD7\xFF" produces a string with 6 bytes: \xD7 \0 \xFF \0 (and \0\0). Correct
for a single character (plus terminating \0) is u\xD7FF instead.
Now, wchar_t, char16_t, and char32_t strings roundtrip from source to
clang-cl (and cl.exe) and then llvm-undname.

(...at least as long as it's not a string like L"\xD7FF" L"foo" which
gets demangled as L"\xD7FFfoo", where the compiler then considers the
"f" as part of the hex escape. That seems ok.)

Also add a comment saying that the "almost-valid" char32_t string I
added in my last commit is actually produced by compilers.

llvm-svn: 358857

5 years agollvm-undname: Fix stack overflow on almost-valid
Nico Weber [Sun, 21 Apr 2019 16:58:25 +0000 (16:58 +0000)]
llvm-undname: Fix stack overflow on almost-valid

If a unsigned with all 4 bytes non-0 was passed to outputHex(), there
were two off-by-ones in it:

- Both MaxPos and Pos left space for the final \0, which left the buffer
  one byte to small. Set MaxPos to 16 instead of 15 to fix.

- The `assert(Pos >= 0);` was after a `Pos--`, move it up one line.

Since valid Unicode codepoints are <= 0x10ffff, this could never really
happen in practice.

Found by oss-fuzz.

llvm-svn: 358856

5 years ago[ConstantRange] Add saturating add/sub methods
Nikita Popov [Sun, 21 Apr 2019 15:23:05 +0000 (15:23 +0000)]
[ConstantRange] Add saturating add/sub methods

Add support for uadd_sat and friends to ConstantRange, so we can
handle uadd.sat and friends in LVI. The implementation is forwarding
to the corresponding APInt methods with appropriate bounds.

One thing worth pointing out here is that the handling of wrapping
ranges is not maximally accurate. A simple example is that adding 0
to a wrapped range will return a full range, rather than the original
wrapped range. The tests also only check that the non-wrapping
envelope is correct and minimal.

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

llvm-svn: 358855

5 years ago[ConstantRange] Add getNonEmpty() constructor
Nikita Popov [Sun, 21 Apr 2019 15:22:54 +0000 (15:22 +0000)]
[ConstantRange] Add getNonEmpty() constructor

ConstantRanges have an annoying special case: If upper and lower are
the same, it can be either an empty or a full set. When constructing
constant ranges nearly always a full set is intended, but this still
requires an explicit check in many places.

This revision adds a getNonEmpty() constructor that disambiguates this
case: If upper and lower are the same, a full set is created.

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

llvm-svn: 358854

5 years ago[AArch64] add tests with multiple binop+splat vals; NFC
Sanjay Patel [Sun, 21 Apr 2019 15:01:19 +0000 (15:01 +0000)]
[AArch64] add tests with multiple binop+splat vals; NFC

See D60890 for context.

llvm-svn: 358853