platform/upstream/llvm.git
5 years ago[msan] Properly guard tests added by r355348; NFC
Hubert Tong [Fri, 8 Mar 2019 19:57:27 +0000 (19:57 +0000)]
[msan] Properly guard tests added by r355348; NFC

r355348 uses builtins without proper guards, breaking the test on
various platforms.

llvm-svn: 355718

5 years ago[TSan] Initialize libdispatch interceptors if necessary
Julian Lettner [Fri, 8 Mar 2019 19:52:45 +0000 (19:52 +0000)]
[TSan] Initialize libdispatch interceptors if necessary

On Linux (and other non-Darwin platforms) we need to initialize
interceptors. Since tsan_libdispatch.cc is compiled optionally, add a
weak default implementation of `InitializeLibdispatchInterceptors`.

Reviewed By: dvyukov

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

llvm-svn: 355717

5 years ago[DAGCombiner] fold (add (add (xor a, -1), b), 1) -> (sub b, a)
Amaury Sechet [Fri, 8 Mar 2019 19:39:32 +0000 (19:39 +0000)]
[DAGCombiner] fold (add (add (xor a, -1), b), 1) -> (sub b, a)

Summary: This pattern is sometime created after legalization.

Reviewers: efriedma, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 355716

5 years ago[CFLAnders] Fix typo in comment; NFC
George Burgess IV [Fri, 8 Mar 2019 19:28:55 +0000 (19:28 +0000)]
[CFLAnders] Fix typo in comment; NFC

Patch by Enna1!

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

llvm-svn: 355715

5 years ago[RegisterCoalescer] Limit the number of joins for large live interval with
Wei Mi [Fri, 8 Mar 2019 19:25:32 +0000 (19:25 +0000)]
[RegisterCoalescer] Limit the number of joins for large live interval with
many valnos.

Recently we found compile time out problem in several cases when
SpeculativeLoadHardening was enabled. The significant compile time was spent
in register coalescing pass, where register coalescer tried to join many other
live intervals with some very large live intervals with many valnos.

Specifically, every time JoinVals::mapValues is called, computeAssignment will
be called by getNumValNums() times of the target live interval. If the large
live interval has N valnos and has N copies associated with it, trying to
coalescing those copies will at least cost N^2 complexity.

The patch adds some limit to the effort trying to join those very large live
intervals with others. By default, for live interval with > 100 valnos, and
when it has been coalesced with other live interval by more than 100 times,
we will stop coalescing for the live interval anymore. That put a compile
time cap for the N^2 algorithm and effectively solves the compile time
problem we saw.

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

llvm-svn: 355714

5 years ago[x86] prevent infinite looping from inverse shuffle transforms
Sanjay Patel [Fri, 8 Mar 2019 19:20:28 +0000 (19:20 +0000)]
[x86] prevent infinite looping from inverse shuffle transforms

llvm-svn: 355713

5 years ago[X86] Add test case for PR22473
Simon Pilgrim [Fri, 8 Mar 2019 19:16:26 +0000 (19:16 +0000)]
[X86] Add test case for PR22473

llvm-svn: 355712

5 years ago[Reproducers] Add missing LLDB_RECORD_DUMMY macros
Jonas Devlieghere [Fri, 8 Mar 2019 19:09:27 +0000 (19:09 +0000)]
[Reproducers] Add missing LLDB_RECORD_DUMMY macros

Re-ran lldb-inst on the API folder to insert missing LLDB_RECORD_DUMMY
macros.

llvm-svn: 355711

5 years ago[lldb-instr] Support LLDB_RECORD_DUMMY
Jonas Devlieghere [Fri, 8 Mar 2019 18:33:40 +0000 (18:33 +0000)]
[lldb-instr] Support LLDB_RECORD_DUMMY

Extend lldb-instr to insert LLDB_RECORD_DUMMY macros for currently
unsupported signatures (void and function pointers).

llvm-svn: 355710

5 years ago[Reproducers] Add LLDB_RECORD_DUMMY
Jonas Devlieghere [Fri, 8 Mar 2019 17:50:27 +0000 (17:50 +0000)]
[Reproducers] Add LLDB_RECORD_DUMMY

Add a macro that doesn't actually record anything but still toggles the
API boundary. Removing just the register macros for lldb::thread_t
wasn't sufficient on NetBSD because the serialization logic needed the
underlying type to be complete.

This macro should be used by functions that are currently unsupported,
as they might trip the API boundary logic. This should be easy using the
lldb-instr tool.

llvm-svn: 355709

5 years ago[lldb-vscode] Fix warning
Jonas Devlieghere [Fri, 8 Mar 2019 17:36:54 +0000 (17:36 +0000)]
[lldb-vscode] Fix warning

I changed the variable to an unsigned to get rid of a signed and
unsigned compare without realizing the value could be negative. This
fixes the assert instead.

llvm-svn: 355708

5 years ago[ARM][FIX] Fix vfmal.f16 and vfmsl.f16 operand
Diogo N. Sampaio [Fri, 8 Mar 2019 17:11:20 +0000 (17:11 +0000)]
[ARM][FIX] Fix vfmal.f16 and vfmsl.f16 operand

The indexed variant of vfmal.f16 and vfmsl.f16
instructions use the uppser bits of the indexed
operand to store the index (1 bit for the double
variant, 2 bits for the quad).

This limits the usable registers to d0 - d7 or
s0 - s15. This patch enforces this limitation.

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

llvm-svn: 355707

5 years agoAdd more logging to TestQueues.py
Frederic Riss [Fri, 8 Mar 2019 17:09:13 +0000 (17:09 +0000)]
Add more logging to TestQueues.py

The last round of logging taught us that when the test fails, lldb
is indeed aware of the thread it's failing to associate to a given
queue. Add more logging to try to figure out why the thread and the
queue do not appear related to the Queue APIs.

llvm-svn: 355706

5 years ago[analyzer] Fix infinite recursion in printing macros
Kristof Umann [Fri, 8 Mar 2019 16:26:29 +0000 (16:26 +0000)]
[analyzer] Fix infinite recursion in printing macros

In the commited testfile, macro expansion (the one implemented for the plist
output) runs into an infinite recursion. The issue originates from the algorithm
being faulty, as in

#define value REC_MACRO_FUNC(value)

the "value" is being (or at least attempted) expanded from the same macro.

The solved this issue by gathering already visited macros in a set, which does
resolve the crash, but will result in an incorrect macro expansion, that would
preferably be fixed down the line.

Patch by Tibor Brunner!

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

llvm-svn: 355705

5 years ago[analyzer] Emit an error rather than assert on invalid checker option input
Kristof Umann [Fri, 8 Mar 2019 16:00:42 +0000 (16:00 +0000)]
[analyzer] Emit an error rather than assert on invalid checker option input

Asserting on invalid input isn't very nice, hence the patch to emit an error
instead.

This is the first of many patches to overhaul the way we handle checker options.

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

llvm-svn: 355704

5 years ago[analyzer] Use the new infrastructure of expressing taint propagation, NFC
Kristof Umann [Fri, 8 Mar 2019 15:47:56 +0000 (15:47 +0000)]
[analyzer] Use the new infrastructure of expressing taint propagation, NFC

In D55734, we implemented a far more general way of describing taint propagation
rules for functions, like being able to specify an unlimited amount of
source and destination parameters. Previously, we didn't have a particularly
elegant way of expressing the propagation rules for functions that always return
(either through an out-param or return value) a tainted value. In this patch,
we model these functions similarly to other ones, by assigning them a
TaintPropagationRule that describes that they "create a tainted value out of
nothing".

The socket C function is somewhat special, because for certain parameters (for
example, if we supply localhost as parameter), none of the out-params should
be tainted. For this, we added a general solution of being able to specify
custom taint propagation rules through function pointers.

Patch by Gábor Borsik!

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

llvm-svn: 355703

5 years ago[clang-tidy] NFC: Negate the name and semantics of the isNotInMacro function.
Hyrum Wright [Fri, 8 Mar 2019 15:37:15 +0000 (15:37 +0000)]
[clang-tidy] NFC: Negate the name and semantics of the isNotInMacro function.

This function is always used in a context where its result was also
negated, which made for confusing naming and code.

llvm-svn: 355702

5 years agoReland compiler-rt support for order file instrumentation.
Manman Ren [Fri, 8 Mar 2019 15:30:56 +0000 (15:30 +0000)]
Reland compiler-rt support for order file instrumentation.

r355343 was landed and was reverted in r355363 due to build breakage.
This patch adds Linux/Windows support on top of r355343.

In this patch, Darwin should be working with testing case. Linux should be working,
I will enable the testing case in a follwup diff. Windows/Other should be building.
Correct implementation for Other platforms will be added.

Thanks David for reviewing the original diff, helping me with issues on Linux, and
giving suggestions for adding support for Other platforms.

llvm-svn: 355701

5 years agoUse {{.*}} in test case to match the type of wide string literals.
Akira Hatanaka [Fri, 8 Mar 2019 15:20:12 +0000 (15:20 +0000)]
Use {{.*}} in test case to match the type of wide string literals.

The type of wide string literals varies depending on the target.

llvm-svn: 355700

5 years agoFix typo in constant vector
Simon Pilgrim [Fri, 8 Mar 2019 15:17:26 +0000 (15:17 +0000)]
Fix typo in constant vector

llvm-svn: 355699

5 years agoRe-fix _lrotl/_lrotr to always take Long, no matter the platform.
Erich Keane [Fri, 8 Mar 2019 15:10:07 +0000 (15:10 +0000)]
Re-fix _lrotl/_lrotr to always take Long, no matter the platform.

r355322 fixed this, however is being reverted due to concerns with
enabling it in other modes.

Change-Id: I6a939b7469b8fa196d5871a627eb2330dbd30f29
llvm-svn: 355698

5 years agoRevert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."
Erich Keane [Fri, 8 Mar 2019 15:10:05 +0000 (15:10 +0000)]
Revert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."

This reverts commit 24400dafe16716f28cd0e7e5fa6e004c0e50686a.

llvm-svn: 355697

5 years ago[llvm-readelf]Don't lose negative-ness of negative addends for no symbol relocations
James Henderson [Fri, 8 Mar 2019 13:22:05 +0000 (13:22 +0000)]
[llvm-readelf]Don't lose negative-ness of negative addends for no symbol relocations

llvm-readelf prints relocation addends as:

  <symbol value>[+-]<absolute addend>

where [+-] is determined from whether addend is less than zero or not.
However, it does not print the +/- if there is no symbol, which meant
that negative addends became their positive value with no indication
that this had happened. This patch stops the absolute conversion when
addends are negative and there is no associated symbol.

Reviewed by: Higuoxing, mattd, MaskRay

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

llvm-svn: 355696

5 years agogn build: Merge r355685
Nico Weber [Fri, 8 Mar 2019 13:07:22 +0000 (13:07 +0000)]
gn build: Merge r355685

llvm-svn: 355695

5 years agogn build: Unbreak finding a working `gn` on $PATH on Unix after r355645
Nico Weber [Fri, 8 Mar 2019 13:01:58 +0000 (13:01 +0000)]
gn build: Unbreak finding a working `gn` on $PATH on Unix after r355645

From the Python subprocess docs:

   If shell is True, it is recommended to pass args as a string rather than as
   a sequence.

   [...]

   If args is a sequence, the first item specifies the command string, and any
   additional items will be treated as additional arguments to the shell itself.

Prior to this change, the `--version` would be passed to the shell, not to
a potential gn binary on $PATH, and running `gn` without any arguments makes
it exit with an exit code != 0, so the script would think that there wasn't
a working gn binary on $PATH.

Fix this by following the documentation's recommendation of using a string
now that we pass shell=True. I tested this on macOS and Windows, each with
the three cases of

- no gn on PATH (should run gn downloaded by get.py if present,
  else suggest running get.py)
- broken gn wrapper on PATH (should behave like the previous item)
- working gn on PATH (should use gn on PATH)

llvm-svn: 355694

5 years agogn build: Unbreak get.py and gn.py on Windows
Nico Weber [Fri, 8 Mar 2019 12:45:50 +0000 (12:45 +0000)]
gn build: Unbreak get.py and gn.py on Windows

`os.uname()` doesn't exist on Windows, so use `platform.machine()` which
returns `os.uname()[4]` on non-Win and (on 64-bit systems) "AMD64" on Windows.
Also use `sys.platform` instead of `platform` to check for Windows-ness for the
file extension in gn.py (get.py got this right).

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

llvm-svn: 355693

5 years ago[sanitizer] Update global_symbols.txt
Clement Courbet [Fri, 8 Mar 2019 12:41:42 +0000 (12:41 +0000)]
[sanitizer] Update global_symbols.txt

Add `bcmp` after r355672.

llvm-svn: 355692

5 years ago[DAGCombine] Merge visitSMULO+visitUMULO into visitMULO. NFCI.
Simon Pilgrim [Fri, 8 Mar 2019 11:41:18 +0000 (11:41 +0000)]
[DAGCombine] Merge visitSMULO+visitUMULO into visitMULO. NFCI.

llvm-svn: 355690

5 years ago[DAGCombine] Merge visitSADDO+visitUADDO into visitADDO. NFCI.
Simon Pilgrim [Fri, 8 Mar 2019 11:30:33 +0000 (11:30 +0000)]
[DAGCombine] Merge visitSADDO+visitUADDO into visitADDO. NFCI.

llvm-svn: 355689

5 years ago[DAGCombine] Merge visitSSUBO+visitUSUBO into visitSUBO. NFCI.
Simon Pilgrim [Fri, 8 Mar 2019 11:16:55 +0000 (11:16 +0000)]
[DAGCombine] Merge visitSSUBO+visitUSUBO into visitSUBO. NFCI.

llvm-svn: 355688

5 years ago[mips] Use libatomic instead of GCC intrinsics for 64bit
Petar Jovanovic [Fri, 8 Mar 2019 10:53:19 +0000 (10:53 +0000)]
[mips] Use libatomic instead of GCC intrinsics for 64bit

The following GCC intrinsics are not available on MIPS32:

__sync_fetch_and_add_8
__sync_fetch_and_and_8
__sync_fetch_and_or_8
__sync_val_compare_and_swap_8

Replace these with appropriate libatomic implementation.

Patch by Miodrag Dinic.

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

llvm-svn: 355687

5 years ago[IR][ARM] Add function pointer alignment to datalayout
Michael Platings [Fri, 8 Mar 2019 10:44:06 +0000 (10:44 +0000)]
[IR][ARM] Add function pointer alignment to datalayout

Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.

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

llvm-svn: 355685

5 years agoMake function definition in header inline
Benjamin Kramer [Fri, 8 Mar 2019 10:43:56 +0000 (10:43 +0000)]
Make function definition in header inline

Otherwise including this header from more than one place will break
linking.

llvm-svn: 355684

5 years ago[clang][Index] Fix msan failure
Kadir Cetinkaya [Fri, 8 Mar 2019 10:18:40 +0000 (10:18 +0000)]
[clang][Index] Fix msan failure

llvm-svn: 355683

5 years agoclang-cl : Parse all /d2 options
Hans Wennborg [Fri, 8 Mar 2019 10:00:42 +0000 (10:00 +0000)]
clang-cl : Parse all /d2 options

We will now warn about such options being unused,
which is better than the current
"no such file or directory: '/d2foo'" errors.

Note that we can still handle specific flags separately,
e.g. we were already ignoring /d2FastFail and /d2Zi+

llvm-svn: 355682

5 years ago[clangd] Remove ./ and ../ in the file paths
Kadir Cetinkaya [Fri, 8 Mar 2019 09:57:33 +0000 (09:57 +0000)]
[clangd] Remove ./ and ../ in the file paths

Reviewers: hokein

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

Tags: #clang

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

llvm-svn: 355681

5 years ago[clangd] Redirect clangd page.
Haojian Wu [Fri, 8 Mar 2019 09:56:42 +0000 (09:56 +0000)]
[clangd] Redirect clangd page.

Reviewers: gribozavr

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

Tags: #clang

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

llvm-svn: 355680

5 years ago[clangd] Make sure constructors do not reference class
Kadir Cetinkaya [Fri, 8 Mar 2019 09:54:37 +0000 (09:54 +0000)]
[clangd] Make sure constructors do not reference class

Reviewers: gribozavr

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

Tags: #clang

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

llvm-svn: 355679

5 years ago[clang][Tooling] Delete dots and dotdots when generating absolute paths
Kadir Cetinkaya [Fri, 8 Mar 2019 09:42:04 +0000 (09:42 +0000)]
[clang][Tooling] Delete dots and dotdots when generating absolute paths

Summary:
GetAllFiles interface returns absolute paths, but keeps dots and dot
dots. This patch makes those paths canonical by deleting them.

Reviewers: hokein

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 355678

5 years ago[clangd] Deduplicate Refs on the fly.
Haojian Wu [Fri, 8 Mar 2019 09:26:30 +0000 (09:26 +0000)]
[clangd] Deduplicate Refs on the fly.

Summary:
Currently, we only do deduplication when we flush final results. We may
have huge duplications (refs from headers) during the indexing period (running
clangd-indexer on Chromium).

With this change, clangd-indexer can index the whole chromium projects
(48 threads, 40 GB peak memory usage).

Reviewers: kadircet

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

Tags: #clang

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

llvm-svn: 355676

5 years ago[SelectionDAG] Allow the user to specify a memeq function.
Clement Courbet [Fri, 8 Mar 2019 09:07:45 +0000 (09:07 +0000)]
[SelectionDAG] Allow the user to specify a memeq function.

Summary:
Right now, when we encounter a string equality check,
e.g. `if (memcmp(a, b, s) == 0)`, we try to expand to a comparison if `s` is a
small compile-time constant, and fall back on calling `memcmp()` else.

This is sub-optimal because memcmp has to compute much more than
equality.

This patch replaces `memcmp(a, b, s) == 0` by `bcmp(a, b, s) == 0` on platforms
that support `bcmp`.

`bcmp` can be made much more efficient than `memcmp` because equality
compare is trivially parallel while lexicographic ordering has a chain
dependency.

Subscribers: fedor.sergeev, jyknight, ckennelly, gchatelet, llvm-commits

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

llvm-svn: 355672

5 years ago[AMDGPU] V_CVT_F32_UBYTE{0,1,2,3} are full rate instructions
Carl Ritson [Fri, 8 Mar 2019 09:03:11 +0000 (09:03 +0000)]
[AMDGPU] V_CVT_F32_UBYTE{0,1,2,3} are full rate instructions

Summary: Fix a bug in the scheduling model where V_CVT_F32_UBYTE{0,1,2,3} are incorrectly marked as quarter rate instructions.

Reviewers: arsenm, rampitec

Reviewed By: rampitec

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

Tags: #llvm

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

llvm-svn: 355671

5 years agoAdd another test for r354937 that came up in PR40890
Hans Wennborg [Fri, 8 Mar 2019 09:01:10 +0000 (09:01 +0000)]
Add another test for r354937 that came up in PR40890

llvm-svn: 355670

5 years ago[clangd] Adjust compile commands to be applicable for tooling
Kadir Cetinkaya [Fri, 8 Mar 2019 08:38:25 +0000 (08:38 +0000)]
[clangd] Adjust compile commands to be applicable for tooling

Summary:
As can be seen in https://github.com/llvm-mirror/clang/blob/master/lib/Tooling/Tooling.cpp#L385
clang tool invocations adjust commands normally like this. In clangd we have
different code paths for invoking a frontend action(preamble builds, ast builds,
background index, clangd-indexer) they all work on the same GlobalCompilationDatabase
abstraction, but later on are subject to different modifications.

This patch makes sure all of the clangd actions make use of the same compile
commands before invocation.

Enables background-index to work on chromium codebase(since they had dependency
file output in their compile commands).

Reviewers: gribozavr, hokein

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

Tags: #clang

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

llvm-svn: 355669

5 years ago[clang][Index] Mark references from Constructors and Destructors to class as NameRefe...
Kadir Cetinkaya [Fri, 8 Mar 2019 08:30:20 +0000 (08:30 +0000)]
[clang][Index] Mark references from Constructors and Destructors to class as NameReference

Summary:
In current indexing logic we get references to class itself when we see
a constructor/destructor which is only syntactically true. Semantically
this information is not correct. This patch marks that reference as
NameReference to let clients deal with it.

Reviewers: akyrtzi, gribozavr, nathawes, benlangmuir

Reviewed By: gribozavr, nathawes

Subscribers: nathawes, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 355668

5 years ago[X86] Improve the type checking in isLegalMaskedLoad and isLegalMaskedGather.
Craig Topper [Fri, 8 Mar 2019 07:33:43 +0000 (07:33 +0000)]
[X86] Improve the type checking in isLegalMaskedLoad and isLegalMaskedGather.

We were just checking pointer size and type primitive size. But this caused unintended things like vectors of half being accepted by masked load/store.

For FP we now explicitly check for only double and float.

For pointers we now let any pointer through. Trusting that only 32 and 64 would be used to generate assembly.

We only check bitwidth after checking that the type is an integer.

llvm-svn: 355667

5 years ago[Clang] Include the test directory ommited in r355665
Petr Hosek [Fri, 8 Mar 2019 06:16:32 +0000 (06:16 +0000)]
[Clang] Include the test directory ommited in r355665

This was omitted in r355655 causing the test to fail.

llvm-svn: 355666

5 years ago[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/
Petr Hosek [Fri, 8 Mar 2019 05:35:22 +0000 (05:35 +0000)]
[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/

This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory.  Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/<target> and include/ directories, leaving resource directory only
for compiler-rt runtimes and Clang builtin headers.

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

llvm-svn: 355665

5 years agoFix test case committed in r355662.
Akira Hatanaka [Fri, 8 Mar 2019 05:30:54 +0000 (05:30 +0000)]
Fix test case committed in r355662.

Build bots were failing because wide string literals don't have type
'int *' on some targets.

llvm-svn: 355664

5 years ago[Bitcode] Fix bitcode compatibility issue with clang.arc.use intrinsic
Steven Wu [Fri, 8 Mar 2019 05:27:53 +0000 (05:27 +0000)]
[Bitcode] Fix bitcode compatibility issue with clang.arc.use intrinsic

Summary:
In r349534, objc arc implementation is switched to use intrinsics and at
the same time, clang.arc.use is renamed to llvm.objc.clang.arc.use to
make the naming more consistent. The side-effect of that is llvm no
longer recognize it as intrinsics and codegen external references to
it instead.

Rather than upgrade the old intrinsics name to the new one and wait for
the arc-contract pass to remove it, simply remove it in the bitcode
upgrader.

rdar://problem/48607063

Reviewers: pete, ahatanak, erik.pilkington, dexonsmith

Reviewed By: pete, dexonsmith

Subscribers: jkorous, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 355663

5 years ago[ObjC] Emit a boxed expression as a compile-time constant if the
Akira Hatanaka [Fri, 8 Mar 2019 04:45:37 +0000 (04:45 +0000)]
[ObjC] Emit a boxed expression as a compile-time constant if the
expression inside the parentheses is a valid UTF-8 string literal.

Previously clang emitted an expression like @("abc") as a message send
to stringWithUTF8String. This commit makes clang emit the boxed
expression as a compile-time constant instead.

This commit also has the effect of silencing the nullable-to-nonnull
conversion warning clang started emitting after r317727, which
originally motivated this commit (see https://oleb.net/2018/@keypath).

rdar://problem/42684601

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

llvm-svn: 355662

5 years agoAdd ASAN llvm build directory variants to
Jason Molenda [Fri, 8 Mar 2019 04:18:21 +0000 (04:18 +0000)]
Add ASAN llvm build directory variants to
get_llvm_bin_dirs().

llvm-svn: 355661

5 years agoVariable auto-init: split out small arrays
JF Bastien [Fri, 8 Mar 2019 01:26:49 +0000 (01:26 +0000)]
Variable auto-init: split out small arrays

Summary: Following up with r355181, initialize small arrays as well.

LLVM stage2 shows a tiny size gain.

<rdar://48523005>

Reviewers: glider, pcc, kcc, rjmccall

Subscribers: jkorous, dexonsmith, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 355660

5 years ago[X86] Make x86-intrinsics-headers-clean.cpp stricter.
Craig Topper [Fri, 8 Mar 2019 01:15:18 +0000 (01:15 +0000)]
[X86] Make x86-intrinsics-headers-clean.cpp stricter.

Remove the -Wno-ignored-attributes.

Add -fno-lax-vector-conversions

Also use -ffreestanding instead of defining _MM_MALLOC_H.

llvm-svn: 355659

5 years ago[Reproducers] TestImagineList.test -> TestImageList.test
Jonas Devlieghere [Fri, 8 Mar 2019 00:53:57 +0000 (00:53 +0000)]
[Reproducers] TestImagineList.test -> TestImageList.test

And run the actual binary so we load the shared libraries.

llvm-svn: 355658

5 years ago[Reproducers] Mark partial specialization as inline
Jonas Devlieghere [Fri, 8 Mar 2019 00:24:06 +0000 (00:24 +0000)]
[Reproducers] Mark partial specialization as inline

The overload and/or template specialization are regular functions and
should be marked inline when implemented in the header. Writing the
previous commit message should've made that obvious but I was already
overthinking it. This will fix the windows bot.

llvm-svn: 355657

5 years ago[lldb-vscode] Report an error if an invalid program is specified.
Zachary Turner [Fri, 8 Mar 2019 00:11:27 +0000 (00:11 +0000)]
[lldb-vscode] Report an error if an invalid program is specified.

Previously if an invalid program was specified, there was a bug
which, when we attempted to launch the program, would report that
the operation succeeded, causing LLDB to then hang while waiting
indefinitely to receive some events from the process.

After this patch, when an invalid program is specified, we immediately
return to vs code with an error message that indicates that the
program can not be found.

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

llvm-svn: 355656

5 years ago[x86] add extract FP tests for target-specific nodes; NFC
Sanjay Patel [Thu, 7 Mar 2019 23:55:54 +0000 (23:55 +0000)]
[x86] add extract FP tests for target-specific nodes; NFC

llvm-svn: 355655

5 years ago[Reproducers] Use partial template specialization instead of overload
Jonas Devlieghere [Thu, 7 Mar 2019 23:37:46 +0000 (23:37 +0000)]
[Reproducers] Use partial template specialization instead of overload

Not sure if this is what's causing MSVC to claim the function to be
already defined elsewhere, but worth a shot.

llvm-svn: 355654

5 years agoTemporarily diasble debug output in GenericDomTreeConstruction.h
Adrian Prantl [Thu, 7 Mar 2019 23:30:19 +0000 (23:30 +0000)]
Temporarily diasble debug output in GenericDomTreeConstruction.h
to get the modules bots running again.

The LLVM_DEBUG macro only plays well with a modular build of LLVM when
the header is marked as textual, but doing so causes redefinition
errors.

llvm-svn: 355653

5 years agoMake GenericDomTreeConstruction textual instead.
Adrian Prantl [Thu, 7 Mar 2019 23:17:11 +0000 (23:17 +0000)]
Make GenericDomTreeConstruction textual instead.

I think the problem is that it uses the LLVM_DEBUG macro in funciton bodies.

llvm-svn: 355652

5 years agoMake bytes_read an unsigned
Jonas Devlieghere [Thu, 7 Mar 2019 22:59:55 +0000 (22:59 +0000)]
Make bytes_read an unsigned

llvm-svn: 355651

5 years agoRemove unused function
Jonas Devlieghere [Thu, 7 Mar 2019 22:58:39 +0000 (22:58 +0000)]
Remove unused function

llvm-svn: 355650

5 years ago[SBAPI] Log from record macro
Jonas Devlieghere [Thu, 7 Mar 2019 22:47:13 +0000 (22:47 +0000)]
[SBAPI] Log from record macro

The current record macros already log the function being called. This
patch extends the macros to also log their input arguments and removes
explicit logging from the SB API.

This might degrade the amount of information in some cases (because of
smarter casts or efforts to log return values). However I think this is
outweighed by the increased coverage and consistency. Furthermore, using
the reproducer infrastructure, diagnosing bugs in the API layer should
become much easier compared to relying on log messages.

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

llvm-svn: 355649

5 years agoFix TestPaths.py on windows
Alex Langford [Thu, 7 Mar 2019 22:37:23 +0000 (22:37 +0000)]
Fix TestPaths.py on windows

I committed an implementation of GetClangResourceDir on windows but
forgot to update this test. I merged the tests like I intended to, but I
realized that the test was actually failing. After looking into it, it
appears that FileSystem::Resolve was taking the path and setting
the FileSpec's Directory to "/path/to/lldb/lib/clang/" and the File to
"9.0.0" which isn't what we want. So I removed the resolve line from
DefaultComputeClangResourceDir.

llvm-svn: 355648

5 years agoAdd logging to TestQueues.py
Frederic Riss [Thu, 7 Mar 2019 22:28:01 +0000 (22:28 +0000)]
Add logging to TestQueues.py

In an attempt to understand why the test is still failing after r355555,
add some logging.

llvm-svn: 355647

5 years agoWork around a module build error on the LLDB incremental green dragon bot.
Adrian Prantl [Thu, 7 Mar 2019 22:25:26 +0000 (22:25 +0000)]
Work around a module build error on the LLDB incremental green dragon bot.

llvm-svn: 355646

5 years ago[GN] Locate prebuilt binaries correctly.
Mitch Phillips [Thu, 7 Mar 2019 22:20:36 +0000 (22:20 +0000)]
[GN] Locate prebuilt binaries correctly.

Use the system shell to see if we can find a 'gn' binary on $PATH. This solves the error wherein subprocess.call fails ungracefully if the binary doesn't exist.

llvm-svn: 355645

5 years agoFix TestAppleSimulatorOSType.py with Xcode 10.2
Frederic Riss [Thu, 7 Mar 2019 22:12:03 +0000 (22:12 +0000)]
Fix TestAppleSimulatorOSType.py with Xcode 10.2

It looks like the simctl tool shipped in Xcode10.2 changed the format of
its json output.

llvm-svn: 355644

5 years ago[scudo][standalone] Adding a stats class
Kostya Kortchinsky [Thu, 7 Mar 2019 21:44:35 +0000 (21:44 +0000)]
[scudo][standalone] Adding a stats class

Summary:
This adds simple local & global stats classes to be used by the Primary
and Secondary, and associated test. Note that we don't need the strict
atomicity of the addition & subtraction (as is in sanitizer_common) so
we just use load & store.

Reviewers: morehouse, vitalybuka, eugenis, flowerhack, dmmoore415

Reviewed By: morehouse, vitalybuka

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

Tags: #llvm, #sanitizers

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

llvm-svn: 355643

5 years ago[TSan] Temporarily disable test which fails on build bot
Julian Lettner [Thu, 7 Mar 2019 21:42:48 +0000 (21:42 +0000)]
[TSan] Temporarily disable test which fails on build bot

llvm-svn: 355642

5 years ago[testsuite] Recommit the TestTerminal directory.
Davide Italiano [Thu, 7 Mar 2019 21:33:43 +0000 (21:33 +0000)]
[testsuite] Recommit the TestTerminal directory.

Turns out this is actually testing that editline doesn't
screw up the terminal.

llvm-svn: 355640

5 years agoAdd secondary libstdc++ 4.8 and 5.1 detection mechanisms
Hubert Tong [Thu, 7 Mar 2019 21:28:33 +0000 (21:28 +0000)]
Add secondary libstdc++ 4.8 and 5.1 detection mechanisms

Summary:
The date-based approach to detecting unsupported versions of libstdc++
does not handle bug fix releases of older versions. As an example, the
`__GLIBCXX__` value associated with version 5.1, `20150422`, is less
than the values associated with versions 4.8.5 and 4.9.3.

This patch adds secondary checks based on certain properties in
sufficiently new versions of libstdc++.

Reviewers: jfb, tstellar, rnk, sfertile, nemanjai

Reviewed By: jfb

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

llvm-svn: 355638

5 years ago[lldb-vscode] Support running in server mode on Windows.
Zachary Turner [Thu, 7 Mar 2019 21:23:21 +0000 (21:23 +0000)]
[lldb-vscode] Support running in server mode on Windows.

Windows can't use standard i/o system calls such as read and write
to work with sockets, it instead needs to use the specific send
and recv calls.  This complicates matters for the debug adapter,
since it needs to be able to work in both server mode where it
communicates over a socket, as well as non-server mode where it
communicates via stdin and stdout.  To abstract this out, I've
introduced a class IOStream which hides all these details and
exposes a read/write interface that does the right on each
platform.

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

llvm-svn: 355637

5 years ago[X86] Correct scheduler information for rotate by constant for Haswell, Broadwell...
Craig Topper [Thu, 7 Mar 2019 21:22:56 +0000 (21:22 +0000)]
[X86] Correct scheduler information for rotate by constant for Haswell, Broadwell, and Skylake.

Rotate with explicit immediate is a single uop from Haswell on. An immediate of 1 has a dependency on the previous writer of flags, but the other immediate values do not.

The implicit rotate by 1 instruction is 2 uops. But the flags are merged after the rotate uop so the data result does not see the flag dependency. But I don't think we have any way of modeling that.

RORX is 1 uop without the load. 2 uops with the load. We currently model these with WriteShift/WriteShiftLd.

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

llvm-svn: 355636

5 years ago[X86] Model ADC/SBB with immediate 0 more accurately in the Haswell scheduler model
Craig Topper [Thu, 7 Mar 2019 21:22:51 +0000 (21:22 +0000)]
[X86] Model ADC/SBB with immediate 0 more accurately in the Haswell scheduler model

Haswell and possibly Sandybridge have an optimization for ADC/SBB with immediate 0 to use a single uop flow. This only applies GR16/GR32/GR64 with an 8-bit immediate. It does not apply to GR8. It also does not apply to the implicit AX/EAX/RAX forms.

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

llvm-svn: 355635

5 years ago[CodeGen] Reuse BlockUtils for -unreachableblockelim pass (NFC)
Brian Gesiak [Thu, 7 Mar 2019 20:40:55 +0000 (20:40 +0000)]
[CodeGen] Reuse BlockUtils for -unreachableblockelim pass (NFC)

Summary:
The logic in the -unreachableblockelim pass does the following:

1. It traverses the function it's given in depth-first order and
   creates a set of basic blocks that are unreachable from the
   function's entry node.
2. It iterates over each of those unreachable blocks and (1) removes any
   successors' references to the dead block, and (2) replaces any uses of
   instructions from the dead block with null.

The logic in (2) above is identical to what the `llvm::DeleteDeadBlocks`
function from `BasicBlockUtils.h` does. The only difference is that
`llvm::DeleteDeadBlocks` replaces uses of instructions from dead blocks
not with null, but with undef.

Replace the duplicate logic in the -unreachableblockelim pass with a
call to `llvm::DeleteDeadBlocks`. This results in less code but no
functional change (NFC).

Reviewers: mkazantsev, wmi, davidxl, silvas, davide

Reviewed By: davide

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 355634

5 years ago[TSan] Temporarily disable test which fails on build bot
Julian Lettner [Thu, 7 Mar 2019 20:30:18 +0000 (20:30 +0000)]
[TSan] Temporarily disable test which fails on build bot

llvm-svn: 355633

5 years agoAdd an LLVM-style dump method to CompilerType for extra convenience during debugging
Adrian Prantl [Thu, 7 Mar 2019 20:20:02 +0000 (20:20 +0000)]
Add an LLVM-style dump method to CompilerType for extra convenience during debugging

This change has no effect on Release (NoAsserts) builds.

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

llvm-svn: 355632

5 years ago[ExpressionParser] Implement ComputeClangResourceDir for Windows
Alex Langford [Thu, 7 Mar 2019 20:09:15 +0000 (20:09 +0000)]
[ExpressionParser] Implement ComputeClangResourceDir for Windows

Summary: This function is useful for expression evaluation, especially when doing swift debugging on windows.

Reviewers: aprantl, labath

Reviewed By: labath

Subscribers: teemperor, jdoerfert, lldb-commits

Tags: #lldb

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

llvm-svn: 355631

5 years agoAMDHSA: Code object v3 updates
Konstantin Zhuravlyov [Thu, 7 Mar 2019 19:58:29 +0000 (19:58 +0000)]
AMDHSA: Code object v3 updates

  - Copy kernel symbol attributes into kernel descriptor attributes
  - Make sure kernel symbol's visibility is not "higher" than protected

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

llvm-svn: 355630

5 years ago[lldb] Fix DW_OP_addrx uses.
Ali Tamur [Thu, 7 Mar 2019 19:41:08 +0000 (19:41 +0000)]
[lldb] Fix DW_OP_addrx uses.

Summary: DW_OP_GNU_addr_index has been renamed as DW_OP_addrx in the standard. clang produces DW_OP_addrx tags and with this change lldb starts to process them.

Reviewers: aprantl, jingham, davide, clayborg, serge-sans-paille

Reviewed By: aprantl

Subscribers: jdoerfert, dblaikie, labath, shafik, lldb-commits

Tags: #lldb

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

llvm-svn: 355629

5 years ago[llvm-mca] Emit a message when no bottlenecks are identified.
Matt Davis [Thu, 7 Mar 2019 19:34:44 +0000 (19:34 +0000)]
[llvm-mca] Emit a message when no bottlenecks are identified.

Summary:
Since bottleneck hints are enabled via user request, it can be
confusing if no bottleneck information is presented.  Such is the
case when no bottlenecks are identified.  This patch emits a message
in that case.

Reviewers: andreadb

Reviewed By: andreadb

Subscribers: tschuett, gbedwell, llvm-commits

Tags: #llvm

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

llvm-svn: 355628

5 years agoRecommit "Support attribute used in member funcs of class templates"
Rafael Auler [Thu, 7 Mar 2019 19:14:30 +0000 (19:14 +0000)]
Recommit "Support attribute used in member funcs of class templates"

The patch originally broke code that was incompatible with GCC, but
we want to follow GCC behavior here according to the discussion in
https://reviews.llvm.org/D58216

Original commit message:
As PR17480 describes, clang does not support the used attribute
for member functions of class templates. This means that if the member
function is not used, its definition is never instantiated. This patch
changes clang to emit the definition if it has the used attribute.

Test Plan: Added a testcase

Reviewed By: aaron.ballman

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

llvm-svn: 355627

5 years ago[GN] Remove DataLayoutTest.cpp from IR Unittests.
Mitch Phillips [Thu, 7 Mar 2019 18:58:45 +0000 (18:58 +0000)]
[GN] Remove DataLayoutTest.cpp from IR Unittests.

Merge of GN files to fit with rL355616.

llvm-svn: 355626

5 years agoFix some clang analysis tests passing arguments incorrectly
Reid Kleckner [Thu, 7 Mar 2019 18:57:04 +0000 (18:57 +0000)]
Fix some clang analysis tests passing arguments incorrectly

llvm-svn: 355625

5 years agoDelete x86_64 ShadowCallStack support
Vlad Tsyrklevich [Thu, 7 Mar 2019 18:56:36 +0000 (18:56 +0000)]
Delete x86_64 ShadowCallStack support

Summary:
ShadowCallStack on x86_64 suffered from the same racy security issues as
Return Flow Guard and had performance overhead as high as 13% depending
on the benchmark. x86_64 ShadowCallStack was always an experimental
feature and never shipped a runtime required to support it, as such
there are no expected downstream users.

Reviewers: pcc

Reviewed By: pcc

Subscribers: mgorny, javed.absar, hiraditya, jdoerfert, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

llvm-svn: 355624

5 years ago[PowerPC] Run clang format to avoid compiling warning.
Jinsong Ji [Thu, 7 Mar 2019 18:55:21 +0000 (18:55 +0000)]
[PowerPC] Run clang format to avoid compiling warning.

llvm-svn: 355623

5 years agoELF: Reduce the size of InputSectionBase by two words. NFCI.
Peter Collingbourne [Thu, 7 Mar 2019 18:48:12 +0000 (18:48 +0000)]
ELF: Reduce the size of InputSectionBase by two words. NFCI.

- The Assigned bit was previously taking a word on its own. Move
  it into the bit fields in SectionBase.
- NumRelocations and AreRelocsRela were previously also taking up
  a word despite only using half of it. Move them into the alignment gap
  after SectionBase's fields.

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

llvm-svn: 355622

5 years agofix expected format in test/ELF/eh-frame-hdr-augmentation.s
Petar Jovanovic [Thu, 7 Mar 2019 18:28:44 +0000 (18:28 +0000)]
fix expected format in test/ELF/eh-frame-hdr-augmentation.s

Follow-up for r355605.
Fix expected format in test/ELF/eh-frame-hdr-augmentation.s

llvm-svn: 355621

5 years ago[NFC][TSan] Remove unnecessary #include
Julian Lettner [Thu, 7 Mar 2019 18:22:22 +0000 (18:22 +0000)]
[NFC][TSan] Remove unnecessary #include

llvm-svn: 355620

5 years ago[TSan][Linux] Fix libdispatch interception macros compilation errors
Julian Lettner [Thu, 7 Mar 2019 18:15:29 +0000 (18:15 +0000)]
[TSan][Linux] Fix libdispatch interception macros compilation errors

Most libdispatch functions come in two variants: callbacks can be
specified via blocks or function pointers. Some of our interceptors for
the block variant actually forward to the function variant. However, on
Linux, `DECLARE_REAL(name)` has to appear before `REAL(name)`.

This patch reorders _f variant interceptors before _b variants
where possible and forward declares the _f variant in the remaining
cases (cyclic dependency between _f and _b interceptors).

Also rename macro to DISPATCH_INTERCEPT_ASYNC_F for better consistency.

Reviewed By: dvyukov

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

llvm-svn: 355619

5 years ago[NFC][TSan] Add libdispatch tests for non-Darwin platforms
Julian Lettner [Thu, 7 Mar 2019 18:15:26 +0000 (18:15 +0000)]
[NFC][TSan] Add libdispatch tests for non-Darwin platforms

Add new sets of tests (copy instead of move existing tests) because
there could be subtle differences between C/Obj-C and with/without
Foundation etc.

Reviewed By: dvyukov

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

llvm-svn: 355618

5 years ago[Sanitizer] Add 'dispatch' feature to be used in compiler-rt tests
Julian Lettner [Thu, 7 Mar 2019 18:15:23 +0000 (18:15 +0000)]
[Sanitizer] Add 'dispatch' feature to be used in compiler-rt tests

Reviewed By: dvyukov

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

llvm-svn: 355617

5 years agoRollback of rL355585.
Mitch Phillips [Thu, 7 Mar 2019 18:13:39 +0000 (18:13 +0000)]
Rollback of rL355585.

Introduces memory leak in FunctionTest.GetPointerAlignment that breaks sanitizer buildbots:

```
=================================================================
==2453==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x610428 in operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:105
    #1 0x16936bc in llvm::User::operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/User.cpp:151:19
    #2 0x7c3fe9 in Create /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/IR/Function.h:144:12
    #3 0x7c3fe9 in (anonymous namespace)::FunctionTest_GetPointerAlignment_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/IR/FunctionTest.cpp:136
    #4 0x1a836a0 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #5 0x1a836a0 in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #6 0x1a85c55 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #7 0x1a870d0 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #8 0x1aa5b84 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #9 0x1aa4d30 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #10 0x1aa4d30 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #11 0x1a6b656 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #12 0x1a6b656 in main /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #13 0x7f5af37a22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)

Indirect leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x610428 in operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:105
    #1 0x151be6b in make_unique<llvm::ValueSymbolTable> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/ADT/STLExtras.h:1349:29
    #2 0x151be6b in llvm::Function::Function(llvm::FunctionType*, llvm::GlobalValue::LinkageTypes, unsigned int, llvm::Twine const&, llvm::Module*) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/Function.cpp:241
    #3 0x7c4006 in Create /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/IR/Function.h:144:16
    #4 0x7c4006 in (anonymous namespace)::FunctionTest_GetPointerAlignment_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/IR/FunctionTest.cpp:136
    #5 0x1a836a0 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #6 0x1a836a0 in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #7 0x1a85c55 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #8 0x1a870d0 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #9 0x1aa5b84 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #10 0x1aa4d30 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #11 0x1aa4d30 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #12 0x1a6b656 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #13 0x1a6b656 in main /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #14 0x7f5af37a22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)

SUMMARY: AddressSanitizer: 168 byte(s) leaked in 2 allocation(s).
```

See http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/11358/steps/check-llvm%20asan/logs/stdio for more information.

Also introduces use-of-uninitialized-value in ConstantsTest.FoldGlobalVariablePtr:
```
==7070==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x14e703c in User /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/User.h:79:5
    #1 0x14e703c in Constant /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/Constant.h:44
    #2 0x14e703c in llvm::GlobalValue::GlobalValue(llvm::Type*, llvm::Value::ValueTy, llvm::Use*, unsigned int, llvm::GlobalValue::LinkageTypes, llvm::Twine const&, unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/GlobalValue.h:78
    #3 0x14e5467 in GlobalObject /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/GlobalObject.h:34:9
    #4 0x14e5467 in llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&, llvm::GlobalValue::ThreadLocalMode, unsigned int, bool) /b/sanitizer-x86_64-linux-fast/build/llvm/lib/IR/Globals.cpp:314
    #5 0x6938f1 in llvm::(anonymous namespace)::ConstantsTest_FoldGlobalVariablePtr_Test::TestBody() /b/sanitizer-x86_64-linux-fast/build/llvm/unittests/IR/ConstantsTest.cpp:565:18
    #6 0x1a240a1 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc
    #7 0x1a240a1 in testing::Test::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #8 0x1a26d26 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #9 0x1a2815f in testing::TestCase::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #10 0x1a43de8 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #11 0x1a42c47 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc
    #12 0x1a42c47 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #13 0x1a0dfba in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #14 0x1a0dfba in main /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #15 0x7f2081c412e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #16 0x4dff49 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/unittests/IR/IRTests+0x4dff49)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/User.h:79:5 in User
```

See http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/30222/steps/check-llvm%20msan/logs/stdio for more information.

llvm-svn: 355616

5 years ago[testsuite] Spring cleaning: this tests `stty`, not `lldb`.
Davide Italiano [Thu, 7 Mar 2019 18:05:18 +0000 (18:05 +0000)]
[testsuite] Spring cleaning: this tests `stty`, not `lldb`.

llvm-svn: 355615

5 years ago[OPENMP 5.0]Add initial support for 'allocate' directive.
Alexey Bataev [Thu, 7 Mar 2019 17:54:44 +0000 (17:54 +0000)]
[OPENMP 5.0]Add initial support for 'allocate' directive.

Added parsing/sema analysis/serialization/deserialization support for
'allocate' directive.

llvm-svn: 355614

5 years ago[InterleavedAccessAnalysis] Fix integer overflow in insertMember.
Florian Hahn [Thu, 7 Mar 2019 17:50:16 +0000 (17:50 +0000)]
[InterleavedAccessAnalysis] Fix integer overflow in insertMember.

Without checking for integer overflow, invalid members can be added
 e.g. if the calculated key overflows, becomes positive and the largest key.

This fixes
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=7560
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13128
      https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13229

Reviewers: Ayal, anna, hsaito, efriedma

Reviewed By: efriedma

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

llvm-svn: 355613

5 years ago[testsuite] Drop characters that can't be decoded, restoring parity with Py2.
Davide Italiano [Thu, 7 Mar 2019 17:45:53 +0000 (17:45 +0000)]
[testsuite] Drop characters that can't be decoded, restoring parity with Py2.

Tests that check the output of `memory find` may trip over
unreadable characters, and in Python 3 this is an error.

llvm-svn: 355612

5 years agoFix TestDataFormatter.test uninitialized variable
Jan Kratochvil [Thu, 7 Mar 2019 17:35:47 +0000 (17:35 +0000)]
Fix TestDataFormatter.test uninitialized variable

After D55626 I see a failure in my Fedora buildbot.

There is uninitialized variable as the Foo constructor has not been run and foo
is an autovariable.

(lldb) breakpoint set -f foo.cpp -l 11
Breakpoint 1: where = TestDataFormatter.test.tmp.out`main + 30 at foo.cpp:11:7, address = 0x000000000040112e
(lldb) run
Process 801065 stopped
* thread #1, name = 'TestDataFormatt', stop reason = breakpoint 1.1
    frame #0: 0x000000000040112e TestDataFormatter.test.tmp.out`main(argc=1, argv=0x00007fffffffcc48) at foo.cpp:11:7
   8    };
   9
   10   int main(int argc, char **argv) {
-> 11     Foo foo(1, 2.22);
   12     return 0;
   13   }

Process 801065 launched: '.../tools/lldb/lit/Reproducer/Functionalities/Output/TestDataFormatter.test.tmp.out' (x86_64)
(lldb) frame var
(int) argc = 1
(char **) argv = 0x00007fffffffcc48
(Foo) foo = (m_i = 4198432, m_d = 0)

While the testcase expects m_i will be 0.

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

llvm-svn: 355611