lldb.git
2 years ago[libc] Generate math.h instead of the static file it is currently.
Siva Chandra Reddy [Tue, 24 Mar 2020 17:52:56 +0000 (10:52 -0700)]
[libc] Generate math.h instead of the static file it is currently.

Just enough to help a follow up patch adding cosf and sinf has been
added.

Reviewers: abrachet

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

2 years ago[MLIR][NFC] std::is_same || -> llvm::is_one_of
Uday Bondhugula [Wed, 25 Mar 2020 02:23:05 +0000 (07:53 +0530)]
[MLIR][NFC] std::is_same || -> llvm::is_one_of

 Switch std::is_same disjunctions to llvm::is_one_of

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

2 years ago[gn build] Port ba1f4405c68
LLVM GN Syncbot [Wed, 25 Mar 2020 03:27:56 +0000 (03:27 +0000)]
[gn build] Port ba1f4405c68

2 years ago[profile] Move RuntimeCounterRelocation and ProfileDumped into a separate file
Petr Hosek [Wed, 25 Mar 2020 03:02:44 +0000 (20:02 -0700)]
[profile] Move RuntimeCounterRelocation and ProfileDumped into a separate file

This avoids the test failure that was introduced in rG32bddad where
this function pulls in the rest of InstrProfilingFile.c which is
undesirable in use cases when profile runtime is being used without
the rest of libc.

This also allows additional cleanup by eliminating another variable
from platforms that don't need it.

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

2 years agoRevert "[libc++] Build the dylib with C++17 to allow aligned new/delete"
Louis Dionne [Wed, 25 Mar 2020 02:53:47 +0000 (22:53 -0400)]
Revert "[libc++] Build the dylib with C++17 to allow aligned new/delete"

This reverts commit 1ac403bd145dadfa1004af29bd6c77f871caf42c, which
broke some non-libc++ build bots because they use an ancient CMake.

2 years ago[NFC][Test][PowerPC] Add one test to verify the behavior of vector
QingShan Zhang [Wed, 25 Mar 2020 02:37:26 +0000 (02:37 +0000)]
[NFC][Test][PowerPC] Add one test to verify the behavior of vector
mul/add for v8i16

2 years agoAMDGPU/GlobalISel: Add a testcase for G_UNMERGE_VALUES legalization
Matt Arsenault [Wed, 25 Mar 2020 01:52:03 +0000 (21:52 -0400)]
AMDGPU/GlobalISel: Add a testcase for G_UNMERGE_VALUES legalization

I had a note that this doesn't work, but it seems to now.

2 years ago[profile] Make atexit hook a no-op on Fuchsia
Petr Hosek [Sat, 21 Mar 2020 23:41:00 +0000 (16:41 -0700)]
[profile] Make atexit hook a no-op on Fuchsia

On Fuchsia, we always use the continuous mode with runtime counter
relocation, so there's no need for atexit hook or support for dumping
the profile manually.

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

2 years ago[libc++] Update a bad documentation link
Eric Fiselier [Wed, 25 Mar 2020 01:33:42 +0000 (21:33 -0400)]
[libc++] Update a bad documentation link

2 years agoAMDGPU/GlobalISel: Add some end to end tests for fma selection
Matt Arsenault [Wed, 25 Mar 2020 01:21:59 +0000 (21:21 -0400)]
AMDGPU/GlobalISel: Add some end to end tests for fma selection

2 years agoRevert "Allow remapping Clang module include paths"
Adrian Prantl [Wed, 25 Mar 2020 00:56:36 +0000 (17:56 -0700)]
Revert "Allow remapping Clang module include paths"

to investigate why this commit broke a test in the LLDB testsuite.

This reverts commit dca920a904c27f4c86e909ef2e4e343d48168cca.

2 years agoAMDGPU/GlobalISel: Add select patterns for v_and_or_b32
Matt Arsenault [Wed, 25 Mar 2020 00:47:54 +0000 (20:47 -0400)]
AMDGPU/GlobalISel: Add select patterns for v_and_or_b32

2 years agoAMDGPU/GlobalISel: Add load legalization tests
Matt Arsenault [Wed, 25 Mar 2020 00:33:39 +0000 (20:33 -0400)]
AMDGPU/GlobalISel: Add load legalization tests

2 years agoAMDGPU/GlobalISel: Add missing tests for G_FRINT selection
Matt Arsenault [Wed, 25 Mar 2020 00:27:00 +0000 (20:27 -0400)]
AMDGPU/GlobalISel: Add missing tests for G_FRINT selection

2 years agoAllow remapping Clang module include paths
Adrian Prantl [Wed, 18 Mar 2020 22:30:20 +0000 (15:30 -0700)]
Allow remapping Clang module include paths

rdar://problem/55685132

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

2 years agoAdd an -object-path-prefix option to dsymutil
Adrian Prantl [Wed, 18 Mar 2020 22:31:39 +0000 (15:31 -0700)]
Add an -object-path-prefix option to dsymutil

to remap object file paths (but no source paths) before
processing. This is meant to be used for Clang objects where the
module cache location was remapped using ``-fdebug-prefix-map``; to
help dsymutil find the Clang module cache.

<rdar://problem/55685132>

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

2 years agoGlobalISel: Introduce bitcast legalize action
Matt Arsenault [Thu, 13 Feb 2020 20:52:32 +0000 (15:52 -0500)]
GlobalISel: Introduce bitcast legalize action

For some operations, the type is unimportant and only the number of
bits matters. For example I don't want to treat <4 x s8> as a legal
type, but I also don't want to decompose loads of this into smaller
pieces to get legal register types.

On AMDGPU in SelectionDAG, we legalize a number of operations (most
notably load and store) by coercing all types to vectors of i32. For
GlobalISel, I'm trying very hard to avoid doing this for every type,
but I don't think this strategy can be completely avoided. I'm trying
to avoid bitcasts for any legitimately legal type we can operate on,
since the intervening bitcasts have proven to be a hassle.

For loads, I think I can get away without ever casting the result
type, and handling any arbitrary bitwidth during selection (I will
eventually want new tablegen support to help with this, rather than
having to add every possible type as legal). The unmerge required to
do anything with the value should expand to the expected shifts. This
is trickier for stores, since it would now require handling a wide
array of truncates during selection which I don't want.

Future potentially interesting case are for vector indexing, where
sub-dword type should be indexed in s32 pieces.

2 years ago[mlir][GPU] Use StructAttr to drive lowering from loop.parallel to
MaheshRavishankar [Tue, 24 Mar 2020 22:55:36 +0000 (15:55 -0700)]
[mlir][GPU] Use StructAttr to drive lowering from loop.parallel to
gpu.launch

Current implementation of lowering from loop.parallel to gpu.launch
uses a DictionaryAttr to specify the mapping. Moving this attribute to
be auto-generated from specification as a StructAttr. This simplifies
a lot the logic of looking up and creating this attribute.

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

2 years agoAdd a `Symbolizer::GetEnvP()` method that allows symbolizer implementations to custom...
Dan Liew [Tue, 24 Mar 2020 02:57:33 +0000 (19:57 -0700)]
Add a `Symbolizer::GetEnvP()` method that allows symbolizer implementations to customise the environment of the symbolizer binary.

Summary:
This change introduces the `Symbolizer::GetEnvP()` method that returns a
pointer to environment array used for spawning the symbolizer process.
The motivation is to allow implementations to customise the environment
if required.  The default implementation just returns
`__sanitizer::GetEnviron()` which (provided it's implemented) should
preserve the existing behaviours of the various implementations.

This change has been plumbed through the `internal_spawn(...)` and
`StartSubprocess(...)` process spawning implementations.

For the `StartSubprocess()` implementation we need to call `execve()`
rather than `execv()` to pass the environment. However, it appears that
`internal_execve(...)` exists in sanitizer_common so this patch use that
which seems like a nice clean up.

Support in the Windows implementation of
`SymbolizerProcess:StartSymbolizerSubprocess()` has not been added
because the Windows sanitizer runtime doesn't implement `GetEnviron()`.

rdar://problem/58789439

Reviewers: kubamracek, yln, dvyukov, vitalybuka, eugenis, phosek, aizatsky, rnk

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

2 years ago[LVI] Convert some checks to assertions; NFC
Nikita Popov [Tue, 24 Mar 2020 21:39:25 +0000 (22:39 +0100)]
[LVI] Convert some checks to assertions; NFC

solveBlockValue() should only be called if the value isn't cached
yet. Similarly, it does not make sense to "solve" a constant.

2 years ago[libc++] Install a recent CMake in the Docker build bots
Louis Dionne [Tue, 24 Mar 2020 22:06:23 +0000 (18:06 -0400)]
[libc++] Install a recent CMake in the Docker build bots

2 years ago[libc++] Build the dylib with C++17 to allow aligned new/delete
Louis Dionne [Thu, 27 Feb 2020 13:14:38 +0000 (08:14 -0500)]
[libc++] Build the dylib with C++17 to allow aligned new/delete

This allows simplifying the implementation of barriers.

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

2 years ago[GWP-ASan] Only pack frames that are stored.
Mitch Phillips [Tue, 24 Mar 2020 21:37:07 +0000 (14:37 -0700)]
[GWP-ASan] Only pack frames that are stored.

Summary:
Backtrace() returns the number of frames that are *available*, rather
than the number of frames stored. When we pack, we supply the number of
frames we have stored. The number of available frames can exceed the
number of stored frames, leading to stack OOB read.

Fix up this problem.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: #sanitizers, morehouse, cferris, pcc

Tags: #sanitizers

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

2 years ago[clang codegen] Clean up handling of vectors with trivial-auto-var-init.
Eli Friedman [Fri, 20 Mar 2020 21:18:04 +0000 (14:18 -0700)]
[clang codegen] Clean up handling of vectors with trivial-auto-var-init.

The code was pretending to be doing something useful with vectors, but
really it was doing nothing: the element type of a vector is always a
scalar type, so constWithPadding would always just return the input constant.

Split off from D75661 so it can be reviewed separately.

While I'm here, also add testcase to show missing vector handling.

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

2 years ago[test][clang][driver] Add required features.
Michael Liao [Tue, 24 Mar 2020 20:58:15 +0000 (16:58 -0400)]
[test][clang][driver] Add required features.

- to avoid false alarms on builds without that features.

2 years ago[AArch64][GlobalISel] Don't localize TLS G_GLOBAL_VALUEs on Darwin.
Amara Emerson [Mon, 23 Mar 2020 22:49:55 +0000 (15:49 -0700)]
[AArch64][GlobalISel] Don't localize TLS G_GLOBAL_VALUEs on Darwin.

On Darwin these need to be selected into a function call for the TLS
address lookup. As a result, they can't be moved below a physreg write,
which happens in call sequences. In the long term, we should have some
mechanism in the localizer to prevent localizing into target-specific
atomic instruction sequences.

rdar://60056248

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

2 years ago[Attributor] Use knowledge retained in llvm.assume (operand bundles)
Johannes Doerfert [Thu, 20 Feb 2020 08:06:48 +0000 (02:06 -0600)]
[Attributor] Use knowledge retained in llvm.assume (operand bundles)

This patch integrates operand bundle llvm.assumes [0] with the
Attributor. Most IRAttributes will now look at uses of the associated
value and if there are llvm.assume operand bundle uses with the right
tag we will check if they are in the must-be-executed-context (around
the context instruction). Droppable users, which is currently only
llvm::assume, are handled special in some places now as well.

[0] http://lists.llvm.org/pipermail/llvm-dev/2019-December/137632.html

Reviewed By: uenoku

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

2 years agoRevert "Convert a reachable llvm_unreachable into an assert."
Aaron Ballman [Tue, 24 Mar 2020 20:05:42 +0000 (16:05 -0400)]
Revert "Convert a reachable llvm_unreachable into an assert."

This reverts commit 4a0267e3ad8c4d47f267d7d960f127e099fb4818.

2 years ago[Darwin] Add another hint to find the kernel. NFC.
Davide Italiano [Tue, 24 Mar 2020 20:04:08 +0000 (13:04 -0700)]
[Darwin] Add another hint to find the kernel. NFC.

2 years ago[mlir] Clarify constraint on derived attribute
Jacques Pienaar [Tue, 24 Mar 2020 17:18:46 +0000 (10:18 -0700)]
[mlir] Clarify constraint on derived attribute

Summary:
The restriction that a derived attribute should represent an
attribute/be materializable as an attribute was not made clear.

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

2 years ago[lldb/DWARF] Reland: Use DW_AT_call_pc to determine artificial frame address
Vedant Kumar [Wed, 18 Mar 2020 00:59:08 +0000 (17:59 -0700)]
[lldb/DWARF] Reland: Use DW_AT_call_pc to determine artificial frame address

Reland with changes: the test modified in this change originally failed
on a Debian/x86_64 builder, and I suspect the cause was that lldb looked
up the line location for an artificial frame by subtracting 1 from the
frame's address. For artificial frames, the subtraction must not happen
because the address is already exact.

---

lldb currently guesses the address to use when creating an artificial
frame (i.e., a frame constructed by determining the sequence of (tail)
calls which must have happened).

Guessing the address creates problems -- use the actual address provided
by the DW_AT_call_pc attribute instead.

Depends on D76336.

rdar://60307600

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

2 years ago[X86] Disable autoupgrade support for avx512.mask.broadcasti32x2.* and avx512.mask...
Craig Topper [Tue, 24 Mar 2020 19:23:18 +0000 (12:23 -0700)]
[X86] Disable autoupgrade support for avx512.mask.broadcasti32x2.* and avx512.mask.broadcastf32x2.*.

These intrinsics take a v4i32/v4f32 input and are supposed to
broadcast elements 0 and 1. Instead the autoupgrade code was
broadcasting elements 0, 1, 2, and 3.

I could fix the autoupgrade, but since its been broken for years
it seemed better just to steer anyone still trying to use it away
completely.

2 years ago[CodeGen] Add an alignment attribute to all sret parameters
Erik Pilkington [Tue, 24 Mar 2020 16:36:19 +0000 (12:36 -0400)]
[CodeGen] Add an alignment attribute to all sret parameters

This fixes a miscompile when the parameter is actually underaligned.
rdar://58316406

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

2 years ago[libc++] NFC: Reuse the TEST_CONCAT macro instead of reimplementing one
Louis Dionne [Tue, 24 Mar 2020 19:28:03 +0000 (15:28 -0400)]
[libc++] NFC: Reuse the TEST_CONCAT macro instead of reimplementing one

2 years ago[lldb] Always log if acquiring packet sequence mutex fails
Raphael Isemann [Tue, 24 Mar 2020 19:24:48 +0000 (20:24 +0100)]
[lldb] Always log if acquiring packet sequence mutex fails

Summary:
Currently we only log in debug builds but I don't see why we would do this as this is neither
expensive and seems useful.

I looked into the git history of this code and it seems originally there was also an assert here
and the logging here was the #else branch branch for non-Debug builds.

Reviewers: #lldb, labath

Reviewed By: labath

Subscribers: JDevlieghere

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

2 years agoRevert "[lldb/DWARF] Use DW_AT_call_pc to determine artificial frame address"
Vedant Kumar [Tue, 24 Mar 2020 19:22:12 +0000 (12:22 -0700)]
Revert "[lldb/DWARF] Use DW_AT_call_pc to determine artificial frame address"

This reverts commit 6905394d153960ded3a7b884a9747ed2d4a6e8d8. The
changed test is failing on Debian/x86_64, possibly because lldb is
subtracting an offset from the DW_AT_call_pc address used for the
artificial frame:

http://lab.llvm.org:8011/builders/lldb-x86_64-debian/builds/7171/steps/test/logs/stdio

/home/worker/lldb-x86_64-debian/lldb-x86_64-debian/llvm-project/lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/main.cpp:6:17: error: CHECK-NEXT: expected string not found in input
 // CHECK-NEXT: frame #1: 0x{{[0-9a-f]+}} a.out`func3() at main.cpp:14:3 [opt] [artificial]
                ^
<stdin>:3:2: note: scanning from here
 frame #1: 0x0000000000401127 a.out`func3() at main.cpp:13:4 [opt] [artificial]

2 years ago[VectorCombine] add tests for bitcast (shuffle); NFC
Sanjay Patel [Tue, 24 Mar 2020 19:11:15 +0000 (15:11 -0400)]
[VectorCombine] add tests for bitcast (shuffle); NFC

2 years ago[lldb][NFC] Always update m_cache_{hits/misses} in FormatCache
Raphael Isemann [Tue, 24 Mar 2020 19:16:41 +0000 (20:16 +0100)]
[lldb][NFC] Always update m_cache_{hits/misses} in FormatCache

Summary:
These two variables are only incremented under LLDB_CONFIGURATION_DEBUG but their
value is always logged when verbose lldb formatter logging is enabled, which causes that our
cache hit/miss log looks like this in non-Debug builds:

```
Cache hits: 0 - Cache Misses: 0
...
Cache hits: 0 - Cache Misses: 0
...
Cache hits: 0 - Cache Misses: 0
```

This just always increments those two counters independent of build mode.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

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

2 years ago[lldb] Don't dump the frame in SBTarget::EvaluateExpression in LLDB_CONFIGURATION_DEBUG
Raphael Isemann [Tue, 24 Mar 2020 19:16:07 +0000 (20:16 +0100)]
[lldb] Don't dump the frame in SBTarget::EvaluateExpression in LLDB_CONFIGURATION_DEBUG

Summary:
Dumping the frame using the user-set format could cause that a debug LLDB doesn't behave as a release LLDB,
which could potentially break replaying a reproducer.

Also it's kinda strange that the frame format set by the user is used in the internal log output.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

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

2 years ago[mlir] Revamp operation documentation generation
River Riddle [Tue, 24 Mar 2020 18:57:13 +0000 (11:57 -0700)]
[mlir] Revamp operation documentation generation

Summary:
This revisions performs several cleanups to the generated dialect documentation:
* Standardizes format of attributes/operands/results sections
* Splits out operation/type/dialect documentation generation to allow for composing generated and hand-written documentation
* Add section for declarative assembly syntax and successors
* General cleanup

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

2 years agoRe-land "Avoid emitting unreachable SP adjustments after `throw`"
Reid Kleckner [Tue, 24 Mar 2020 18:49:44 +0000 (11:49 -0700)]
Re-land "Avoid emitting unreachable SP adjustments after `throw`"

This reverts commit 4e0fe038f438ae1679eae9e156e1f248595b2373. Re-lands
65b21282c710afe9c275778820c6e3c1cf46734b.

After landing 5ff5ddd0adc89f8827b345577bbb3e7eb74fc644 to add int3 into
trailing unreachable blocks, we can now remove these extra stack
adjustments without confusing the Win64 unwinder. See
https://llvm.org/45064#c4 or X86AvoidTrailingCall.cpp for a full
explanation.

Fixes PR45064.

2 years ago[lit] Allow passing extra commands to executeShTest
Louis Dionne [Thu, 19 Mar 2020 03:17:11 +0000 (23:17 -0400)]
[lit] Allow passing extra commands to executeShTest

This allows creating custom test formats on top of `executeShTest` that
inject commands at the beginning of the file being parsed, without
requiring these commands to physically appear in the test file itself.

For example, one could define a test format that prints out additional
debug information at the beginning of each test. More realistically,
this has been used to define custom test formats like one that supports
compilation failure tests (e.g. with the extension `compile.fail.cpp`)
by injecting a command that calls the compiler on the file itself and
expects it to fail.

Without this change, the only alternative is to create a temporary file
with the same content as the original test, then prepend the desired
`// RUN:` lines to that file, and call `executeShTest` on that file
instead. This is both slow and cumbersome to do.

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

2 years ago[lldb/DWARF] Use DW_AT_call_pc to determine artificial frame address
Vedant Kumar [Wed, 18 Mar 2020 00:59:08 +0000 (17:59 -0700)]
[lldb/DWARF] Use DW_AT_call_pc to determine artificial frame address

lldb currently guesses the address to use when creating an artificial
frame (i.e., a frame constructed by determining the sequence of (tail)
calls which must have happened).

Guessing the address creates problems -- use the actual address provided
by the DW_AT_call_pc attribute instead.

Depends on D76336.

rdar://60307600

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

2 years ago[DWARF] Emit DW_AT_call_pc for tail calls
Vedant Kumar [Wed, 18 Mar 2020 00:56:28 +0000 (17:56 -0700)]
[DWARF] Emit DW_AT_call_pc for tail calls

Record the address of a tail-calling branch instruction within its call
site entry using DW_AT_call_pc. This allows a debugger to determine the
address to use when creating aritificial frames.

This creates an extra attribute + relocation at tail call sites, which
constitute 3-5% of all call sites in xnu/clang respectively.

rdar://60307600

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

2 years agoNFC: Fix typos in TestingGuide documentation
Louis Dionne [Tue, 24 Mar 2020 18:54:25 +0000 (14:54 -0400)]
NFC: Fix typos in TestingGuide documentation

2 years ago[libomptarget][nfc] Explicitly static function scope shared variables
JonChesterfield [Tue, 24 Mar 2020 18:51:36 +0000 (18:51 +0000)]
[libomptarget][nfc] Explicitly static function scope shared variables

Summary:
[libomptarget][nfc] Explicitly static function scope shared variables

`__shared__` in CUDA implies static in function scope. See e.g. D.2.1.1
in CUDA_C_Programming_Guide.pdf,
http://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/

This is surprising for non-cuda developers, see e.g. D73239 where I thought
local variables would be thread local.

Tested by IR diff of libomptarget.bc (no change), running in tree tests,
and binary diff of the nvcc static archives (no significant change).

Reviewers: jdoerfert, ABataev, grokos

Reviewed By: jdoerfert

Subscribers: openmp-commits

Tags: #openmp

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

2 years ago[lit] NFC: Document missing result codes
Louis Dionne [Tue, 24 Mar 2020 18:45:17 +0000 (14:45 -0400)]
[lit] NFC: Document missing result codes

These result codes already exist, but they were not documented. I assume
this is an oversight when adding these result codes.

2 years ago[DivRemPairs] Freeze operands if they can be undef values
Juneyoung Lee [Tue, 24 Mar 2020 18:31:45 +0000 (03:31 +0900)]
[DivRemPairs] Freeze operands if they can be undef values

Summary:
DivRemPairs is unsound with respect to undef values.

```
      // bb1:
      //   %rem = srem %x, %y
      // bb2:
      //   %div = sdiv %x, %y
      // -->
      // bb1:
      //   %div = sdiv %x, %y
      //   %mul = mul %div, %y
      //   %rem = sub %x, %mul
```

If X can be undef, X should be frozen first.
For example, let's assume that Y = 1 & X = undef:
```
   %div = sdiv undef, 1 // %div = undef
   %rem = srem undef, 1 // %rem = 0
 =>
   %div = sdiv undef, 1 // %div = undef
   %mul = mul %div, 1   // %mul = undef
   %rem = sub %x, %mul  // %rem = undef - undef = undef
```
http://volta.cs.utah.edu:8080/z/m7Xrx5

Same for Y. If X = 1 and Y = (undef | 1), %rem in src is either 1 or 0,
but %rem in tgt can be one of many integer values.

This resolves https://bugs.llvm.org/show_bug.cgi?id=42619 .

This miscompilation disappears if undef value is removed, but it may take a while.
DivRemPair happens pretty late during the optimization pipeline, so this optimization seemed as a good candidate to fix without major regression using freeze than other broken optimizations.

Reviewers: spatel, lebedev.ri, george.burgess.iv

Reviewed By: spatel

Subscribers: wuzish, regehr, nlopes, nemanjai, hiraditya, llvm-commits

Tags: #llvm

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

2 years ago[SelectionDAG] Don't crash when freezing illegal float types
Benjamin Kramer [Tue, 24 Mar 2020 18:44:18 +0000 (19:44 +0100)]
[SelectionDAG] Don't crash when freezing illegal float types

2 years ago[X86][AVX] Add some v32i16 to v32i8 style truncation shuffle tests
Simon Pilgrim [Tue, 24 Mar 2020 17:56:49 +0000 (17:56 +0000)]
[X86][AVX] Add some v32i16 to v32i8 style truncation shuffle tests

2 years agoAMDGPU/GlobalISel: Add more tests for add3 folding
Matt Arsenault [Tue, 24 Mar 2020 18:30:24 +0000 (14:30 -0400)]
AMDGPU/GlobalISel: Add more tests for add3 folding

Forget to squash into 2ea46051055b37faf95c58daad57608bb7610f58

2 years agoAMDGPU/GlobalISel: Add some more tests for add3 folding
Matt Arsenault [Tue, 24 Mar 2020 18:26:23 +0000 (14:26 -0400)]
AMDGPU/GlobalISel: Add some more tests for add3 folding

These currently fail to form add3 due to the pointer type, but they
should be handle.

2 years agoAMDGPU/GlobalISel: Fix smrd loads of v4i64
Matt Arsenault [Sun, 9 Feb 2020 21:30:22 +0000 (16:30 -0500)]
AMDGPU/GlobalISel: Fix smrd loads of v4i64

2 years ago[ValueTracking] improve undef/poison analysis for constant vectors
Sanjay Patel [Tue, 24 Mar 2020 17:34:39 +0000 (13:34 -0400)]
[ValueTracking] improve undef/poison analysis for constant vectors

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

2 years ago[lldb] Remove some debugging printfs from ITSession code
Raphael Isemann [Tue, 24 Mar 2020 17:09:25 +0000 (18:09 +0100)]
[lldb] Remove some debugging printfs from ITSession code

Summary:
This seems only useful for debugging and it's just plainly printf'ing to the console instead
of some log, so let's remove this.

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere

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

2 years ago[gn build] Port b91905a2637
LLVM GN Syncbot [Tue, 24 Mar 2020 16:46:53 +0000 (16:46 +0000)]
[gn build] Port b91905a2637

2 years agoRevert "Include static prof data when collecting loop BBs"
Hiroshi Yamauchi [Tue, 24 Mar 2020 16:23:26 +0000 (09:23 -0700)]
Revert "Include static prof data when collecting loop BBs"

This reverts commit 129c911efaa492790c251b3eb18e4db36b55cbc5.

Due to an internal benchmark regression.

2 years ago[gn build] (manually) port 8140f6bcde4 better
Nico Weber [Tue, 24 Mar 2020 16:39:49 +0000 (12:39 -0400)]
[gn build] (manually) port 8140f6bcde4 better

2 years ago[gn build] (manually) port 8140f6bcde4
Nico Weber [Tue, 24 Mar 2020 16:38:25 +0000 (12:38 -0400)]
[gn build] (manually) port 8140f6bcde4

2 years ago[gn build] Port 49e5a97ec36
Nico Weber [Tue, 24 Mar 2020 16:36:08 +0000 (12:36 -0400)]
[gn build] Port 49e5a97ec36

2 years ago[lldb/Reproducers] Collect files imported by command script import
Jonas Devlieghere [Tue, 24 Mar 2020 15:54:26 +0000 (08:54 -0700)]
[lldb/Reproducers] Collect files imported by command script import

Files imported by the script interpreter aren't opened by LLDB so they
don't end up in the reproducer. The solution is to explicitly add them
to the FileCollector.

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

2 years ago[ARM] Fold VMOVrh VLDR to LDRH
David Green [Tue, 24 Mar 2020 10:14:52 +0000 (10:14 +0000)]
[ARM] Fold VMOVrh VLDR to LDRH

This adds a simple fold to combine VMOVrh load to a integer load.
Similar to what is already performed for BITCAST, but needs to account
for the types being of different sizes, creating an zero extending load.

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

2 years ago[InstSimplify] add tests for freeze(constexpr); NFC
Sanjay Patel [Tue, 24 Mar 2020 15:38:56 +0000 (11:38 -0400)]
[InstSimplify] add tests for freeze(constexpr); NFC

2 years ago[MachinePipeliner] Fix a bug in Output Dependency chains
Lama [Tue, 24 Mar 2020 14:32:00 +0000 (14:32 +0000)]
[MachinePipeliner] Fix a bug in Output Dependency chains

The current implementation collects all Preds/Succs of a Dep of kind Output, creating a long chain and subsequently a schedule with an unnecessarily large II.
Was this done on purpose for a reason I'm missing?

Reviewed By: bcahoon

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

2 years ago[X86][SSE1] Add support for logic+movmsk patterns (PR42870)
Simon Pilgrim [Tue, 24 Mar 2020 14:28:25 +0000 (14:28 +0000)]
[X86][SSE1] Add support for logic+movmsk patterns (PR42870)

rL368506 handled the basic case, but we need to account for boolean logic patterns as well.

2 years ago[ARM][CMSE] Fix clang/test/Driver/save-temps.c test.
Alexander Belyaev [Tue, 24 Mar 2020 14:14:06 +0000 (15:14 +0100)]
[ARM][CMSE] Fix clang/test/Driver/save-temps.c test.

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

2 years ago[Parser] Fix the assertion crash in ActOnStartOfSwitch stmt.
Haojian Wu [Sat, 21 Mar 2020 12:48:35 +0000 (13:48 +0100)]
[Parser] Fix the assertion crash in ActOnStartOfSwitch stmt.

Summary:
After we parse the switch condition, we don't do the type check for
type-dependent expr (e.g. TypoExpr) (in Sema::CheckSwitchCondition), then the
TypoExpr is corrected to an invalid-type expr (in Sema::MakeFullExpr) and passed
to the ActOnStartOfSwitchStmt, which triggers the assertion.

Fix https://github.com/clangd/clangd/issues/311

Reviewers: sammccall

Subscribers: ilya-biryukov, kadircet, usaxena95, cfe-commits

Tags: #clang

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

2 years ago[libc++] Fix installation of cxx_experimental
Louis Dionne [Tue, 24 Mar 2020 14:06:00 +0000 (10:06 -0400)]
[libc++] Fix installation of cxx_experimental

cxx_experimental was never installed because ${experimental_lib} always
expands to an empty target. This seems to have been broken by 97d6fcce4ec6.

2 years ago[CUDA][HIP] Add -Xarch_device and -Xarch_host options
Yaxun (Sam) Liu [Mon, 23 Mar 2020 18:23:09 +0000 (14:23 -0400)]
[CUDA][HIP] Add -Xarch_device and -Xarch_host options

The argument after -Xarch_device will be added to the arguments for CUDA/HIP
device compilation and will be removed for host compilation.

The argument after -Xarch_host will be added to the arguments for CUDA/HIP
host compilation and will be removed for device compilation.

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

2 years ago[DWARF] Fix v5 debug_line parsing of prologues with many files
Pavel Labath [Fri, 20 Mar 2020 14:27:37 +0000 (15:27 +0100)]
[DWARF] Fix v5 debug_line parsing of prologues with many files

Summary:
The directory_count and file_name_count fields are (section 6.2.4 of
DWARF5 spec) supposed to be uleb128s, not bytes. This bug meant that it
was not possible to correctly parse headers with more than 128 files or
directories.

I've found this bug by code inspection, though the limit is so small
someone would have run into it for real sooner or later. I've verified
that the producer side handles many files correctly, and that we are
able to parse such files after this fix.

Reviewers: dblaikie, jhenderson

Subscribers: aprantl, hiraditya, llvm-commits

Tags: #llvm

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

2 years ago[SelDag] Add FREEZE
Juneyoung Lee [Mon, 23 Mar 2020 04:03:13 +0000 (13:03 +0900)]
[SelDag] Add FREEZE

Summary:
- Add FREEZE node to SelDag
- Lower FreezeInst (in IR) to FREEZE node
- Add Legalization for FREEZE node

Reviewers: qcolombet, bogner, efriedma, lebedev.ri, nlopes, craig.topper, arsenm

Reviewed By: lebedev.ri

Subscribers: wdng, xbolva00, Petar.Avramovic, liuz, lkail, dylanmckay, hiraditya, Jim, arsenm, craig.topper, RKSimon, spatel, lebedev.ri, regehr, trentxintong, nlopes, mkuper, llvm-commits

Tags: #llvm

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

2 years ago[InstSimplify] add more tests for freeze(constant); NFC
Sanjay Patel [Tue, 24 Mar 2020 13:41:43 +0000 (09:41 -0400)]
[InstSimplify] add more tests for freeze(constant); NFC

These should really be moved over to a ConstantFolding test file,
but since this may overlap with the in-progress D76010 and similar
tests already exist here, we can do that as a later cleanup.

2 years ago[lld-link] Support /map option, matching link.exe 's /map output format
Sylvain Audi [Mon, 23 Mar 2020 21:06:48 +0000 (17:06 -0400)]
[lld-link] Support /map option, matching link.exe 's /map output format

Added support for /map and /map:[filepath].
The output was derived from Microsoft's Link.exe output when using that same option.
Note that /MAPINFO support was not added.

The previous implementation of MapFile.cpp/.h was meant for /lldmap, and was renamed to LLDMapFile.cpp/.h
MapFile.cpp/.h is now for /MAP
However, a small fix was added to lldmap, replacing a std::sort with std::stable_sort to enforce reproducibility.

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

2 years agoData formatters: fix detection of C strings
Jaroslav Sevcik [Tue, 24 Mar 2020 13:08:39 +0000 (14:08 +0100)]
Data formatters: fix detection of C strings

Summary:
Detection of C strings does not work well for pointers. If the value object holding a (char*) pointer does not have an address (e.g., if it is a temp), the value is not considered a C string and its formatting is left to DumpDataExtractor rather than the special handling in  ValueObject::DumpPrintableRepresentation. This leads to inconsistent outputs, e.g., in escaping non-ASCII characters. See the test for an example; the second test expectation is not met (without this patch). With this patch, the C string detection only insists that the pointer value is valid. The patch makes the code consistent with how the pointer is obtained in ValueObject::ReadPointedString.

Reviewers: teemperor

Reviewed By: teemperor

Subscribers: lldb-commits

Tags: #lldb

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

2 years ago[X86][SSE1] Add additional logic+movmsk patterns that scalarize (PR42870)
Simon Pilgrim [Tue, 24 Mar 2020 13:20:24 +0000 (13:20 +0000)]
[X86][SSE1] Add additional logic+movmsk patterns that scalarize (PR42870)

rL368506 handled the basic case, but we need to account for boolean logic patterns as well.

2 years ago[mlir][StandardToSPIRV] Add support for lowering unary ops
Hanhan Wang [Tue, 24 Mar 2020 13:15:54 +0000 (09:15 -0400)]
[mlir][StandardToSPIRV] Add support for lowering unary ops

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

2 years ago[ConstantRange] Add initial support for binaryXor.
Florian Hahn [Tue, 24 Mar 2020 12:47:24 +0000 (12:47 +0000)]
[ConstantRange] Add initial support for binaryXor.

The initial implementation just delegates to APInt's implementation of
XOR for single element ranges and conservatively returns the full set
otherwise.

Reviewers: nikic, spatel, lebedev.ri

Reviewed By: nikic

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

2 years ago[CodeGen] Fix test attr-noreturn.c when run from my home directory
Sam McCall [Tue, 24 Mar 2020 12:59:16 +0000 (13:59 +0100)]
[CodeGen] Fix test attr-noreturn.c when run from my home directory

2 years ago[AST] Use TypeDependence bitfield to calculate dependence on Types. NFC
Sam McCall [Thu, 19 Mar 2020 10:58:00 +0000 (11:58 +0100)]
[AST] Use TypeDependence bitfield to calculate dependence on Types. NFC

Summary:
This clears the way for adding an Error dependence bit to Type and having it
mostly-automatically propagated.

Reviewers: hokein

Subscribers: jfb, cfe-commits

Tags: #clang

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

2 years agoMake helpers static. NFC.
Benjamin Kramer [Tue, 24 Mar 2020 12:43:00 +0000 (13:43 +0100)]
Make helpers static. NFC.

2 years agoFix unused variable warning
Simon Pilgrim [Tue, 24 Mar 2020 11:40:02 +0000 (11:40 +0000)]
Fix unused variable warning

2 years agoIncrease DIAG_SIZE_DRIVER as we're close to hitting it
Russell Gallop [Tue, 24 Mar 2020 11:43:51 +0000 (11:43 +0000)]
Increase DIAG_SIZE_DRIVER as we're close to hitting it

2 years ago[ReleaseNotes,ARM] MVE intrinsics are all implemented!
Simon Tatham [Tue, 24 Mar 2020 11:37:51 +0000 (11:37 +0000)]
[ReleaseNotes,ARM] MVE intrinsics are all implemented!

Summary:
The next release of LLVM will support the full ACLE spec for MVE intrinsics,
so it's worth saying so in the release notes.

Reviewers: kristof.beyls

Reviewed By: kristof.beyls

Subscribers: cfe-commits, hans, dmgreen, llvm-commits

Tags: #llvm, #clang

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

2 years ago[clangd] Change line break behaviour for hoverinfo
Lorenz Junglas [Tue, 24 Mar 2020 11:30:51 +0000 (12:30 +0100)]
[clangd] Change line break behaviour for hoverinfo

`parseDocumentation` retains hard line breaks and removes soft line
breaks inside documentation comments.
Wether a line break is hard or soft is determined by the following rules
(some of which have been discussed in
https://github.com/clangd/clangd/issues/95):

Line breaks that are preceded by a punctuation are retained
Line breaks that are followed by "interesting characters" (e.g. Markdown
syntax, doxygen commands) are retained
All other line breaks are removed

Related issue: https://github.com/clangd/clangd/issues/95

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

2 years ago[lldb][NFC] Mark GetNextPersistentVariableName as overriden to silence warning
Raphael Isemann [Tue, 24 Mar 2020 11:30:01 +0000 (12:30 +0100)]
[lldb][NFC] Mark GetNextPersistentVariableName as overriden to silence warning

This was triggering -Winconsistent-missing-override warnings.

2 years ago[NFC][ARM] Add missing tests
Sam Parker [Tue, 24 Mar 2020 11:07:20 +0000 (11:07 +0000)]
[NFC][ARM] Add missing tests

2 years ago[UpdateTestChecks] Use common ir function name matcher and extend to accept periods...
Simon Pilgrim [Tue, 24 Mar 2020 10:59:08 +0000 (10:59 +0000)]
[UpdateTestChecks] Use common ir function name matcher and extend to accept periods in names (PR37586)

Remove the local versions of the IR_FUNCTION_RE matcher (they weren't doing anything different), and ensure all the function name matchers accept '.' and '-'.

We don't need to use '\.' inside python regex sets either, or '\-' as long as thats at the end of the set.

2 years agotsan: Adding releaseAcquire() to ThreadClock
Dmitry Vyukov [Tue, 24 Mar 2020 09:27:08 +0000 (10:27 +0100)]
tsan: Adding releaseAcquire() to ThreadClock

realeaseAcquire() is a new function added to TSan in support of the Go data-race detector.
It's semantics is:

void ThreadClock::releaseAcquire(SyncClock *sc) const {
  for (int i = 0; i < kMaxThreads; i++) {
    tmp = clock[i];
    clock[i] = max(clock[i], sc->clock[i]);
    sc->clock[i] = tmp;
  }
}

For context see: https://go-review.googlesource.com/c/go/+/220419

Reviewed-in: https://reviews.llvm.org/D76322
Author: dfava (Daniel Fava)

2 years ago[ARM][CMSE] Implement CMSE attributes
Momchil Velikov [Tue, 24 Mar 2020 09:32:51 +0000 (09:32 +0000)]
[ARM][CMSE] Implement CMSE attributes

This patch adds CMSE attributes `cmse_nonsecure_call` and
`cmse_nonsecure_entry`.  As usual, specification is available here:
https://developer.arm.com/docs/ecm0359818/latest

Patch by Javed Absar, Bradley Smith, David Green, Momchil Velikov,
possibly others.

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

2 years ago[ARM] Don't split trunc stores that can be better handled as VMOVN
David Green [Tue, 24 Mar 2020 08:47:50 +0000 (08:47 +0000)]
[ARM] Don't split trunc stores that can be better handled as VMOVN

We deliberately split stores of the form
store(truncate(larger-than-legal-type)) into two stores, allowing each
store to perform part of the truncate for free.

There are times however where it makes more sense to use VMOVN to
de-interlace the results back into a single vector, and store that in
one go. This adds a check for that situation, not splitting the store if
it looks like a VMOVN can be more useful.

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

2 years ago[ARM][LowOverheadLoops] Add checks for narrowing
Sam Parker [Tue, 24 Mar 2020 08:41:48 +0000 (08:41 +0000)]
[ARM][LowOverheadLoops] Add checks for narrowing

Modify ValidateLiveOuts to track 'FalseLaneZeros' more precisely,
including checks on specific operations that can generate non-zeros
from zero values, e.g VMVN. We can then check that any instructions
that retain some information in their output register (all narrowing
instructions) that they only use and def registers that always have
zeros in their falsely predicated bytes, whether or not tail
predication happens.

Most of the logic remains the same, just the names of the data
structures and helpers have been renamed to reflect the change in
logic. The key change, apart from the opcode checkers, is that the
FalseZeros set now strictly contains only instructions which will
always generate zeros, and not instructions that could also have
their false bytes masked away later.

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

2 years ago[ARM][MVE] Add target flag for narrowing insts
Sam Parker [Tue, 24 Mar 2020 08:23:05 +0000 (08:23 +0000)]
[ARM][MVE] Add target flag for narrowing insts

Add a flag, 'RetainsPreviousHalfElement', for operations that operate
on top/bottom halves of their input and only write to half of their
destination, leaving the other half to retain its previous value.

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

2 years ago[AST] Add RecoveryExpr to retain expressions on semantic errors
Haojian Wu [Thu, 19 Mar 2020 15:30:40 +0000 (16:30 +0100)]
[AST] Add RecoveryExpr to retain expressions on semantic errors

Normally clang avoids creating expressions when it encounters semantic
errors, even if the parser knows which expression to produce.

This works well for the compiler. However, this is not ideal for
source-level tools that have to deal with broken code, e.g. clangd is
not able to provide navigation features even for names that compiler
knows how to resolve.

The new RecoveryExpr aims to capture the minimal set of information
useful for the tools that need to deal with incorrect code:

source range of the expression being dropped,
subexpressions of the expression.
We aim to make constructing RecoveryExprs as simple as possible to
ensure writing code to avoid dropping expressions is easy.

Producing RecoveryExprs can result in new code paths being taken in the
frontend. In particular, clang can produce some new diagnostics now and
we aim to suppress bogus ones based on Expr::containsErrors.

We deliberately produce RecoveryExprs only in the parser for now to
minimize the code affected by this patch. Producing RecoveryExprs in
Sema potentially allows to preserve more information (e.g. type of an
expression), but also results in more code being affected. E.g.
SFINAE checks will have to take presence of RecoveryExprs into account.

Initial implementation only works in C++ mode, as it relies on compiler
postponing diagnostics on dependent expressions. C and ObjC often do not
do this, so they require more work to make sure we do not produce too
many bogus diagnostics on the new expressions.

See documentation of RecoveryExpr for more details.

original patch from Ilya
This change is based on https://reviews.llvm.org/D61722

Reviewers: sammccall, rsmith

Reviewed By: sammccall, rsmith

Tags: #clang

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

2 years ago[lldb-vscode] Add missing launchCommands entry in the package.json
Walter Erquinigo [Sat, 21 Mar 2020 02:33:14 +0000 (19:33 -0700)]
[lldb-vscode] Add missing launchCommands entry in the package.json

2 years ago[PowerPC] fix a typo in commit 3f85134d710c
Chen Zheng [Tue, 24 Mar 2020 05:53:59 +0000 (01:53 -0400)]
[PowerPC] fix a typo in commit 3f85134d710c

Implement target hook isProfitableToHoist - typo fix.

2 years agoFix another instance where a variable was renamed in the generated LLVM IR. [NFC]
Douglas Yung [Tue, 24 Mar 2020 05:52:56 +0000 (22:52 -0700)]
Fix another instance where a variable was renamed in the generated LLVM IR. [NFC]

2 years ago[Coroutines] Also check lifetime intrinsic for local variable when build
Jun Ma [Tue, 10 Mar 2020 10:32:55 +0000 (18:32 +0800)]
[Coroutines] Also check lifetime intrinsic for local variable when build
coroutine frame

Currently we move all allocas into the frame when build coroutine frame in
CoroSplit pass. However, this can be relaxed.

Since CoroSplit pass run after Inline pass, we can use lifetime intrinsic to
do such analysis: If the scope of lifetime intrinsic is not across any suspend
point, rather than move the allocas to frame, we can just move them to entry bb
of corresponding function. This reduce the frame size.

More importantly, this also avoid data race in multithread environment.
Consider one inline function by coroutine: it starts a thread which access
local variables, while after inline the movement of allocs to frame also access
them. cause data race.

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

2 years ago[Coroutines] Insert lifetime intrinsics even O0 is used
Jun Ma [Fri, 13 Mar 2020 07:27:45 +0000 (15:27 +0800)]
[Coroutines] Insert lifetime intrinsics even O0 is used

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

2 years ago[GlobalOpt] Treat null-check of loaded value as use of global (PR35760)
Vedant Kumar [Mon, 23 Mar 2020 22:09:38 +0000 (15:09 -0700)]
[GlobalOpt] Treat null-check of loaded value as use of global (PR35760)

PR35760 shows an example program which, when compiled with `clang -O0`
or gcc at any optimization level, prints '0'. However, llvm transforms
the program in a way that causes it to print '1'.

Fix the issue by having `AllUsesOfValueWillTrapIfNull` return false when
analyzing a load from a global which is used by an `icmp`. This special
case was untested [0] so this is just deleting dead code.

An alternative fix might be to change the GlobalStatus analysis for the
global to report "Stored" instead of "StoredOnce". However, "StoredOnce"
is appropriate when only one value other than the initializer is stored
to the global.

[0]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp.html#L662

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

2 years ago[MLIR][NFC] flat affine constraints - refactor to share, renames
Uday Bondhugula [Tue, 24 Mar 2020 04:22:41 +0000 (09:52 +0530)]
[MLIR][NFC] flat affine constraints - refactor to share, renames

- refactor to remove duplicate code
- some renaming / comment updates for readability

Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D76667