platform/upstream/llvm.git
3 years ago[CodeGen][X86] Remove unused check-prefixes from vector reduce tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 06:49:00 +0000 (14:49 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector reduce tests. NFCI.

3 years ago[AArch64][GlobalISel] Port some AArch64 target specific MUL combines from SDAG.
Amara Emerson [Tue, 10 Nov 2020 05:55:22 +0000 (21:55 -0800)]
[AArch64][GlobalISel] Port some AArch64 target specific MUL combines from SDAG.

These do things like turn a multiply of a pow-2+1 into a shift and and add,
which is a common pattern that pops up, and is universally better than expensive
madd instructions with a constant.

I've added check lines to an existing codegen test since the code being ported
is almost identical, however the mul by negative pow2 constant tests don't generate
the same code because we're missing some generic G_MUL combines still.

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

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector shift tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 06:17:24 +0000 (14:17 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector shift tests. NFCI.

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector shuffle tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 05:45:35 +0000 (13:45 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector shuffle tests. NFCI.

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector tzcnt tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 05:31:01 +0000 (13:31 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector tzcnt tests. NFCI.

3 years ago[NFC, Refactor] Rename the (scoped) enum DeclaratorContext's enumerators to remove...
Faisal Vali [Wed, 11 Nov 2020 05:40:12 +0000 (23:40 -0600)]
[NFC, Refactor] Rename the (scoped) enum DeclaratorContext's enumerators to remove duplication

Since these are scoped enumerators, they have to be prefixed by DeclaratorContext, so lets remove Context from the name, and return some characters to the multiverse.

Patch was reviewed here: https://reviews.llvm.org/D91011

Thank you to aaron, bruno, wyatt and barry for indulging me.

3 years ago[SafeStack] Make sure SafeStack does not break musttail call contract
Xun Li [Wed, 11 Nov 2020 04:46:05 +0000 (20:46 -0800)]
[SafeStack] Make sure SafeStack does not break musttail call contract

SafeStack instrumentation should not insert anything inbetween musttail call and return instruction.
For every ReturnInst that needs to be instrumented, we adjust the insertion point to the musttail call if exists.

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

3 years ago[SCEV] Generalize no-self-wrap check in isLoopInvariantExitCondDuringFirstIterations
Max Kazantsev [Wed, 11 Nov 2020 04:17:13 +0000 (11:17 +0700)]
[SCEV] Generalize no-self-wrap check in isLoopInvariantExitCondDuringFirstIterations

Lift limitation on step being `+/- 1`. In fact, the only thing it is needed for
is proving no-self-wrap. We can instead check this flag directly.

Theoretically it can increase the scope of the transform, but I could not
construct such test easily.

Differential Revision: https://reviews.llvm.org/D91126
Reviewed By: apilipenko

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector shuffle tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 03:55:09 +0000 (11:55 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector shuffle tests. NFCI.

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector shift tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 03:43:22 +0000 (11:43 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector shift tests. NFCI.

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector reduce tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 03:31:04 +0000 (11:31 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector reduce tests. NFCI.

3 years ago[CodeGen][X86] Remove unused check-prefixes from vector popcnt tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 03:22:03 +0000 (11:22 +0800)]
[CodeGen][X86] Remove unused check-prefixes from vector popcnt tests. NFCI.

3 years ago[clang] Add missing header guard in <cpuid.h>
Roland McGrath [Wed, 11 Nov 2020 02:56:59 +0000 (18:56 -0800)]
[clang] Add missing header guard in <cpuid.h>

This header has long lacked a standard multiple inclusion guard
like other headers have, for no apparent reason.  The GCC header
of the same name likewise lacks one up through release 10.1, but
trunk GCC (release 11, and perhaps future 10.x) has fixed it
(see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96238).

Reviewed By: phosek

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

3 years agoRevert "[BranchProbabilityInfo] Use SmallVector (NFC)"
Kazu Hirata [Wed, 11 Nov 2020 03:17:13 +0000 (19:17 -0800)]
Revert "[BranchProbabilityInfo] Use SmallVector (NFC)"

This reverts commit 2f1038c7b699e959e0521638e2e2818a849fe19c.

3 years ago[CodeGen][X86] Remove unused check-prefixes from mask tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 03:07:05 +0000 (11:07 +0800)]
[CodeGen][X86] Remove unused check-prefixes from mask tests. NFCI.

3 years ago[NFC] Use [MC]Register in TwoAddressInstructionPass
Gaurav Jain [Wed, 4 Nov 2020 14:51:00 +0000 (06:51 -0800)]
[NFC] Use [MC]Register in TwoAddressInstructionPass

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

3 years agoFix the data layout mangling specification for 'arm64-pc-win32-macho'
Akira Hatanaka [Wed, 11 Nov 2020 02:36:10 +0000 (18:36 -0800)]
Fix the data layout mangling specification for 'arm64-pc-win32-macho'

rdar://problem/70410504

3 years agoNFC - use script to update testcases and add new testcases.
Chen Zheng [Tue, 10 Nov 2020 14:46:43 +0000 (09:46 -0500)]
NFC - use script to update testcases and add new testcases.

3 years ago[libc++] Change requirements on linear_congruential_engine.
zoecarver [Wed, 11 Nov 2020 02:23:22 +0000 (18:23 -0800)]
[libc++] Change requirements on linear_congruential_engine.

This patch changes how linear_congruential_engine picks its randomization
algorithm. It adds two restrictions, `_OverflowOK` and `_SchrageOK`.
`_OverflowOK` means that m is a power of two so using the classic
`(a * x + c) % m` will create a meaningless overflow. The second checks
that Schrage's algorithm will produce results that are in bounds of min
and max. This patch fixes https://llvm.org/PR27839.

Differential Revision: D65041

3 years ago[EarlyCSE] delete abs/nabs handling
Chen Zheng [Tue, 10 Nov 2020 02:24:36 +0000 (21:24 -0500)]
[EarlyCSE] delete abs/nabs handling

delete abs/nabs handling in earlycse pass to avoid bugs related to
hashing values. After abs/nabs is canonicalized to intrinsics in D87188,
we should get CSE ability for abs/nabs back.

Reviewed By: spatel

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

3 years ago[lld][WebAssembly] Allow references to __tls_base without shared memory
Sam Clegg [Tue, 10 Nov 2020 01:52:39 +0000 (17:52 -0800)]
[lld][WebAssembly] Allow references to __tls_base without shared memory

Previously we limited the use of atomics and TLS to programs
linked with `--shared-memory`.

However, as of https://reviews.llvm.org/D79530 we now allow
programs that use atomic to be linked without `--shared-memory`.
For this to be useful we also want to all TLS usage in such
programs.  In this case, since we know we are single threaded
we simply include the TLS data as a regular active segment
and create an immutable `__tls_base` global that point to the
start of this segment.

Fixes: https://github.com/emscripten-core/emscripten/issues/12489

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

3 years ago[hwasan] Fix Thread reuse.
Evgenii Stepanov [Tue, 10 Nov 2020 22:15:47 +0000 (14:15 -0800)]
[hwasan] Fix Thread reuse.

HwasanThreadList::DontNeedThread clobbers Thread::next_, breaking the
freelist. As a result, only the top of the freelist ever gets reused,
and the rest of it is lost.

Since the Thread object its associated ring buffer is only 8Kb, this is
typically only noticable in long running processes, such as fuzzers.

Fix the problem by switching from an intrusive linked list to a vector.

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

3 years ago[CodeGen][X86] Remove unused check-prefixes from bitcast tests. NFCI.
Wang, Pengfei [Wed, 11 Nov 2020 01:11:28 +0000 (09:11 +0800)]
[CodeGen][X86] Remove unused check-prefixes from bitcast tests. NFCI.

3 years ago[test] Delete redundant lldbutil import, NFC
Vedant Kumar [Wed, 11 Nov 2020 00:37:22 +0000 (16:37 -0800)]
[test] Delete redundant lldbutil import, NFC

3 years ago[ThreadPlan] Add a test for `thread step-in -r`, NFC
Vedant Kumar [Wed, 11 Nov 2020 00:01:16 +0000 (16:01 -0800)]
[ThreadPlan] Add a test for `thread step-in -r`, NFC

Adds test coverage for ThreadPlanStepInRange::SetAvoidRegexp.

See:
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Target/ThreadPlanStepInRange.cpp.html#L309

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

3 years ago[flang] Fix CheckSpecificationExpr handling of associated names
peter klausler [Tue, 10 Nov 2020 22:53:01 +0000 (14:53 -0800)]
[flang] Fix CheckSpecificationExpr handling of associated names

Avoid a spurious error message about a dummy procedure reference
in a specification expression by restructuring the handling of
use-associated and host-associated symbols.

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

3 years ago[ThreadPlan] Delete unused ThreadPlanStepInRange code, NFC
Vedant Kumar [Tue, 10 Nov 2020 23:22:29 +0000 (15:22 -0800)]
[ThreadPlan] Delete unused ThreadPlanStepInRange code, NFC

3 years ago[ThreadPlan] Reflow docs to fit the 80 column limit, NFC
Vedant Kumar [Tue, 10 Nov 2020 23:24:07 +0000 (15:24 -0800)]
[ThreadPlan] Reflow docs to fit the 80 column limit, NFC

3 years ago[Command] Fix accidental word concatenation in Options.td
Vedant Kumar [Tue, 10 Nov 2020 23:17:17 +0000 (15:17 -0800)]
[Command] Fix accidental word concatenation in Options.td

Split up words that appear to have been accidentally concatenated.

This looks to be exhaustive: to find these in vim, use:

/\v[^ ]"\n +"[^ ]

3 years agohwasan: Bring back operator {new,delete} interceptors on Android.
Peter Collingbourne [Tue, 10 Nov 2020 23:50:04 +0000 (15:50 -0800)]
hwasan: Bring back operator {new,delete} interceptors on Android.

It turns out that we can't remove the operator new and delete
interceptors on Android without breaking ABI, so bring them back
as forwards to the malloc and free functions.

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

3 years ago[ORC] Add debugging output for ResourceTracker to be used in JITDylib::define.
Lang Hames [Tue, 10 Nov 2020 01:38:41 +0000 (12:38 +1100)]
[ORC] Add debugging output for ResourceTracker to be used in JITDylib::define.

3 years agoProperly collect template arguments from a class-scope function template
Richard Smith [Tue, 10 Nov 2020 23:52:36 +0000 (15:52 -0800)]
Properly collect template arguments from a class-scope function template
specialization.

Fixes a crash-on-valid if further template parameters are introduced
within the specialization (by a generic lambda).

3 years agogn build: (manually) Port ae032e27 and 21f83113.
Peter Collingbourne [Tue, 10 Nov 2020 23:46:21 +0000 (15:46 -0800)]
gn build: (manually) Port ae032e27 and 21f83113.

__register_frame and __deregister_frame are associated with the
.eh_frame section, which I think is used on all of our platforms
except Windows and 32-bit ARM (which uses the ARM EHABI).

Also add a file that was added to lld/MachO.

3 years ago[NFC] Use [MC]Register for x86 target
Gaurav Jain [Thu, 5 Nov 2020 03:14:59 +0000 (19:14 -0800)]
[NFC] Use [MC]Register for x86 target

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

3 years ago[libc] Add implementations of fdim[f|l].
Tue Ly [Thu, 5 Nov 2020 19:55:46 +0000 (14:55 -0500)]
[libc] Add implementations of fdim[f|l].

Implementing fdim, fdimf, and fdiml for llvm-libc.

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

3 years agoAdd utility for testing if we're matching nodes AsIs
Stephen Kelly [Mon, 9 Nov 2020 19:56:48 +0000 (19:56 +0000)]
Add utility for testing if we're matching nodes AsIs

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

3 years ago[VE] Implement FoldImmediate
Kazushi (Jam) Marukawa [Tue, 3 Nov 2020 13:08:57 +0000 (22:08 +0900)]
[VE] Implement FoldImmediate

Implement FoldImmediate for only integer aritihmetic operations.
Add regression tests also.

Reviewed By: simoll

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

3 years agoRevert "[VPlan] Use VPValue def for VPWidenSelectRecipe."
Florian Hahn [Tue, 10 Nov 2020 22:50:46 +0000 (22:50 +0000)]
Revert "[VPlan] Use VPValue def for VPWidenSelectRecipe."

This reverts commit a8e50f1c6e7b404aab8fedb972f003a4d6a6434e.

This reportedly breaks building the Linux kernel.
  https://bugs.llvm.org/show_bug.cgi?id=48142

3 years agoAdd PrintingPolicy overload to APValue::printPretty. NFC.
Richard Smith [Tue, 10 Nov 2020 21:30:33 +0000 (13:30 -0800)]
Add PrintingPolicy overload to APValue::printPretty. NFC.

3 years agoRevert "Add utility for testing if we're matching nodes AsIs"
Stephen Kelly [Tue, 10 Nov 2020 22:29:23 +0000 (22:29 +0000)]
Revert "Add utility for testing if we're matching nodes AsIs"

This reverts commit e73296d3b92fc231f3f913815e477d55b66595bd.

This may have caused build bot failure.

3 years ago[llvm-cov] Add a test for c75a0a1e
Zequan Wu [Tue, 10 Nov 2020 22:25:25 +0000 (14:25 -0800)]
[llvm-cov] Add a test for c75a0a1e

3 years ago[CodeGen] Mark calls to objc_autorelease as tail
Akira Hatanaka [Tue, 10 Nov 2020 21:46:53 +0000 (13:46 -0800)]
[CodeGen] Mark calls to objc_autorelease as tail

This enables a method sending an autorelease message to an object and
returning the object in MRR to avoid adding the object to an autorelease
pool if a call to objc_retainAutoreleasedReturnValue in the caller
function accepts the hand off of the retain count.

rdar://problem/50678052

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

3 years ago[mlir] Add pass to convert elementwise ops to linalg.
Sean Silva [Wed, 28 Oct 2020 20:25:48 +0000 (13:25 -0700)]
[mlir] Add pass to convert elementwise ops to linalg.

This patch converts elementwise ops on tensors to linalg.generic ops
with the same elementwise op in the payload (except rewritten to
operate on scalars, obviously). This is a great form for later fusion to
clean up.

E.g.

```
// Compute: %arg0 + %arg1 - %arg2
func @f(%arg0: tensor<?xf32>, %arg1: tensor<?xf32>, %arg2: tensor<?xf32>) -> tensor<?xf32> {
  %0 = addf %arg0, %arg1 : tensor<?xf32>
  %1 = subf %0, %arg2 : tensor<?xf32>
  return %1 : tensor<?xf32>
}
```

Running this through
`mlir-opt -convert-std-to-linalg -linalg-fusion-for-tensor-ops` we get:

```
func @f(%arg0: tensor<?xf32>, %arg1: tensor<?xf32>, %arg2: tensor<?xf32>) -> tensor<?xf32> {
  %0 = linalg.generic {indexing_maps = [#map0, #map0, #map0, #map0], iterator_types = ["parallel"]} ins(%arg0, %arg1, %arg2 : tensor<?xf32>, tensor<?xf32>, tensor<?xf32>) {
  ^bb0(%arg3: f32, %arg4: f32, %arg5: f32):  // no predecessors
    %1 = addf %arg3, %arg4 : f32
    %2 = subf %1, %arg5 : f32
    linalg.yield %2 : f32
  } -> tensor<?xf32>
  return %0 : tensor<?xf32>
}
```

So the elementwise ops on tensors have nicely collapsed into a single
linalg.generic, which is the form we want for further transformations.

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

3 years ago[mlir] Add ElementwiseMappable trait and apply it to std elementwise ops.
Sean Silva [Wed, 4 Nov 2020 02:17:55 +0000 (18:17 -0800)]
[mlir] Add ElementwiseMappable trait and apply it to std elementwise ops.

This patch adds an `ElementwiseMappable` trait as discussed in the RFC
here:
https://llvm.discourse.group/t/rfc-std-elementwise-ops-on-tensors/2113/23

This trait can power a number of transformations and analyses.
A subsequent patch adds a convert-elementwise-to-linalg pass exhibits
how this trait allows writing generic transformations.
See https://reviews.llvm.org/D90354 for that patch.

This trait slightly changes some verifier messages, but the diagnostics
are usually about as good. I fiddled with the ordering of the trait in
the .td file trait lists to minimize the changes here.

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

3 years ago[ARM] Fix PR 47980: Use constrainRegClass during foldImmediate opt.
Pirama Arumuga Nainar [Tue, 10 Nov 2020 19:15:16 +0000 (11:15 -0800)]
[ARM] Fix PR 47980: Use constrainRegClass during foldImmediate opt.

Previously we used setRegClass to rgpr, which may expand the register
domain if the result was already in a constrained class (tcgpr in the
above PR).

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

3 years ago[Polly][ScopBuilder] Use only modeled instructions to compute statement granularity.
Michael Kruse [Tue, 10 Nov 2020 08:37:35 +0000 (02:37 -0600)]
[Polly][ScopBuilder] Use only modeled instructions to compute statement granularity.

ScopBuilder distributes independent instructions between statements.
Only modeled (e.g. not synthesizable) instructions are represented.
To compute independence, non-modeled instructions were used in some
parts of determining instruction independence, which could lead to the
re-introduction of non-model instructions.

In particular, required invariant loads could be added to instruction
list, which then led to redundant MemoryAccesses for such a load.

This fixes llvm.org/PR48059.

3 years ago[Coroutine][Sema] Cleanup temporaries as early as possible
Xun Li [Tue, 10 Nov 2020 21:02:18 +0000 (13:02 -0800)]
[Coroutine][Sema] Cleanup temporaries as early as possible

The original bug was discovered in T75057860. Clang front-end emits an AST that looks like this for an co_await expression:
|- ExprWithCleanups
  |- -CoawaitExpr
    |- -MaterializeTemporaryExpr ... Awaiter
      ...
    |- -CXXMemberCallExpr ... .await_ready
      ...
    |- -CallExpr ... __builtin_coro_resume
      ...
    |- -CXXMemberCallExpr ... .await_resume
      ...

ExprWithCleanups is responsible for cleaning up (including calling dtors) for the temporaries generated in the wrapping expression).
In the above structure, the __builtin_coro_resume part (which corresponds to the code for the suspend case in the co_await with symmetric transfer), the pseudocode looks like this:
  __builtin_coro_resume(
   awaiter.await_suspend(
     from_address(
       __builtin_coro_frame())).address());

One of the temporaries that's generated as part of this code is the coroutine handle returned from awaiter.await_suspend() call. The call returns a handle  which is a prvalue (since it's a returned value on the fly). In order to call the address() method on it, it needs to be converted into an xvalue. Hence a materialized temp is created to hold it. This temp will need to be cleaned up eventually. Now, since all cleanups happen at the end of the entire co_await expression, which is after the <coro.suspend> suspension point, the compiler will think that such a temp needs to live across suspensions, and need to be put on the coroutine frame, even though it's only used temporarily just to call address() method.
Such a phenomena not only unnecessarily increases the frame size, but can lead to ASAN failures, if the coroutine was already destroyed as part of the await_suspend() call. This is because if the coroutine was already destroyed, the frame no longer exists, and one can not store anything into it. But if the temporary object is considered to need to live on the frame, it will be stored into the frame after await_suspend() returns.

A fix attempt was done in https://reviews.llvm.org/D87470. Unfortunately it is incorrect. The reason is that cleanups in Clang works more like linearly than nested. There is one current state indicating whether it needs cleanup, and an ExprWithCleanups resets that state. This means that an ExprWithCleanups must be capable of cleaning up all temporaries created  in the wrapping expression, otherwise there will be dangling temporaries cleaned up at the wrong place.
I eventually found a walk-around (https://reviews.llvm.org/D89066) that doesn't break any existing tests while fixing the issue. But it targets the final co_await only. If we ever have a co_await that's not on the final awaiter and the frame gets destroyed after suspend, we are in trouble. Hence we need a proper fix.

This patch is the proper fix. It does the folllowing things to fully resolve the issue:
1. The AST has to be generated in the order according to their nesting relationship. We should not generate AST out of order because then the code generator would incorrectly track the state of temporaries and when a cleanup is needed. So the code in buildCoawaitCalls is reorganized so that we will be generating the AST for each coawait member call in order along with their child AST.
2. await_ready() call is wrapped with an ExprWithCleanups so that temporaries in it gets cleaned up as early as possible to avoid living across suspension.
3. await_suspend() call is wrapped with an ExprWithCleanups if it's not a symmetric transfer. In the case of a symmetric transfer, in order to maintain the musttail call contract, the ExprWithCleanups is wraaped before the resume call.
4. In the end, we mark again that it needs a cleanup, so that the entire CoawaitExpr will be wrapped with a ExprWithCleanups which will clean up the Awaiter object associated with the await expression.

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

3 years ago[OpenMP] Fixes for shared memory cleanup when aborts occur
AndreyChurbanov [Tue, 10 Nov 2020 21:16:23 +0000 (00:16 +0300)]
[OpenMP] Fixes for shared memory cleanup when aborts occur

Patch by Erdner, Todd <todd.erdner@intel.com>

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

3 years ago[AMDGPU] Set default op_sel_hi on accvgpr read/write
Stanislav Mekhanoshin [Tue, 10 Nov 2020 20:12:33 +0000 (12:12 -0800)]
[AMDGPU] Set default op_sel_hi on accvgpr read/write

These are opsel opcodes with op_sel actually being ignored.
As a such op_sel_hi needs to be set to default 1 even though
these bits are ignored. This is compatibility change.

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

3 years agoMove code to determine the type of an LValueBase out of ExprConstant and
Richard Smith [Tue, 10 Nov 2020 20:51:00 +0000 (12:51 -0800)]
Move code to determine the type of an LValueBase out of ExprConstant and
into a member function on LValueBase. NFC.

3 years ago[Coroutines] Add missing llvm.dbg.declare's to cover for more allocas
Bruno Cardoso Lopes [Tue, 10 Nov 2020 19:20:56 +0000 (11:20 -0800)]
[Coroutines] Add missing llvm.dbg.declare's to cover for more allocas

Tracking local variables across suspend points is still somewhat incomplete.
Consider this coroutine snippet:

```
resumable foo() {
  int x[10] = {};
  int a = 3;
  co_await std::experimental::suspend_always();
  a++;
  x[0] = 1;
  a += 2;
  x[1] = 2;
  a += 3;
  x[2] = 3;
}
```

Can't manage to print `a` or `x` if they turn out to be allocas during
CoroSplit (which happens if you build this code with `-O0` prior to this
commit):

```
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x0000000100003729 main-noprint`foo() at main-noprint.cpp:43:5
   40     co_await std::experimental::suspend_always();
   41     a++;
   42     x[0] = 1;
-> 43     a += 2;
   44     x[1] = 2;
   45     a += 3;
   46     x[2] = 3;
(lldb) p x
error: <user expression 21>:1:1: use of undeclared identifier 'x'
x
^
```

The generated IR contains a `llvm.dbg.declare` for `x` in it's initialization
basic block. After CoroSplit, the `llvm.dbg.declare` might not dominate all of
`x` uses and we lose debugging quality.

Add `llvm.dbg.value`s to all relevant basic blocks such that if later
transformations break the dominance the reliable debug info is already in
place. For instance, this BB:

```
await.ready:
  ...
  %arrayidx = getelementptr inbounds [10 x i32], [10 x i32]* %x.reload.addr, i64 0, i64 0, !dbg !760
  ...
  %arrayidx19 = getelementptr inbounds [10 x i32], [10 x i32]* %x.reload.addr, i64 0, i64 1, !dbg !763
  ...
  %arrayidx21 = getelementptr inbounds [10 x i32], [10 x i32]* %x.reload.addr, i64 0, i64 2, !dbg !766
```

becomes:

```
await.ready:
  ...
  call void @llvm.dbg.value(metadata [10 x i32]* %x.reload.addr, metadata !751, metadata !DIExpression()), !dbg !753
  ...
  %arrayidx = getelementptr inbounds [10 x i32], [10 x i32]* %x.reload.addr, i64 0, i64 0, !dbg !760
  ...
  %arrayidx19 = getelementptr inbounds [10 x i32], [10 x i32]* %x.reload.addr, i64 0, i64 1, !dbg !763
  ...
  %arrayidx21 = getelementptr inbounds [10 x i32], [10 x i32]* %x.reload.addr, i64 0, i64 2, !dbg !766
```

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

3 years ago[LoopFlatten] Run it earlier, just before IndVarSimplify
Sjoerd Meijer [Mon, 9 Nov 2020 16:16:54 +0000 (16:16 +0000)]
[LoopFlatten] Run it earlier, just before IndVarSimplify

This is a prep step for widening induction variables in LoopFlatten if this is
posssible (D90640), to avoid having to perform certain overflow checks. Since
IndVarSimplify may already widen induction variables, we want to run
LoopFlatten just before IndVarSimplify. This is a minor reshuffle as both
passes were already close after each other.

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

3 years ago[mlir] Refactor finding python
Marius Brehler [Tue, 10 Nov 2020 17:14:37 +0000 (18:14 +0100)]
[mlir] Refactor finding python

This drops the use of deprecated CMake modules to find python.

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

3 years ago[lld-macho] Add very basic support for LTO
Jez Ng [Tue, 27 Oct 2020 02:18:29 +0000 (19:18 -0700)]
[lld-macho] Add very basic support for LTO

Just enough to consume some bitcode files and link them. There's more
to be done around the symbol resolution API and the LTO config, but I don't yet
understand what all the various LTO settings do...

Reviewed By: #lld-macho, compnerd, smeenai, MaskRay

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

3 years ago[lld-macho][easy] Fix segment max protection
Jez Ng [Wed, 14 Oct 2020 19:46:49 +0000 (12:46 -0700)]
[lld-macho][easy] Fix segment max protection

We should have maxprot == initprot for all non-i386 architectures, which
is what ld64 does.

Reviewed By: #lld-macho, compnerd

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

3 years ago[lld-macho] Implement LC_UUID
Jez Ng [Wed, 14 Oct 2020 18:03:34 +0000 (11:03 -0700)]
[lld-macho] Implement LC_UUID

Apple devtools use this to locate the dSYM files for a given
binary.

The UUID is computed based on an MD5 hash of the binary's contents. In order to
hash the contents, we must first write them, but LC_UUID itself must be part of
the written contents in order for all the offsets to be calculated correctly.
We resolve this circular paradox by first writing an LC_UUID with an all-zero
UUID, then updating the UUID with its real value later.

I'm not sure there's a good way to test that the value of the UUID is
"as expected", so I've just checked that it's present.

Reviewed By: #lld-macho, compnerd, smeenai

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

3 years ago[lld-macho] Support linking against stub dylibs
Jez Ng [Wed, 7 Oct 2020 21:50:42 +0000 (14:50 -0700)]
[lld-macho] Support linking against stub dylibs

Stub dylibs differ from "real" dylibs in that they lack any content in
their sections. What they do have are export tries and symbol tables,
which means we can still link against them. I am unclear how to
properly create these stub dylibs; XCode 11.3's `lipo` is able to create
stub dylibs, but those lack LC_ID_DYLIB load commands and are considered
invalid by most tooling. Newer versions of `lipo` aren't able to create
stub dylibs at all.  However, recent SDKs in XCode still come with valid
stub dylibs, so it still seems worthwhile to support them. The YAML in
this diff's test was generated by taking a non-stub dylib and editing
the appropriate fields.

Reviewed By: #lld-macho, smeenai

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

3 years ago[Sema] Fix volatile check when testing if a return object can be implicitly moved
Yang Fan [Tue, 10 Nov 2020 20:09:06 +0000 (15:09 -0500)]
[Sema] Fix volatile check when testing if a return object can be implicitly moved

In C++11 standard, to become implicitly movable, the expression in return
statement should be a non-volatile automatic object. CWG1579 changed the rule
to require that the expression only needs to be an automatic object. C++14
standard and C++17 standard kept this rule unchanged. C++20 standard changed
the rule back to require the expression be a non-volatile automatic object.
This should be a typo in standards, and VD should be non-volatile.

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

3 years agoAdd Python binding to run a PassManager on a MLIR Module
Mehdi Amini [Tue, 10 Nov 2020 19:56:48 +0000 (19:56 +0000)]
Add Python binding to run a PassManager on a MLIR Module

Reviewed By: ftynse, stellaraccident

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

3 years ago[LoopFlatten] Make it a FunctionPass
Sjoerd Meijer [Mon, 9 Nov 2020 15:59:50 +0000 (15:59 +0000)]
[LoopFlatten] Make it a FunctionPass

This converts LoopFlatten from a LoopPass to a FunctionPass so that we don't
run into problems of a loop pass deleting a (inner)loop.

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

3 years agoAdd basic Python bindings for the PassManager and bind libTransforms
Mehdi Amini [Tue, 10 Nov 2020 18:39:12 +0000 (18:39 +0000)]
Add basic Python bindings for the PassManager and bind libTransforms

This only exposes the ability to round-trip a textual pipeline at the
moment.
To exercise it, we also bind the libTransforms in a new Python extension. This
does not include any interesting bindings, but it includes all the
mechanism to add separate native extensions and load them dynamically.
As such passes in libTransforms are only registered after `import
mlir.transforms`.
To support this global registration, the TableGen backend is also
extended to bind to the C API the group registration for passes.

Reviewed By: stellaraccident

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

3 years ago[docs] link new support policy from developer policy
Renato Golin [Sat, 7 Nov 2020 21:14:16 +0000 (21:14 +0000)]
[docs] link new support policy from developer policy

Adding new paragraphs under "Introducing New Components" section to
check the different levels of support we have, to help introduction of
smaller set of changes without overwhelming new collaborators and
potentially losing the contribution.

Differential Revision: D91013

3 years ago[VPlan] Use VPValue def for VPWidenSelectRecipe.
Florian Hahn [Tue, 10 Nov 2020 18:58:03 +0000 (18:58 +0000)]
[VPlan] Use VPValue def for VPWidenSelectRecipe.

This patch turns VPWidenSelectRecipe into a VPValue and uses it
during VPlan construction and codegeneration instead of the plain IR
reference where possible.

Reviewed By: dmgreen

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

3 years ago[lld][WebAssembly] Convert TLS tests to asm format
Sam Clegg [Mon, 9 Nov 2020 23:59:58 +0000 (15:59 -0800)]
[lld][WebAssembly] Convert TLS tests to asm format

Fix a corresponding bug in WasmAsmParser around parsing.tdata sections.

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

3 years ago[ARM] Silence unused variable warning in Release builds. NFC.
Benjamin Kramer [Tue, 10 Nov 2020 19:34:37 +0000 (20:34 +0100)]
[ARM] Silence unused variable warning in Release builds. NFC.

3 years ago[RISCV] Add missing copyright header to RISCVBaseInfo.cpp. NFC
Craig Topper [Tue, 10 Nov 2020 19:32:52 +0000 (11:32 -0800)]
[RISCV] Add missing copyright header to RISCVBaseInfo.cpp. NFC

3 years agoAdd utility for testing if we're matching nodes AsIs
Stephen Kelly [Mon, 9 Nov 2020 19:56:48 +0000 (19:56 +0000)]
Add utility for testing if we're matching nodes AsIs

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

3 years agoFix the DeclContextLookupResult::iterator non-copyable.
Haojian Wu [Tue, 10 Nov 2020 19:09:56 +0000 (20:09 +0100)]
Fix the DeclContextLookupResult::iterator non-copyable.

The value_type is a const pointer, which makes the iteator non-copyable.
Before the patch, the normal usage like below was illegal:

```
auto It = lookupresult.begin();
...
It = lookupresult.end(); // the copy is not allowed.
```

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

3 years ago[lldb] [Process/NetBSD] Copy the recent improvements from FreeBSD
Michał Górny [Tue, 10 Nov 2020 13:09:26 +0000 (14:09 +0100)]
[lldb] [Process/NetBSD] Copy the recent improvements from FreeBSD

Copy the recent improvements from the FreeBSDRemote plugin, notably:

- moving event reporting setup into SetupTrace() helper

- adding more debug info into SIGTRAP handling

- handling user-generated (and unknown) SIGTRAP events

- adding missing error handling to the generic signal handler

- fixing attaching to processes

- switching watchpoint helpers to use llvm::Error

- minor style and formatting changes

This fixes a number of tests, mostly related to fixed attaching.

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

3 years agoAllow searching for prebuilt implicit modules.
Alexandre Rames [Tue, 10 Nov 2020 17:21:05 +0000 (09:21 -0800)]
Allow searching for prebuilt implicit modules.

This reverts commit c67656b994c87224e0b33e2c4b09093986a5cfa6, and addresses the
build issue.

3 years ago[CMake][ExecutionEngine] add HAVE_(DE)REGISTER_FRAME as a config.h macros
David Tenty [Tue, 10 Nov 2020 17:03:30 +0000 (12:03 -0500)]
[CMake][ExecutionEngine] add HAVE_(DE)REGISTER_FRAME  as a config.h macros

The macro HAVE_EHTABLE_SUPPORT is used by parts of ExecutionEngine to tell __register_frame/__deregister_frame is available to register the
FDE for a generated (JIT) code. It's currently set by a slowly growing set of macro tests in the respective headers, which is updated now and then when it fails to link on some platform or another due to the symbols being missing (see for example https://bugs.llvm.org/show_bug.cgi?id=5715).

This change converts the macro in two HAVE_(DE)REGISTER_FRAME config.h macros (like most of the other HAVE_* macros) and set's them based on whether CMake can actually find a definition for these symbols to link to at configuration time.

Reviewed By: hubert.reinterpretcast

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

3 years ago[ARM] Introduce t2DoLoopStartTP
David Green [Tue, 10 Nov 2020 18:08:12 +0000 (18:08 +0000)]
[ARM] Introduce t2DoLoopStartTP

This introduces a new pseudo instruction, almost identical to a
t2DoLoopStart but taking 2 parameters - the original loop iteration
count needed for a low overhead loop, plus the VCTP element count needed
for a DLSTP instruction setting up a tail predicated loop. The idea is
that the instruction holds both values and the backend
ARMLowOverheadLoops pass can pick between the two, depending on whether
it creates a tail predicated loop or falls back to a low overhead loop.

To do that there needs to be something that converts a t2DoLoopStart to
a t2DoLoopStartTP, for which this patch repurposes the
MVEVPTOptimisationsPass as a "tail predication and vpt optimisation"
pass. The extra operand for the t2DoLoopStartTP is chosen based on the
operands of VCTP's in the loop, and the instruction is moved as late in
the block as possible to attempt to increase the likelihood of making
tail predicated loops.

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

3 years ago[libc++] NFC: Add helper methods to simplify __shared_ptr_emplace
Louis Dionne [Tue, 10 Nov 2020 17:47:10 +0000 (12:47 -0500)]
[libc++] NFC: Add helper methods to simplify __shared_ptr_emplace

The previous implementation was really difficult to follow, especially
with the get() method sharing the same name as std::unique_ptr::get().

3 years ago[lldb][NFC] Add lldb-server to the shell tests disallow list
Raphael Isemann [Tue, 10 Nov 2020 16:53:36 +0000 (17:53 +0100)]
[lldb][NFC] Add lldb-server to the shell tests disallow list

This prevents that one can write a test that referenced lldb-server (instead
of %lldb-server). Addresses review feedback from D91155.

3 years agoMake inferLibFuncAttributes() add SExt attribute on second arg to ldexp.
Jonas Paulsson [Wed, 4 Nov 2020 12:49:24 +0000 (13:49 +0100)]
Make inferLibFuncAttributes() add SExt attribute on second arg to ldexp.

This was missing as discovered by the SystemZ multistage bot:
http://lab.llvm.org:8011/#/builders/8, where wrong code resulted when this
extension was not performed.

Thanks for review by Ulrich Weigand and Roman Lebedev.

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

3 years ago[AMDGPU] Simplify multiclass EXP_m. NFC.
Jay Foad [Tue, 10 Nov 2020 17:23:15 +0000 (17:23 +0000)]
[AMDGPU] Simplify multiclass EXP_m. NFC.

3 years ago[ARM] Cleanup for ARMLowOverheadLoops. NFC
David Green [Tue, 10 Nov 2020 17:28:07 +0000 (17:28 +0000)]
[ARM] Cleanup for ARMLowOverheadLoops. NFC

3 years ago[Flang][OpenMP] Fix 'Internal: no symbol found' for OpenMP aligned and linear clause.
sameeran joshi [Sat, 31 Oct 2020 18:13:58 +0000 (23:43 +0530)]
[Flang][OpenMP] Fix 'Internal: no symbol found' for OpenMP aligned and linear clause.

The initial approach was to go with changing parser nodes from `std::list<parser::Name>` to `OmpObjectList`, but that might have lead to illegal programs.
Resolving the symbols inside `OmpAttributeVisitor`.
Fix a couple of `XFAIL` tests.

Reviewed By: kiranchandramohan

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

3 years ago[ValueTracking] computeKnownBitsFromShiftOperator - always return with Known2 contain...
Simon Pilgrim [Tue, 10 Nov 2020 16:53:06 +0000 (16:53 +0000)]
[ValueTracking] computeKnownBitsFromShiftOperator - always return with Known2 containing the shifted value source. NFCI.

As detailed on D90479, in most circumstances we will always call computeKnownBits for Op0, so always perform this by pulling out the duplicate calls.

3 years ago[ValueTracking] computeKnownBitsFromShiftOperator - consistently use Known2 for the...
Simon Pilgrim [Tue, 10 Nov 2020 16:33:41 +0000 (16:33 +0000)]
[ValueTracking] computeKnownBitsFromShiftOperator - consistently use Known2 for the shifted value. NFCI.

Minor cleanup as part of getting D90479 moving again.

3 years ago[ARM] Don't aggressively unroll vector remainder loops
David Green [Tue, 10 Nov 2020 17:01:31 +0000 (17:01 +0000)]
[ARM] Don't aggressively unroll vector remainder loops

We already do not unroll loops with vector instructions under MVE, but
that does not include the remainder loops that the vectorizer produces.
These remainder loops will be rarely executed and are not worth
unrolling, as the trip count is likely to be low if they get executed at
all. Luckily they get llvm.loop.isvectorized to make recognizing them
simpler.

We have wanted to do this for a while but hit issues with low overhead
loops being reverted due to difficult registry allocation. With recent
changes that seems to be less of an issue now.

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

3 years ago[BranchProbabilityInfo] Use a range-based for loop (NFC)
Kazu Hirata [Tue, 10 Nov 2020 17:00:17 +0000 (09:00 -0800)]
[BranchProbabilityInfo] Use a range-based for loop (NFC)

3 years ago[Flang][Docs] Fix warnings when building docs.
sameeran joshi [Tue, 10 Nov 2020 04:28:01 +0000 (09:58 +0530)]
[Flang][Docs] Fix warnings when building docs.

Following warning were seen with recommonmark(0.5.0) and sphinx(1.8.5).
`parser.py:75: UserWarning: Container node skipped: type=document warn("Container node skipped: type={0}".format(mdnode.t))`

The warnings are due to an issue in recommonmark's(a python package) older versions.
A better solution is to use the latest version of recommonmark(>=0.6.0) to avoid
these issue in the first place.
This patch fixes the warnings for older versions.

Reviewed By: jdoerfert

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

3 years ago[AMDGPU] Remove unused check prefixes
Jay Foad [Tue, 10 Nov 2020 16:49:10 +0000 (16:49 +0000)]
[AMDGPU] Remove unused check prefixes

3 years ago[Sphinx] Fix langref formatting. NFC
David Green [Tue, 10 Nov 2020 16:47:43 +0000 (16:47 +0000)]
[Sphinx] Fix langref formatting. NFC

3 years ago[ARM] Add a RegAllocHint for hinting t2DoLoopStart towards LR
David Green [Tue, 10 Nov 2020 16:28:57 +0000 (16:28 +0000)]
[ARM] Add a RegAllocHint for hinting t2DoLoopStart towards LR

This hints the operand of a t2DoLoopStart towards using LR, which can
help make it more likely to become t2DLS lr, lr. This makes it easier to
move if needed (as the input is the same as the output), or potentially
remove entirely.

The hint is added after others (from COPY's etc) which still take
precedence. It needed to find a place to add the hint, which currently
uses the post isel custom inserter.

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

3 years agoRevert "The arm64 triple requires AArch64 not ARM target"
Paul Robinson [Tue, 10 Nov 2020 16:25:46 +0000 (08:25 -0800)]
Revert "The arm64 triple requires AArch64 not ARM target"

This reverts commit e7256825d57305045ae6fe1d44892a15a968314c.
apparently it's not that simple.
https://lab.llvm.org:8011/#/builders/109/2412

3 years ago[lldb] Propagate llvm::Error to report_fatal_error
Jonas Devlieghere [Tue, 10 Nov 2020 16:12:41 +0000 (08:12 -0800)]
[lldb] Propagate llvm::Error to report_fatal_error

Instead of having a custom error message, propagate the llvm::Error from
SystemInitializerCommon. I didn't realize we had this overload until
Pavel mentioned it in D90987 today.

3 years agoThe arm64 triple requires AArch64 not ARM target
Paul Robinson [Tue, 10 Nov 2020 16:18:19 +0000 (08:18 -0800)]
The arm64 triple requires AArch64 not ARM target

Failure seen if you configure ARM target but not AArch64, as here:
http://lab.llvm.org:8011/#/builders/59/builds/271

3 years ago[ARM] Alter t2DoLoopStart to define lr
David Green [Tue, 10 Nov 2020 15:57:58 +0000 (15:57 +0000)]
[ARM] Alter t2DoLoopStart to define lr

This changes the definition of t2DoLoopStart from
t2DoLoopStart rGPR
to
GPRlr = t2DoLoopStart rGPR

This will hopefully mean that low overhead loops are more tied together,
and we can more reliably generate loops without reverting or being at
the whims of the register allocator.

This is a fairly simple change in itself, but leads to a number of other
required alterations.

 - The hardware loop pass, if UsePhi is set, now generates loops of the
   form:
       %start = llvm.start.loop.iterations(%N)
     loop:
       %p = phi [%start], [%dec]
       %dec = llvm.loop.decrement.reg(%p, 1)
       %c = icmp ne %dec, 0
       br %c, loop, exit
 - For this a new llvm.start.loop.iterations intrinsic was added, identical
   to llvm.set.loop.iterations but produces a value as seen above, gluing
   the loop together more through def-use chains.
 - This new instrinsic conceptually produces the same output as input,
   which is taught to SCEV so that the checks in MVETailPredication are not
   affected.
 - Some minor changes are needed to the ARMLowOverheadLoop pass, but it has
   been left mostly as before. We should now more reliably be able to tell
   that the t2DoLoopStart is correct without having to prove it, but
   t2WhileLoopStart and tail-predicated loops will remain the same.
 - And all the tests have been updated. There are a lot of them!

This patch on it's own might cause more trouble that it helps, with more
tail-predicated loops being reverted, but some additional patches can
hopefully improve upon that to get to something that is better overall.

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

3 years agoFix PR47973: Addressing integer division edge case with INT_MIN
Ayshe Kuran [Tue, 10 Nov 2020 14:15:32 +0000 (14:15 +0000)]
Fix PR47973: Addressing integer division edge case with INT_MIN

Adjustment to integer division in int_div_impl.inc to avoid undefined behaviour that can occur as a result of having INT_MIN as one of the parameters.

Reviewed By: sepavloff

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

3 years agoRevert "[libomptarget] Add support for target update non-contiguous"
Alexey Bataev [Tue, 10 Nov 2020 15:38:10 +0000 (07:38 -0800)]
Revert "[libomptarget] Add support for target update non-contiguous"

This reverts commit 6847bcec1aa9e262e2b175926d94a12fc1174c6d. It breaks
the build of libomptarget.

3 years ago[X86] Remove unused check-prefixes from vector rotate tests
Simon Pilgrim [Tue, 10 Nov 2020 15:45:09 +0000 (15:45 +0000)]
[X86] Remove unused check-prefixes from vector rotate tests

3 years ago[X86] Remove unused check-prefixes from vector trunc tests
Simon Pilgrim [Tue, 10 Nov 2020 15:39:55 +0000 (15:39 +0000)]
[X86] Remove unused check-prefixes from vector trunc tests

3 years ago[X86] Remove unused check-prefixes from vector funnel shift tests
Simon Pilgrim [Tue, 10 Nov 2020 15:30:34 +0000 (15:30 +0000)]
[X86] Remove unused check-prefixes from vector funnel shift tests

3 years ago[MLIR][SPIRVToLLVM] Enhanced conversion for execution mode
George Mitenkov [Tue, 10 Nov 2020 14:57:49 +0000 (17:57 +0300)]
[MLIR][SPIRVToLLVM] Enhanced conversion for execution mode

This patch introduces a new conversion pattern for `spv.ExecutionMode`.
`spv.ExecutionMode` may contain important information about the entry
point, which we want to preserve. For example, `LocalSize` provides
information about the work-group size that can be reused. Hence, the
pattern for entry-point ops changes to the following:
- `spv.EntryPoint` is still simply removed
- Info from `spv.ExecutionMode` is used to create a global struct variable,
  which looks like:

  ```
  struct {
    int32_t executionMode;
    int32_t values[];          // optional values
  };
  ```

Reviewed By: mravishankar

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

3 years ago[lldb/DWARF] Fix sizes of DW_OP_const[1248][us] and DW_OP_litN results
Pavel Labath [Thu, 5 Nov 2020 09:28:31 +0000 (10:28 +0100)]
[lldb/DWARF] Fix sizes of DW_OP_const[1248][us] and DW_OP_litN results

Dwarf says (Section 2.5.1.1. of DWARF v5) that these operations should
push "generic" (pointer-sized) values. This was not the case for
DW_OP_const operations (which were pushing values based on the size of
arguments), nor DW_OP_litN (which were always pushing 64-bit values).

The practical effect of this that were were unable to display the values
of variables if the size of the DW_OP_const opcode was smaller than the
value of the variable it was describing. This would happen because we
would store this (small) result into a buffer and then would not be able
to read sufficient data out of it (in Value::GetValueAsData). Gcc emits
debug info like this.

Other (more subtle) effects are also possible.

The same fix should be applied to DW_OP_const[us] (leb128 versions), but
I'm not doing that right now, because that would cause us to display
wrong (truncated) values of variables on 32-bit targets (pr48087).

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

3 years ago[SystemZ][z/OS] Enable POSIX_l functions for z/OS
Muiez Ahmed [Tue, 10 Nov 2020 14:54:03 +0000 (09:54 -0500)]
[SystemZ][z/OS] Enable POSIX_l functions for z/OS

The aim of this patch is to enable POSIX _l functions for z/OS. In particular, the functions are provided with libc++ and this patch resorts to the fallback functions. Nonetheless, the functions are being added so the implementation of the ctype<> member functions can call them. The following changes were needed to allow for a successful build when using the libc++ library for z/OS.

Reviewed By: #libc, ldionne

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

3 years ago[lldb] Reinstate TestGdbserverPort.test
Raphael Isemann [Tue, 10 Nov 2020 14:45:35 +0000 (15:45 +0100)]
[lldb] Reinstate TestGdbserverPort.test

This test was deleted by accident in the great lldb-mi removal:
37fed664022e07c2293b674e9c9d2b50aac547ba

3 years ago[ValueTacking] assume-queries-counter.ll - remove unused check prefix
Simon Pilgrim [Tue, 10 Nov 2020 14:24:00 +0000 (14:24 +0000)]
[ValueTacking] assume-queries-counter.ll - remove unused check prefix