platform/upstream/llvm.git
2 years ago[mlir][capi] Add NameLoc
Jacques Pienaar [Wed, 1 Sep 2021 23:16:35 +0000 (16:16 -0700)]
[mlir][capi] Add NameLoc

Add method to get NameLoc. Treat null child location as unknown to avoid
needing to create UnknownLoc in C API where child loc is not needed.

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

2 years ago[AMDGPU] Use S_BITCMP1_* to replace AND in optimizeCompareInstr
Stanislav Mekhanoshin [Wed, 1 Sep 2021 18:40:53 +0000 (11:40 -0700)]
[AMDGPU] Use S_BITCMP1_* to replace AND in optimizeCompareInstr

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

2 years ago[AMDGPU] Introduce optimizeCompareInstr
Stanislav Mekhanoshin [Tue, 31 Aug 2021 22:10:59 +0000 (15:10 -0700)]
[AMDGPU] Introduce optimizeCompareInstr

The following patterns are currently handled:

s_cmp_eq_u32 (s_and_b32 $src, 1), 1 => s_and_b32 $src, 1
s_cmp_eq_i32 (s_and_b32 $src, 1), 1 => s_and_b32 $src, 1
s_cmp_eq_u64 (s_and_b64 $src, 1), 1 => s_and_b64 $src, 1
s_cmp_ge_u32 (s_and_b32 $src, 1), 1 => s_and_b32 $src, 1
s_cmp_ge_i32 (s_and_b32 $src, 1), 1 => s_and_b32 $src, 1
s_cmp_lg_u32 (s_and_b32 $src, 1), 0 => s_and_b32 $src, 1
s_cmp_lg_i32 (s_and_b32 $src, 1), 0 => s_and_b32 $src, 1
s_cmp_lg_u64 (s_and_b64 $src, 1), 0 => s_and_b64 $src, 1
s_cmp_gt_u32 (s_and_b32 $src, 1), 0 => s_and_b32 $src, 1
s_cmp_gt_i32 (s_and_b32 $src, 1), 0 => s_and_b32 $src, 1

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

2 years ago[MemorySSAUpdater] Simplify updates when only deleting edges.
Alina Sbirlea [Wed, 1 Sep 2021 21:38:53 +0000 (14:38 -0700)]
[MemorySSAUpdater] Simplify updates when only deleting edges.

When performing only edge deletion, we don't need to do the DT updates
back and forth. Check for the existance of insert updates to simplify
this.

2 years ago[OpenMP][AMDGPU] Remove unneeded XFAILs
Joel E. Denny [Wed, 1 Sep 2021 21:59:40 +0000 (17:59 -0400)]
[OpenMP][AMDGPU] Remove unneeded XFAILs

2 years ago[Codegen][TLI][X86] SimplifyMultipleUseDemandedBits(): 0'th vec subreg widening is...
Roman Lebedev [Wed, 1 Sep 2021 21:42:09 +0000 (00:42 +0300)]
[Codegen][TLI][X86] SimplifyMultipleUseDemandedBits(): 0'th vec subreg widening is free, try to perform it earlier

I believe, the profitability reasoning here is correct
"sub"reg is already located within the 0'th subreg of wider reg,
so if we have suvector insertion at index 0 into undef,
then it's always free do to.

After this, D109065 finally avoids the regression in D108382.

Reviewed By: RKSimon

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

2 years ago[InstrProfiling] Use llvm.compiler.used if applicable for Mach-O
Fangrui Song [Wed, 1 Sep 2021 21:46:51 +0000 (14:46 -0700)]
[InstrProfiling] Use llvm.compiler.used if applicable for Mach-O

Similar to D97585.

D25456 used `S_ATTR_LIVE_SUPPORT` to ensure the data variable will be retained
or discarded as a unit with the counter variable, so llvm.compiler.used is
sufficient. It allows ld to dead strip unneeded profc and profd variables.

Reviewed By: vsk

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

2 years ago[llvm-profdata] Fix assertion from invalid iterator
Wenlei He [Wed, 1 Sep 2021 21:37:18 +0000 (14:37 -0700)]
[llvm-profdata] Fix assertion from invalid iterator

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

2 years ago[RISCV] Fix typo in RISCVSchedSiFive7.td
Alexander Pivovarov [Wed, 1 Sep 2021 21:26:51 +0000 (16:26 -0500)]
[RISCV] Fix typo in RISCVSchedSiFive7.td

Fix typo in "microarchitecure".

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

2 years ago[ARM] Add MVE lowering for fptosi.sat
David Green [Wed, 1 Sep 2021 21:38:47 +0000 (22:38 +0100)]
[ARM] Add MVE lowering for fptosi.sat

This adds lowering of the llvm.fptosi.sat and llvm.fptoui.sat intinsics,
selecting a VCVT instruction which under MVE will inherently perform the
saturate.

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

2 years ago[OpenMP] Use IsHostPtr where needed in rest of omptarget.cpp
Joel E. Denny [Wed, 1 Sep 2021 20:24:39 +0000 (16:24 -0400)]
[OpenMP] Use IsHostPtr where needed in rest of omptarget.cpp

As started in D107925, this patch replaces the remaining occurrences
of `UNIFIED_SHARED_MEMORY && TgtPtrBegin == HstPtrBegin` in
`omptarget.cpp` with `IsHostPtr`.  The former condition is broken in
the rare case that the device and host happen to use the same address
for their mapped allocations.  I don't know how to write a test that's
likely to reveal this case.

Reviewed By: grokos

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

2 years ago[OpenMP] Use IsHostPtr where needed for targetDataBegin
Joel E. Denny [Wed, 1 Sep 2021 20:24:34 +0000 (16:24 -0400)]
[OpenMP] Use IsHostPtr where needed for targetDataBegin

As discussed in D105990, without this patch, `targetDataBegin`
determines whether to transfer data (as opposed to assuming it's in
shared memory) using the condition `!UseUSM || HasCloseModifier`.
However, this condition is broken if use of discrete memory was forced
by `omp_target_associate_ptr`.  This patch extends
`unified_shared_memory/associate_ptr.c` to reveal this case, and it
fixes it using `!IsHostPtr` in `DeviceTy::getTargetPointer` to replace
this condition.

Reviewed By: grokos

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

2 years ago[OpenMP][NFC] Eliminate CopyMember from targetDataEnd
Joel E. Denny [Wed, 1 Sep 2021 20:24:28 +0000 (16:24 -0400)]
[OpenMP][NFC] Eliminate CopyMember from targetDataEnd

This patch is based on comments in D105990.  It is NFC according to
the following observations:

1. `CopyMember` is computed as `!IsHostPtr && IsLast`.
2. `DelEntry` is true only if `IsLast` is true.

We apply those observations in order:

```
if ((DelEntry || Always || CopyMember) && !IsHostPtr)

if ((DelEntry || Always || IsLast) && !IsHostPtr)

if ((Always || IsLast) && !IsHostPtr)
```

Reviewed By: grokos

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

2 years ago[OpenMP] Use IsHostPtr where needed for targetDataEnd
Joel E. Denny [Wed, 1 Sep 2021 20:24:14 +0000 (16:24 -0400)]
[OpenMP] Use IsHostPtr where needed for targetDataEnd

As discussed in D105990, without this patch, `targetDataEnd`
determines whether to transfer data or delete a device mapping (as
opposed to assuming it's in shared memory) using two different
conditions, each of which is broken for some cases:

1. `!(UNIFIED_SHARED_MEMORY && TgtPtrBegin == HstPtrBegin)`: The
   broken case is rare: the device and host might happen to use the
   same address for their mapped allocations.  I don't know how to
   write a test that's likely to reveal this case, but this patch does
   fix it, as discussed below.
2. `!UNIFIED_SHARED_MEMORY || HasCloseModifier`: There are at least
   two broken cases:
    1. The `close` modifier might have been specified on an `omp
      target enter data` but not the corresponding `omp target exit
      data`, which thus might falsely assume a mapping is in shared
      memory.  The test `unified_shared_memory/close_enter_exit.c`
      already has a missing deletion as a result, and this patch adds
      a check for that.  This patch also adds the new test
      `close_member.c` to reveal a missing transfer and deletion.
    2. Use of discrete memory might have been forced by
      `omp_target_associate_ptr`, as in the test
      `unified_shared_memory/api.c`.  In the current `targetDataEnd`
      implementation, this condition turns out not be used for this
      case: because the reference count is infinite, a transfer is
      possible only with an `always` modifier, and this condition is
      never used in that case.  To ensure it's never used for that
      case in the future, this patch adds the test
      `unified_shared_memory/associate_ptr.c`.

Fortunately, `DeviceTy::getTgtPtrBegin` already has a solution: it
reports whether the allocation was found in shared memory via the
variable `IsHostPtr`.

After this patch, `HasCloseModifier` is no longer used in
`targetDataEnd`, and I wonder if the `close` modifier is ever useful
on an `omp target data end`.

Reviewed By: grokos

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

2 years ago[OpaquePtr] Cleanup some uses of getPointerElementType() in TailRecursionElimination
Arthur Eubanks [Wed, 1 Sep 2021 21:21:58 +0000 (14:21 -0700)]
[OpaquePtr] Cleanup some uses of getPointerElementType() in TailRecursionElimination

2 years ago[InstrProfiling][test] Combine profiling.ll and linkage.ll
Fangrui Song [Wed, 1 Sep 2021 21:21:42 +0000 (14:21 -0700)]
[InstrProfiling][test] Combine profiling.ll and linkage.ll

The latter mostly covers the former.

2 years ago[SCEV] Clarify requirements for zero-stride to be UB
Philip Reames [Wed, 1 Sep 2021 20:56:25 +0000 (13:56 -0700)]
[SCEV] Clarify requirements for zero-stride to be UB

There's a silent bug in our reasoning about zero strides. We assume that having a single static exit implies that if that exit is not taken, then the loop must be infinite. This ignores the potential for abnormal exits via exceptions. Consider the following example:

for (uint_8 i = 0; i < 1; i += 0) {
  throw_on_thousandth_call();
}

Our reasoning is such that we'd conclude this loop can't take the backedge as that would lead to a (presumed) infinite loop.

In practice, this is a silent bug because the loopIsFiniteByAssumption returns false strictly more often than the loopHaNoAbnormalExits property. We could reasonable want to change that in the future, so fixing the codeflow now is worthwhile.

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

2 years ago[openmp] Drop test from D109057, disproportionately difficult to run on windows
Jon Chesterfield [Wed, 1 Sep 2021 20:51:51 +0000 (21:51 +0100)]
[openmp] Drop test from D109057, disproportionately difficult to run on windows

2 years ago [AMDGPU] enable scalar compare in truncate selection
alex-t [Wed, 1 Sep 2021 20:31:33 +0000 (23:31 +0300)]
 [AMDGPU] enable scalar compare in truncate selection

Currently, the truncate selection dag node is expanded as a bitwise AND plus compare to 1.  This change enables scalar comparison in the pattern if the truncate node is uniform.

Reviewed By: rampitec

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

2 years ago[LoopDeletion] Separate logic in breakBackedgeIfNotTaken using symboic max trip count...
Philip Reames [Wed, 1 Sep 2021 20:29:10 +0000 (13:29 -0700)]
[LoopDeletion] Separate logic in breakBackedgeIfNotTaken using symboic max trip count [nfc]

As mentioned in D108833, the logic for figuring out if a backedge is dead was somewhat interwoven with the SCEV based logic and the symbolic eval logic. This is my attempt at making the code easier to follow.

Note that this is only NFC after the work done in 29fa37ec.  Thanks to Nikita for catching that case.

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

2 years ago[openmp] Accept directory for libomptarget-bc-path
Jon Chesterfield [Wed, 1 Sep 2021 18:46:20 +0000 (19:46 +0100)]
[openmp] Accept directory for libomptarget-bc-path

The commandline flag to specify a particular openmp devicertl library
currently errors like:
```
fatal error: cannot open file
      './runtimes/runtimes-bins/openmp/libomptarget':
      Is a directory
```
CommonArgs successfully appends the directory to the commandline args then
mlink-builtin-bitcode rejects it.

This patch is a point fix to that. If --libomptarget-amdgcn-bc-path=directory
then append the expected name for the current architecture and go on as before.
This is useful for test runners that don't hardcode the architecture.

Reviewed By: jdoerfert

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

2 years ago[WebAssembly] Support opaque pointers in FixFunctionBitcasts
Nikita Popov [Sat, 28 Aug 2021 21:38:12 +0000 (23:38 +0200)]
[WebAssembly] Support opaque pointers in FixFunctionBitcasts

With opaque pointers, no actual bitcasts will be present. Instead,
there will be a mismatch between the call FunctionType and the
function ValueType. Change the code to collect CallBases
specifically (rather than general Uses) and compare these types.

RAUW is no longer performed, as there would no longer be any
bitcasts that can be RAUWd.

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

2 years ago[lld][Hexagon] Add checks for instructions that can have TLS relocations
Sid Manning [Thu, 26 Aug 2021 15:18:33 +0000 (08:18 -0700)]
[lld][Hexagon] Add checks for instructions that can have TLS relocations

Several instructions with potential TLS relocations were missing.  This
issue was found when building the Canadian LLVM toolchain.

2 years ago[mlir][SPIRV] Add Image Operands for Image Instructions
Weiwei Li [Wed, 1 Sep 2021 18:39:05 +0000 (02:39 +0800)]
[mlir][SPIRV] Add Image Operands for Image Instructions

This patch is to add Image Operands in SPIR-V Dialect and also let ImageDrefGather to use Image Operands.

Image Operands are used in many image instructions. "Image Operands encodes what oprands follow, as per Image Operands". And ususally, they are optional to image instructions.

The format of image operands looks like:

    %0 = spv.ImageXXXX %1, ... %3 : f32 ["Bias|Lod"](%4, %5 : f32, f32) -> ...

This patch doesn’t implement all operands (see Section 3.14 in SPIR-V Spec) but provides a skeleton of it. There is TODO in verifyImageOperands function.

Co-authored: Alan Liu <alanliu.yf@gmail.com>

Reviewed by: antiagainst

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

2 years ago[SCEVExpander] Prefer pointer expansion for overflow checks
Philip Reames [Wed, 1 Sep 2021 20:07:32 +0000 (13:07 -0700)]
[SCEVExpander] Prefer pointer expansion for overflow checks

We'd special cased this logic to use pointer types for non-integral pointers, but there's no reason we can't do that for all pointer types.   Doing it this was has a few advantages:
a) The code itself becomes more straight forward, and easier to test.
b) We avoid introducing ptrtoint into programs which didn't have them in the source.
c) The resulting codegen is easier to analyze and simplify (mostly due to lack of ptrtoint).

Note that there are some test diffs, but a) running them through instcombine helps a ton, and b) there's enough missing obvious transforms on both before and after IR that it's clear this isn't performance sensitive.

This is mostly motivated by cleaning up mentions of non-integrals to have a clearer idea of what we actually need to support.

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

2 years ago[AMDGPU] Update Call Convention docs for GFX90A
Scott Linder [Wed, 1 Sep 2021 20:02:40 +0000 (20:02 +0000)]
[AMDGPU] Update Call Convention docs for GFX90A

Document the CSR AGPRs for GFX90A.

Remove the TODO for gfx908, as the answer is that we don't mark any
AGPRs as callee-saved except for GFX90A, i.e. the docs as-is are correct
for gfx908.

Reviewed By: rampitec

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

2 years agoVFS: Document goals of 'use-external-name' and related logic, NFC
Duncan P. N. Exon Smith [Wed, 1 Sep 2021 19:35:34 +0000 (15:35 -0400)]
VFS: Document goals of 'use-external-name' and related logic, NFC

Document 'use-external-name' and the various bits of logic that make it
work, to avoid others having to repeat the archival work (given that I
added getFileRefReturnsCorrectNameForDifferentStatPath to
FileManagerTest, seems possible I understood this once before!).

b59cf679e81483cbb3a9252056b7528f4c49586c added 'use-external-name' to
  RedirectingFileSystem. This causes `stat`s to return the external
  name for a redirected file instead of the name it was accessed by,
  leaking it through the VFS.
d066d4c849be06a01c0d17e8dc206913f4e7bfe3 propagated the external name
  further through clang::FileManager.
4dc5573acc0d2e7c59d8bac2543eb25cb4b32984, which added
  clang::FileEntryRef to clang::FileManager, has complicated concession
  to account for this as well (since refactored a bit).

The goal of 'use-external-name' is to enable Clang to report "real" file
paths to users (via diagnostics) and to external tools (such as
debuggers reading debug info and build systems reading `.d` files).

I've added FIXMEs to look at other channels for communicating the
external names, since the current implementation adds complexity to
FileManager and exposes an inconsistent interface to clients.

Besides that, the FileManager logic appears to be kicking in outside of
'use-external-name'. Seems that *some* vfs::FileSystem implementations
canonicalize some paths returned by `stat` in *some* cases (the bug
isn't fully understood yet). Volodymyr Sapsai is investigating, this at
least better documents what *is* understood.

2 years agoRevert "[openmp] Accept directory for libomptarget-bc-path"
Jon Chesterfield [Wed, 1 Sep 2021 19:45:41 +0000 (20:45 +0100)]
Revert "[openmp] Accept directory for libomptarget-bc-path"

Windows separator problem. Fixing that broke another regex.
This reverts commit 0173e024fd9e779a94503040a532bcf125277f86.

2 years agoRevert "[openmp] No longer use LIBRARY_PATH to find devicertl"
Jon Chesterfield [Wed, 1 Sep 2021 19:43:14 +0000 (20:43 +0100)]
Revert "[openmp] No longer use LIBRARY_PATH to find devicertl"

This reverts commit 7a228f872fbbefa6a6eba1d51da192761879fcca.
Failing test case under CI

2 years ago[libc] Add a skeleton for C standard condition variable functions.
Siva Chandra Reddy [Fri, 27 Aug 2021 18:49:40 +0000 (18:49 +0000)]
[libc] Add a skeleton for C standard condition variable functions.

This patch adds a skeleton as a preparatory step for the next patch which
adds the actual implementations of the condition variable functions.

Reviewed By: michaelrj

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

2 years ago[RISCV] Fold (RISCVISD::SELECT_CC X, Y, CC, Z, Z) -> Z.
Craig Topper [Wed, 1 Sep 2021 19:11:37 +0000 (12:11 -0700)]
[RISCV] Fold (RISCVISD::SELECT_CC X, Y, CC, Z, Z) -> Z.

If the true and false values are the same, we don't need a SELECT_CC.

This would normally be folded before a select is legalized to
select_cc. The test case exploits the late legalization of vscale
to trigger a case where they become identical after legalization.

This works around an issue found on a test case in D107957. In that
case the true/false values were both eventually 0 and the select was
used by a vector AVL operand. The select_cc got expanded to control
flow and a phi, but the phi inputs were both copies from X0. MachineIR
optimizations simplified this to a single copy from X0 going into the
vector instruction. This became the input of a vsetvli after vsetvli
insertion. Then register coalescing folded the copy into the vsetvli.
X0 as the source of a vsetvli is a special encoding and should not be
created by coalesing. We need to fix our vsetvli handling to make sure
this can never happen any other way, but removing the unneeded select
is still a worthwhile optimization.

2 years ago[ubsan] warn inside the sigaction interceptor if static linking is suspected, and...
Kostya Serebryany [Wed, 1 Sep 2021 18:11:45 +0000 (11:11 -0700)]
[ubsan] warn inside the sigaction interceptor if static linking is suspected, and continue instead of crashing on null deref

[ubsan] warn inside the sigaction interceptor if static linking is suspected, and continue instead of crashing on null deref

Reviewed By: kostik

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

2 years ago[libomptarget] Drop path separator from test to fix windows build
Jon Chesterfield [Wed, 1 Sep 2021 19:34:58 +0000 (20:34 +0100)]
[libomptarget] Drop path separator from test to fix windows build

2 years ago[openmp] No longer use LIBRARY_PATH to find devicertl
Jon Chesterfield [Wed, 1 Sep 2021 19:24:34 +0000 (20:24 +0100)]
[openmp] No longer use LIBRARY_PATH to find devicertl

Given D109057, change test runner to use the libomptarget-x-bc-path
argument instead of the LIBRARY_PATH environment variable to find the device
library.

Also drop the use of LIBRARY_PATH environment variable as it is far
too easy to pull in the device library from an unrelated toolchain by accident
with the current setup. No loss in flexibility to developers as the clang
commandline used here is still available.

Reviewed By: jdoerfert

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

2 years ago[CSSPGO] Sort function offset table to speed up profile loading.
Hongtao Yu [Tue, 31 Aug 2021 23:30:49 +0000 (16:30 -0700)]
[CSSPGO] Sort function offset table to speed up profile loading.

With the context split work, the context-based (an array of strings) sorting performed at profile load time is way more expansive than single-string-based sorting. This is likely due to auxiliary operations done on each array element, such as indirect references, std::min operations, also likely cache misses. In this change I'm presorting profiles during profile generation time to avoid sorting at compile time.

Compared to the previous context-split work, this effectively cuts down compile time by 20% for one of our large services and brings us closer to non-CS build, with still a small gap in build time.

Reviewed By: wenlei, wmi

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

2 years ago[IVDescriptors] Make pointer inductions compatible with opaque pointers
Nikita Popov [Wed, 23 Jun 2021 11:01:44 +0000 (13:01 +0200)]
[IVDescriptors] Make pointer inductions compatible with opaque pointers

Store the used element type in the InductionDescriptor. For typed
pointers, it remains the pointer element type. For opaque pointers,
we always use an i8 element type, such that the step is a simple
offset.

A previous version of this patch instead tried to guess the element
type from an induction GEP, but this is not reliable, as the GEP
may be hidden (see @both in iv_outside_user.ll).

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

2 years ago[libc] Mark return value of memcpy in strcpy as initialized for msan.
Siva Chandra Reddy [Wed, 1 Sep 2021 06:52:12 +0000 (06:52 +0000)]
[libc] Mark return value of memcpy in strcpy as initialized for msan.

Reviewed By: michaelrj

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

2 years agoRemove deprecated registration APIs (NFC)
Mehdi Amini [Wed, 1 Sep 2021 18:38:07 +0000 (18:38 +0000)]
Remove deprecated registration APIs (NFC)

In D104421, we changed the API for pass registration.
Before you would write:

      void registerPass("my-pass", "My Pass Description.",
                        [] { return createMyPass(); });
while now you’d only write:

      void registerPass([] { return createMyPass(); });

If you’re using TableGen to define your pass registration, you shouldn’t have anything to do. If you’re using directly the C++ API here are some changes.
Your project may also be broken even if you use TableGen and you call the
generated registration API in case your pass implementation didn’t inherit from
the MyPassBase class generated by TableGen.

If you don't use TableGen, the "my-pass" and "My Pass Description." fields must
be provided by overriding methods on the pass itself:

  llvm::StringRef getArgument() const final { return "my-pass"; }
  llvm::StringRef getDescription() const final {
    return "My Pass Description.";
  }

Reviewed By: rriddle

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

2 years ago[SCEV] If max BTC is zero, then so is the exact BTC [2 of 2]
Philip Reames [Wed, 1 Sep 2021 18:33:15 +0000 (11:33 -0700)]
[SCEV] If max BTC is zero, then so is the exact BTC [2 of 2]

This extends D108921 into a generic rule applied to constructing ExitLimits along all paths. The remaining paths (primarily howFarToZero) don't have the same reasoning about UB sensitivity as the howManyLessThan ones did. Instead, the remain cause for max counts being more precise than exact counts is that we apply context sensitive loop guards on the max path, and not on the exact path. That choice is mildly suspect, but out of scope of this patch.

The MVETailPredication.cpp change deserves a bit of explanation. We were previously figuring out that two SCEVs happened to be equal because the happened to be identical. When we optimized one with context sensitive information, but not the other, we lost the ability to prove them equal. So, cover this case by subtracting and then applying loop guards again. Without this, we see changes in test/CodeGen/Thumb2/mve-blockplacement.ll

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

2 years ago[clang] Add a -canonical-prefixes option
Nico Weber [Fri, 27 Aug 2021 14:14:27 +0000 (10:14 -0400)]
[clang] Add a -canonical-prefixes option

In https://reviews.llvm.org/D47480 I complained that there's no positive
form of this flag, so let's add one :)

https://gcc.gnu.org/PR29931 also has a pending patch to add the positive
form to gcc (but there's admittedly not a lot of movement on that bug).

This doesn't change any defaults.

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

2 years ago[DWARF] Find offset of attribute.
Alexander Yermolovich [Wed, 1 Sep 2021 18:13:34 +0000 (11:13 -0700)]
[DWARF] Find offset of attribute.

This is used by BOLT to do patching of DebugInfo section, and Line Table. Directly by using find, and through getAttrFieldOffsetForUnit.

Reviewed By: dblaikie

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

2 years ago[openmp] Accept directory for libomptarget-bc-path
Jon Chesterfield [Wed, 1 Sep 2021 18:46:20 +0000 (19:46 +0100)]
[openmp] Accept directory for libomptarget-bc-path

The commandline flag to specify a particular openmp devicertl library
currently errors like:
```
fatal error: cannot open file
      './runtimes/runtimes-bins/openmp/libomptarget':
      Is a directory
```
CommonArgs successfully appends the directory to the commandline args then
mlink-builtin-bitcode rejects it.

This patch is a point fix to that. If --libomptarget-amdgcn-bc-path=directory
then append the expected name for the current architecture and go on as before.
This is useful for test runners that don't hardcode the architecture.

Reviewed By: jdoerfert

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

2 years ago[InstCombine] allow more min/max with 'not' folds for intrinsics
Sanjay Patel [Wed, 1 Sep 2021 18:40:00 +0000 (14:40 -0400)]
[InstCombine] allow more min/max with 'not' folds for intrinsics

isFreeToInvert allows min/max with 'not' on both operands,
so easing the argument restriction catches the case where
that operand has one use.

We already handle the sub-patterns when there are less uses:
https://alive2.llvm.org/ce/z/8Jatm_

...but this is another step towards parity with the
equivalent icmp+select idioms ( D98152 ).

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

2 years ago[InstCombine] use isFreeToInvert to generalize min/max with 'not'
Sanjay Patel [Wed, 1 Sep 2021 18:33:04 +0000 (14:33 -0400)]
[InstCombine] use isFreeToInvert to generalize min/max with 'not'

This mimics the code for the corresponding cmp-select idiom.

This also prevents an infinite loop because isFreeToInvert
does not match constant expressions.

So this patch solves the same problem as D108814 and obsoletes
it, but my main motivation is to enhance the pattern matching
to allow more invertible ops. That change will be a follow-up
patch on top of this one.

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

2 years ago[NFC] Remove redundant code added in 04ce2de3
Arthur Eubanks [Wed, 1 Sep 2021 18:30:07 +0000 (11:30 -0700)]
[NFC] Remove redundant code added in 04ce2de3

2 years ago[NFC] Use newly introduced *AtIndex methods
Arthur Eubanks [Fri, 20 Aug 2021 17:49:36 +0000 (10:49 -0700)]
[NFC] Use newly introduced *AtIndex methods

Introduced in D108788. These are clearer.

2 years agoTighten heuristic for coroutine debug info workaround.
Adrian Prantl [Wed, 1 Sep 2021 18:09:16 +0000 (11:09 -0700)]
Tighten heuristic for coroutine debug info workaround.

The OutermostLoad condition is supposed to strip the outermost
DW_OP_deref operation because dbg.declares are implicitly
indirect. This patch makes sure the heuristic is only applied to
dbg.declare intrinsics and only if the outermost instruction is a
load.

This was found while qualifying the latest Swift compiler rebranch.

rdar://82037764

2 years ago[RISCV] Add a test case showing an extra sext.w near a sh2add with multiple uses...
Craig Topper [Wed, 1 Sep 2021 16:48:46 +0000 (09:48 -0700)]
[RISCV] Add a test case showing an extra sext.w near a sh2add with multiple uses. NFC

See description in test.

Reviewed By: frasercrmck

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

2 years ago[gn build] Port 0922ce56f4f0
LLVM GN Syncbot [Wed, 1 Sep 2021 17:49:53 +0000 (17:49 +0000)]
[gn build] Port 0922ce56f4f0

2 years ago[libomptarget] Set runpath on libomptarget, use that to drop LD_LIBRARY_PATH from...
Jon Chesterfield [Wed, 1 Sep 2021 17:47:55 +0000 (18:47 +0100)]
[libomptarget] Set runpath on libomptarget, use that to drop LD_LIBRARY_PATH from test runner

Using rpath instead of LD_LIBRARY_PATH to find libomp.so and
libomptarget.so lets one rerun the already built test executables without
setting environment variables and removes the risk of the test runner picking
up different libraries to the developer debugging the failure.

rpath usually means runpath, which is not transitive, so set runpath on
libomptarget itself so that it can find the plugins located next to it,
spelled $ORIGIN. This provides sufficient functionality to drop D102043

Reviewed By: tianshilei1992

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

2 years ago[IRLinker] Suppress linker warnings when linking with CUDA libdevice.
Artem Belevich [Fri, 27 Aug 2021 18:18:11 +0000 (11:18 -0700)]
[IRLinker] Suppress linker warnings when linking with CUDA libdevice.

libdevice bitcode provided by NVIDIA is linked with clang/LLVM-generated IR
which uses nvptx*-nvidia-cuda triple. We need to mark them as compatible.

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

2 years ago[libc++][format] Add __format_arg_store.
Mark de Wever [Sat, 5 Dec 2020 10:45:21 +0000 (11:45 +0100)]
[libc++][format] Add __format_arg_store.

This implements the struct `__format_arg_store` and its dependencies:
* the class basic_format_arg,
* the class basic_format_args,
* the class basic_format_context,
* the function make_format_args,
* the function wmake_format_args,
* the function visit_format_arg,
* several Standard required typedefs.

The following parts will be implemented in a later patch:

* the child class `basic_format_arg::handle`,
* the function `basic_format_arg::basic_format_arg(const T* p)`.

The following extension has been implemented:
* the class basic_format_arg supports `__[u]int128_t` on platform where libc++ supports 128 bit integrals.

Implements parts of:
* P0645 Text Formatting

Completes:
* LWG3371 visit_format_arg and make_format_args are not hidden friends
* LWG3542 basic_format_arg mishandles basic_string_view with custom traits

Note https://mordante.github.io/blog/2021/06/05/format.html gives a bit more information about the goals and non-goals of this initial patch series.

Reviewed By: #libc, ldionne, vitaut

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

2 years ago[NFC] Rename attribute methods that work with indexes
Arthur Eubanks [Fri, 20 Aug 2021 17:49:36 +0000 (10:49 -0700)]
[NFC] Rename attribute methods that work with indexes

This is part one of a couple of patches to fully rename these methods.

I've made the mistake of assuming that these indexes are for parameters
multiple times, but actually they're based off of a weird indexing
scheme AttributeList::AttrIndex where 0 is the return value and ~0 is
the function. Hopefully renaming these methods will make this clearer.
Ideally users should use more specific methods like
AttributeList::getFnAttr().

This patch simply adds the name that we want in the end. This is so the
removal of the methods with the original names happens in a separate
change to make it easier for downstream users.

This touches all relevant methods in AttributeList, CallBase, and Function.

Reviewed By: rnk

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

2 years ago[WebAssembly] Lower v2f32 to v2f64 extending loads with promote_low
Thomas Lively [Wed, 1 Sep 2021 17:27:41 +0000 (10:27 -0700)]
[WebAssembly] Lower v2f32 to v2f64 extending loads with promote_low

Previously extra wide v4f32 to v4f64 extending loads would be legalized to v2f32
to v2f64 extending loads, which would then be scalarized by legalization. (v2f32
to v2f64 extending loads not produced by legalization were already being emitted
correctly.) Instead, mark v2f32 to v2f64 extending loads as legal and explicitly
lower them using promote_low. This regresses the addressing modes supported for
the extloads not produced by legalization, but that's a fine trade off for now.

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

2 years ago[CSSPGO] Fix an access violation due to invalided std::vector pointer invalidation.
Hongtao Yu [Wed, 1 Sep 2021 17:19:39 +0000 (10:19 -0700)]
[CSSPGO] Fix an access violation due to invalided std::vector pointer invalidation.

std::vector pointers can be invalided while growing. Using std::list instead.

2 years ago[AArch64][GlobalISel] Handle any-extending FPR loads in manual selection code.
Amara Emerson [Wed, 1 Sep 2021 00:22:39 +0000 (17:22 -0700)]
[AArch64][GlobalISel] Handle any-extending FPR loads in manual selection code.

When we have an any-extending FPR bank load, none of the tablegen patterns
match and we fall back to the C++ selector. Like with the truncating stores
that were fixed recently, the C++ wasn't able to handle it and ended up
generating invalid copies between different size regclasses.

This change adds handling for this case, splitting the load into a regular
load and a SUBREG_TO_REG to extend it into the original wide destination reg.

2 years ago[mlir][tosa] Small refactor to the functionality of Depthwise_Conv2D to add the bias...
natashaknk [Wed, 1 Sep 2021 17:00:30 +0000 (10:00 -0700)]
[mlir][tosa] Small refactor to the functionality of Depthwise_Conv2D to add the bias at the end of the convolution

Follow-up to the Conv2d and fully_connected lowering adjustments

Reviewed By: rsuderman

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

2 years agoSupport alias.scope and noalias metadata lowering on intrinsics.
Tyler Augustine [Wed, 1 Sep 2021 16:54:04 +0000 (16:54 +0000)]
Support alias.scope and noalias metadata lowering on intrinsics.

Builds on https://reviews.llvm.org/D107870 to support annotating intrinsics with alias.scope and noalias metadata.

Reviewed By: arpith-jacob, ftynse

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

2 years ago[flang] Include default component initialization in static initializers
peter klausler [Tue, 10 Aug 2021 17:22:39 +0000 (10:22 -0700)]
[flang] Include default component initialization in static initializers

The combined initializers constructed from DATA statements and explicit
static initialization in declarations needs to include derived type
component default initializations, overriding those default values
without complaint with values from explicit DATA statement or declaration
initializations when they overlap.  This also has to work for objects
with storage association due to EQUIVALENCE.  When storage association causes
default component initializations to overlap, emit errors if and only
if the values differ (See Fortran 2018 subclause 19.5.3, esp. paragraph
10).

The f18 front-end has a module that analyzes and converts DATA statements
into equivalent static initializers for objects.  For storage-associated
objects, compiler-generated objects are created that overlay the entire
association and fill it with a combined initializer.  This "data-to-inits"
module already exists, and this patch is essentially extension and
clean-up of its machinery to complete the job.

Also: emit EQUIVALENCE to module files; mark compiler-created symbols
and *don't* emit those to module files; check non-static EQUIVALENCE
sets for conflicting default component initializations, so lowering
doesn't have to check them or emit diagnostics.

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

2 years agoRevert "Revert "Disable ReplaceLDS pass, patch up tests to match""
hsmahesha [Wed, 1 Sep 2021 16:22:20 +0000 (21:52 +0530)]
Revert "Revert "Disable ReplaceLDS pass, patch up tests to match""

This reverts commit 5ae6804d179edd29ac822c2e34a5cee7053793e1.

2 years ago[CSSPGO] Enable loading MD5 CS profile.
Hongtao Yu [Mon, 30 Aug 2021 17:31:47 +0000 (10:31 -0700)]
[CSSPGO] Enable loading MD5 CS profile.

Adding the compiler support of MD5 CS profile based on pervious context split work D107299. A MD5 CS profile is about 40% smaller than the string-based extbinary profile. As a result, the compilation is 15% faster.

There are a few conversion from real names to md5 names that have been made on the sample loader and context tracker side to get it work.

Reviewed By: wenlei, wmi

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

2 years ago[LoadStoreVectorizer] Make aliasing check more precise
Nikita Popov [Tue, 31 Aug 2021 20:02:08 +0000 (22:02 +0200)]
[LoadStoreVectorizer] Make aliasing check more precise

The load store vectorizer currently uses isNoAlias() to determine
whether memory-accessing instructions should prevent vectorization.
However, this only works for loads and stores. Additionally, a
couple of intrinsics like assume are special-cased to be ignored.

Instead use getModRefInfo() to generically determine whether the
instruction accesses/modifies the relevant location. This will
automatically handle all inaccessiblememonly intrinsics correctly
(as well as other calls that don't modref for other reasons).
This requires generalizing the code a bit, as it was previously
only considering loads and stored in particular.

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

2 years agoFine grain control over some symbol visibility
serge-sans-paille [Mon, 30 Aug 2021 20:21:39 +0000 (22:21 +0200)]
Fine grain control over some symbol visibility

Setting -fvisibility=hidden when compiling Target libs has the advantage of
not being intrusive on the codebase, but it also sets the visibility of all
functions within header-only component like ADT. In the end, we end up with
some symbols with hidden visibility within llvm dylib (through the target libs),
and some with external visibility (through other libs). This paves the way for
subtle bugs like https://reviews.llvm.org/D101972

This patch explicitly set the visibility of some classes to `default` so that
`llvm::Any` related symbols keep a `default` visibility. Indeed a template
function with `default` visibility parametrized by a type with `hidden`
visibility is granted `hidden` visibility, and we don't want this for the
uniqueness of `llvm::Any::TypeId`.

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

2 years agoRevert "Disable ReplaceLDS pass, patch up tests to match"
hsmahesha [Wed, 1 Sep 2021 15:48:00 +0000 (21:18 +0530)]
Revert "Disable ReplaceLDS pass, patch up tests to match"

This reverts commit 50ad3478bdd3f0643ee94f6663293af5b3c27afe.

Reviewed By: JonChesterfield

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

2 years ago[clang-tidy] Fix documentation typos (NFC)
Kazu Hirata [Wed, 1 Sep 2021 15:48:31 +0000 (08:48 -0700)]
[clang-tidy] Fix documentation typos (NFC)

2 years ago[libc++] Remove some workarounds for unsupported GCC and Clang versions
Louis Dionne [Tue, 31 Aug 2021 14:49:06 +0000 (10:49 -0400)]
[libc++] Remove some workarounds for unsupported GCC and Clang versions

There is a lot more we can do, in particular in <type_traits>, but this
removes some workarounds that were gated on checking a specific compiler
version.

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

2 years ago[libc++][NFC] Correct comment about P0600 missing node_handle bits
Louis Dionne [Tue, 31 Aug 2021 21:46:01 +0000 (17:46 -0400)]
[libc++][NFC] Correct comment about P0600 missing node_handle bits

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

2 years ago[libc++] Remove workarounds for [[nodebug]] not working properly on typedefs in older...
Louis Dionne [Tue, 31 Aug 2021 14:32:11 +0000 (10:32 -0400)]
[libc++] Remove workarounds for [[nodebug]] not working properly on typedefs in older Clangs

Clang used to support [[nodebug]] everywhere except on typedefs. Since
we don't support such old Clangs anymore, we can get rid of _LIBCPP_NODEBUG_TYPE
in favour of always using _LIBCPP_NODEBUG.

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

2 years ago[libc++][NFC] Use std::enable_if instead of _EnableB helper in pair
Louis Dionne [Wed, 1 Sep 2021 14:47:03 +0000 (10:47 -0400)]
[libc++][NFC] Use std::enable_if instead of _EnableB helper in pair

This doesn't impact the compile-time efficiency, but we get better
diagnostics when an overload is disabled.

2 years ago[DIArgList] Re-unique after changing operands to fix non-determinism
Teresa Johnson [Tue, 31 Aug 2021 03:07:01 +0000 (20:07 -0700)]
[DIArgList] Re-unique after changing operands to fix non-determinism

We have a large compile showing occasional non-deterministic behavior
that is due to DIArgList not being properly uniqued in some cases. I
tracked this down to handleChangedOperands, for which there is a custom
implementation for DIArgList, that does not take care of re-uniquing
after updating the DIArgList Args, unlike the default version of
handleChangedOperands for MDNode.

Since the Args in the DIArgList form the key for the store, this seems
to be occasionally breaking the lookup in that DenseSet. Specifically,
when invoking DIArgList::get() from replaceVariableLocationOp, very
occasionally it returns a new DIArgList object, when one already exists
having the same exact Args pointers. This in turn causes a subsequent
call to Instruction::isIdenticalToWhenDefined on those two otherwise
identical DIArgList objects during a later pass to return false, leading
to different IR in those rare cases.

I modified DIArgList::handleChangedOperands to perform similar
re-uniquing as the MDNode version used by other metadata node types.
This also necessitated a change to the context destructor, since in some
cases we end up with DIArgList as distinct nodes: DIArgList is the only
metadata node type to have a custom dropAllReferences, so we need to
invoke that version on DIArgList in the DistinctMDNodes store to clean
it up properly.

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

2 years ago[Flang] test_symbols.py module file fix
Ivan Zhechev [Wed, 1 Sep 2021 13:07:32 +0000 (14:07 +0100)]
[Flang] test_symbols.py module file fix

Due to how the LIT deals with module files,
this change stores and runs the scripts in
their own temporary directory to prevent
interference in-between different tests.
It also makes ``test_symbols.py`` be more
consistent with the other scripts.

Reviewed By: Meinersbur, awarzynski

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

2 years ago[libomptarget] Normalise a cmake debug string, checking it triggers CI
Jon Chesterfield [Wed, 1 Sep 2021 13:23:14 +0000 (14:23 +0100)]
[libomptarget] Normalise a cmake debug string, checking it triggers CI

2 years ago[lldb] Add minidump save-core functionality to ELF object files
Andrej Korman [Wed, 1 Sep 2021 13:13:56 +0000 (15:13 +0200)]
[lldb] Add minidump save-core functionality to ELF object files

This change adds save-core functionality into the ObjectFileELF that enables
saving minidump of a stopped process. This change is mainly targeting Linux
running on x86_64 machines. Minidump should contain basic information needed
to examine state of threads, local variables and stack traces. Full support
for other platforms is not so far implemented. API tests are using LLDB's
MinidumpParser.

This relands commit aafa05e, reverted in 1f986f6.
Failed tests were fixed.

Reviewed By: clayborg

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

2 years agoEnsure field-annotations on pointers properly match the AS of the field.
Erich Keane [Tue, 31 Aug 2021 16:50:01 +0000 (09:50 -0700)]
Ensure field-annotations on pointers properly match the AS of the field.

Discovered in SYCL, the field annotations were always cast to an i8*,
which is an invalid bitcast for a pointer type with an address space.
This patch makes sure that we create an intrinsic that takes a pointer
to the correct address-space and properly do our casts.

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

2 years agoRevert "Reland "[clang-repl] Re-implement clang-interpreter as a test case.""
Nico Weber [Wed, 1 Sep 2021 12:32:00 +0000 (08:32 -0400)]
Revert "Reland "[clang-repl] Re-implement clang-interpreter as a test case.""

This reverts commit f0514a4d26100239088f08d618f2ba100f59958e.
Test fails on macOS: https://reviews.llvm.org/D107049#2976603

2 years ago[libcxx] contiguous iterator concept: don't require pointer or complete element types
Joe Loser [Wed, 1 Sep 2021 12:32:34 +0000 (08:32 -0400)]
[libcxx] contiguous iterator concept: don't require pointer or complete element types

`contiguous_iterator` requires the iterator type passed is either a
pointer type or that the element type of the iterator is a complete
object type. These constraints are not part of the current wording in
defining the `contiguous_iterator` concept - adjust the concept to
reflect this.

Inspired from discussion at https://reviews.llvm.org/D108645.

Reviewed By: #libc, ldionne

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

2 years ago[FileCheck] Use StringRef for MatchRegexp to fix crash.
Florian Hahn [Wed, 1 Sep 2021 11:41:20 +0000 (13:41 +0200)]
[FileCheck] Use StringRef for MatchRegexp to fix crash.

If MatchRegexp is an invalid regex, an error message will be printed
using SourceManager::PrintMessage via AddRegExToRegEx.

PrintMessage relies on the input being a StringRef into a string managed
by SourceManager. At the moment, a StringRef to a std::string
allocated in the caller of AddRegExToRegEx is passed. If the regex is
invalid, this StringRef is passed to PrintMessage, where it will crash,
because it does not point to a string managed via SourceMgr.

This patch fixes the crash by turning MatchRegexp into a StringRef If
we use MatchStr, we directly use that StringRef, which points into a
string from SourceMgr. Otherwise, MatchRegexp gets assigned
Format.getWildcardRegex(), which returns a std::string. To extend the
lifetime, assign it to a std::string variable WildcardRegexp and assign
MatchRegexp to a stringref to WildcardRegexp. WildcardRegexp should
always be valid, so we should never have to print an error message
via the SoureMgr I think.

Fixes PR49319.

Reviewed By: thopre

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

2 years ago[libcxx][docs] Remove completed issues from TODO.TXT
Joe Loser [Wed, 1 Sep 2021 12:22:16 +0000 (08:22 -0400)]
[libcxx][docs] Remove completed issues from TODO.TXT

Remove tasks listed that refer to papers or issues that are marked complete in
`libcxx/docs/Status/Cxx17Papers.csv` or `libcxx/docs/Status/Cxx17Issues.csv`

Reviewed By: #libc, ldionne

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

2 years ago[libcxx][docs] Mark LWG3356 as complete
Joe Loser [Wed, 1 Sep 2021 12:19:30 +0000 (08:19 -0400)]
[libcxx][docs] Mark LWG3356 as complete

Feature test macro for `__cpp_lib_is_nothrow_convertible` was introduced in
466df1718e41fe2fca6ce6bd98c01b18f42c05e4 but the LWG issue was not marked as
`Complete` in the docs. Also, fix the formatting of `Complete` for
LWG 3348.

Reviewed By: ldionne, #libc

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

2 years agoRevert "[CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend...
Zahira Ammarguellat [Wed, 1 Sep 2021 11:48:50 +0000 (04:48 -0700)]
Revert "[CLANG][PATCH][FPEnv] Add support for option -ffp-eval-method and extend #pragma float_control similarly"
The intent of this patch is to add support of -fp-model=[source|double|extended] to allow
the compiler to use a wider type for intermediate floating point calculations. As a side
effect to that, the value of FLT_EVAL_METHOD is changed according to the pragma
float_control.
Unfortunately some issue was uncovered with this change in preprocessing. See details in
https://reviews.llvm.org/D93769 . We are therefore reverting this patch until we find a way
to reconcile the value of FLT_EVAL_METHOD, the pragma and the -E flow.

This reverts commit 66ddac22e2a7f268e91c26d694112970dfa607ae.

2 years ago[NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve-intrinsics.ll
David Sherwood [Wed, 1 Sep 2021 11:09:58 +0000 (12:09 +0100)]
[NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve-intrinsics.ll

2 years agoRevert "[NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve...
David Sherwood [Wed, 1 Sep 2021 10:52:29 +0000 (11:52 +0100)]
Revert "[NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve-intrinsics.ll"

This reverts commit aeb2bd68dcb1df682ad549b4033cfad072efabd4.

2 years ago[NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve-intrinsics.ll
David Sherwood [Wed, 1 Sep 2021 10:37:20 +0000 (11:37 +0100)]
[NFC] Re-run update_analyze_test_checks on Analysis/CostModel/AArch64/sve-intrinsics.ll

2 years ago[clang-nvlink-wrapper] Wrapper around nvlink for archive files
Saiyedul Islam [Wed, 18 Aug 2021 11:43:30 +0000 (17:13 +0530)]
[clang-nvlink-wrapper] Wrapper around nvlink for archive files

 nvlink does not support linking of cubin files archived in an archive.
 This tool extracts all the cubin files in the given device specific archive
 and pass them to nvlink. It is required for linking static device libraries
 for nvptx.

 Reviewed By: ye-luo

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

2 years agoReland "[clang-repl] Re-implement clang-interpreter as a test case."
Vassil Vassilev [Wed, 1 Sep 2021 08:02:46 +0000 (08:02 +0000)]
Reland "[clang-repl] Re-implement clang-interpreter as a test case."

Original commit message:"
  The current infrastructure in lib/Interpreter has a tool, clang-repl, very
  similar to clang-interpreter which also allows incremental compilation.

  This patch moves clang-interpreter as a test case and drops it as conditionally
  built example as we already have clang-repl in place.

  Differential revision: https://reviews.llvm.org/D107049
"

This patch also ignores ppc due to missing weak symbol for __gxx_personality_v0
which may be a feature request for the jit infrastructure. Also, adds a missing
build system dependency to the orc jit.

2 years agoFix -Wunused-variable
Alexander Kornienko [Wed, 1 Sep 2021 09:27:33 +0000 (11:27 +0200)]
Fix -Wunused-variable

2 years ago[OpenMP][OMPD] Implementation of OMPD debugging library - libompd.
Vignesh Balasubramanian [Wed, 1 Sep 2021 08:13:13 +0000 (13:43 +0530)]
[OpenMP][OMPD] Implementation of OMPD debugging library - libompd.

This is a continuation of the review: https://reviews.llvm.org/D100181
Creates a new directory "libompd" under openmp.

"TargetValue" provides operational access to the OpenMP runtime memory
 for OMPD APIs.
With TargetValue, using "pointer" a user can do multiple operations
from casting, dereferencing to accessing an element for structure.
The member functions are designed to concatenate the operations that
are needed to access values from structures.

e.g., _a[6]->_b._c would read like :
TValue(ctx, "_a").cast("A",2)
.getArrayElement(6).access("_b").cast("B").access("_c")
For example:
If you have a pointer "ThreadHandle" of a running program then you can
access/retrieve "threadID" from the memory using TargetValue as below.

  TValue(context, thread_handle->th) /*__kmp_threads[t]->th*/
    .cast("kmp_base_info_t")
    .access("th_info") /*__kmp_threads[t]->th.th_info*/
    .cast("kmp_desc_t")
    .access("ds") /*__kmp_threads[t]->th.th_info.ds*/
    .cast("kmp_desc_base_t")
    .access("ds_thread") /*__kmp_threads[t]->th.th_info.ds.ds_thread*/
                .cast("kmp_thread_t")
.getRawValue(thread_id, 1);

Reviewed By: @hbae
Differential Revision: https://reviews.llvm.org/D100182

2 years ago[OpenCL] Define OpenCL 3.0 optional core features in C++ for OpenCL 2021
Justas Janickas [Wed, 25 Aug 2021 14:19:42 +0000 (15:19 +0100)]
[OpenCL] Define OpenCL 3.0 optional core features in C++ for OpenCL 2021

Modifies OpenCL 3.0 optional core feature macro definitions so that
they are set analogously in C++ for OpenCL 2021.

This change aims to achieve compatibility between C++ for OpenCL
2021 and OpenCL 3.0.

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

2 years ago[lldb] [gdb-remote client] Remove breakpoints throughout vfork
Michał Górny [Sun, 11 Apr 2021 15:16:43 +0000 (17:16 +0200)]
[lldb] [gdb-remote client] Remove breakpoints throughout vfork

Temporarily remove breakpoints for the duration of vfork, in order
to prevent them from triggering in the child process.  Restore them
once the server reports that vfork has finished and it is ready to
resume execution.

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

2 years ago[SCEV] Fix GCC -Wnon-virtual-dtor
Fangrui Song [Wed, 1 Sep 2021 08:12:32 +0000 (01:12 -0700)]
[SCEV] Fix GCC -Wnon-virtual-dtor

SCEVPredicate has a friend declaration. The friend can technically call the
protected destructor, so the warning is legitimate. Clang simply doesn't implement
the friend check.

Make the dtor virtual to fix the issue.

2 years ago[SelectionDAG][NFC] Fix typo in assertion message
Fraser Cormack [Wed, 1 Sep 2021 07:55:06 +0000 (08:55 +0100)]
[SelectionDAG][NFC] Fix typo in assertion message

s/Uexpected/Unexpected.

2 years ago[AMDGPU] Introduce RC flags for vector register classes
Christudasan Devadasan [Fri, 27 Aug 2021 04:05:41 +0000 (00:05 -0400)]
[AMDGPU] Introduce RC flags for vector register classes

Configure and use the TSFlags in TargetRegisterClass to
have unique flags for VGPR and AGPR register classes.
The vector register class queries like `hasVGPRs` will
now become more efficient with just a bitwise operation.

Reviewed By: rampitec

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

2 years ago[PowerPC] Implement quadword atomic load/store
Kai Luo [Wed, 1 Sep 2021 06:54:59 +0000 (06:54 +0000)]
[PowerPC] Implement quadword atomic load/store

Add support to load/store i128 atomically.

Reviewed By: jsji

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

2 years agoRevert "[lldb] [gdb-remote client] Remove breakpoints throughout vfork"
Michał Górny [Wed, 1 Sep 2021 06:53:11 +0000 (08:53 +0200)]
Revert "[lldb] [gdb-remote client] Remove breakpoints throughout vfork"

This reverts commit 199344d832c1bed1d75b1db2c1493e5a3e5c5544.
It caused regressions on arm, as reported by lldb-arm-ubuntu buildbot.

2 years agoRevert "[clang-repl] Re-implement clang-interpreter as a test case."
Vassil Vassilev [Wed, 1 Sep 2021 06:49:17 +0000 (06:49 +0000)]
Revert "[clang-repl] Re-implement clang-interpreter as a test case."

This reverts commit 319ce98011742141dad8dd95a2f9de9c0449be5c because it fails
on various platforms.

2 years agoDocument LLVM_ENABLE_RUNTIMES
Sylvestre Ledru [Wed, 1 Sep 2021 06:45:15 +0000 (08:45 +0200)]
Document LLVM_ENABLE_RUNTIMES

Reviewed By: phosek, MaskRay

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

2 years ago[flang] Set default form if unspecified at end of OPEN statement
Jean Perier [Wed, 1 Sep 2021 06:39:39 +0000 (08:39 +0200)]
[flang] Set default form if unspecified at end of OPEN statement

The standard specifies that the form must be set to a default at the
end of an open statement (C.7.4 point 2) where it was not specified.
Only in the case of a pre-connected unit can the form be deferred
until the first data transfer statement.

Set back the default form setting in OpenStatementState::EndIoStatement
that had been removed when deferring the pre-connected unit from setting
in 199a623ebf808a01e920ebd9904c99e633c33a1f.

Also return "UNDEFINED" instead of "UNKNOWN" to the FORM inquiry when the
form was not yet specified as defined in 12.10.2.12.

Related test: syntax 215a216.

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

2 years ago[SLP][RISCV] Implement unsigned getMinVectorRegisterBitWidth() for RISCV
Luke [Wed, 1 Sep 2021 05:08:13 +0000 (13:08 +0800)]
[SLP][RISCV] Implement unsigned getMinVectorRegisterBitWidth() for RISCV

Reviewed By: craig.topper

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

2 years ago[lldb] [gdb-remote client] Remove breakpoints throughout vfork
Michał Górny [Sun, 11 Apr 2021 15:16:43 +0000 (17:16 +0200)]
[lldb] [gdb-remote client] Remove breakpoints throughout vfork

Temporarily remove breakpoints for the duration of vfork, in order
to prevent them from triggering in the child process.  Restore them
once the server reports that vfork has finished and it is ready to
resume execution.

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

2 years ago[Test][Time profiler] Fix test time checking
Anton Afanasyev [Wed, 25 Aug 2021 22:32:39 +0000 (01:32 +0300)]
[Test][Time profiler] Fix test time checking

This test sometimes triggers failures during build testing. For instance, see:
https://lab.llvm.org/buildbot/#/builders/52/builds/10161, details: https://lab.llvm.org/buildbot/#/builders/52/builds/10161/steps/5/logs/FAIL__Clang__check-time-trace-sections_cpp .
AFAICT the time between driver calling and checking its time tracker output
is not guaranteed to be stable and small:
```
> head -2 check-time-trace-sections.cpp
// RUN: %clangxx -S -ftime-trace -ftime-trace-granularity=0 -o %T/check-time-trace-sections %s
// RUN: cat %T/check-time-trace-sections.json | %python %S/check-time-trace-sections.py
> clang -S -ftime-trace -ftime-trace-granularity=0 -o /tmp/check check-time-trace-sections.cpp
> cat /tmp/check.json | python check-time-trace-sections.py
> sleep 10
> cat /tmp/check.json | python check-time-trace-sections.py
'beginningOfTime' should represent the absolute time when the process has started
>
```
The attribute `beginningOfTime` was introduced here: https://reviews.llvm.org/D78030
One can change "10 sec" value to something longer, but I believe
it's enough just to check that `beginningOfTime` exists and is
not later than current time.

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