platform/upstream/llvm.git
3 years ago[TTI] NFC: Change getCastInstrCost and getExtractWithExtendCost to return InstructionCost
Sander de Smalen [Thu, 21 Jan 2021 13:40:22 +0000 (13:40 +0000)]
[TTI] NFC: Change getCastInstrCost and getExtractWithExtendCost to return InstructionCost

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: dmgreen

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

3 years ago[AMDGPU] Set implicit arg attributes for indirect calls
madhur13490 [Thu, 25 Mar 2021 07:25:51 +0000 (07:25 +0000)]
[AMDGPU] Set implicit arg attributes for indirect calls

This patch adds attributes corresponding to
implicits to functions/kernels if
1. it has an indirect call OR
2. it's address is taken.

Once such attributes are set, rest of the codegen would work
out-of-box for indirect calls. This patch eliminates
the potential overhead -fixed-abi imposes even though indirect functions
calls are not used.

Reviewed By: arsenm

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

3 years ago[gn build] Port be54341cd2ff
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:25 +0000 (13:07 +0000)]
[gn build] Port be54341cd2ff

3 years ago[gn build] Port 9b0a3388eb36
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:25 +0000 (13:07 +0000)]
[gn build] Port 9b0a3388eb36

3 years ago[gn build] Port 916fecb499c5
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:24 +0000 (13:07 +0000)]
[gn build] Port 916fecb499c5

3 years ago[gn build] Port 7f1963dc8e23
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:23 +0000 (13:07 +0000)]
[gn build] Port 7f1963dc8e23

3 years ago[gn build] Port 4f9b2469f33f
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:23 +0000 (13:07 +0000)]
[gn build] Port 4f9b2469f33f

3 years ago[gn build] Port 21d6636d83b3
LLVM GN Syncbot [Tue, 13 Apr 2021 13:07:22 +0000 (13:07 +0000)]
[gn build] Port 21d6636d83b3

3 years ago[gn build] fix bug in fb0b19c3de3b
Nico Weber [Tue, 13 Apr 2021 13:06:11 +0000 (09:06 -0400)]
[gn build] fix bug in fb0b19c3de3b

Since __config is no longer in the concatenated generated __config_site,
it now needs to be copied.

(Also fix a comment typo while here.)

3 years ago[lldb] Require x86 for various NativePDB, Breakpad and Minidump tests
David Spickett [Fri, 9 Apr 2021 13:19:20 +0000 (13:19 +0000)]
[lldb] Require x86 for various NativePDB, Breakpad and Minidump tests

These tests fail if you build without the x86 llvm backend.
Either because they use an x86 triple or try to backtrace which
requires some x86 knowledge to see all frames.

Reviewed By: labath

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

3 years agoReland "[lldb] [Process] Watch for fork/vfork notifications" for Linux
Michał Górny [Tue, 13 Apr 2021 12:37:56 +0000 (14:37 +0200)]
Reland "[lldb] [Process] Watch for fork/vfork notifications" for Linux

Big thanks to Pavel Labath for figuring out my mistake.

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

3 years agoReland "[lldb] [Process] Watch for fork/vfork notifications" for NetBSD
Michał Górny [Tue, 13 Apr 2021 11:59:05 +0000 (13:59 +0200)]
Reland "[lldb] [Process] Watch for fork/vfork notifications" for NetBSD

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

3 years ago[libc++] Move pointer safety related utilities out of <memory>
Louis Dionne [Fri, 9 Apr 2021 19:57:21 +0000 (15:57 -0400)]
[libc++] Move pointer safety related utilities out of <memory>

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

3 years ago[libc++] Split std::shared_ptr & friends out of <memory>
Louis Dionne [Fri, 9 Apr 2021 19:16:14 +0000 (15:16 -0400)]
[libc++] Split std::shared_ptr & friends out of <memory>

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

3 years ago[libc++] Split std::unique_ptr out of <memory>
Louis Dionne [Fri, 9 Apr 2021 19:00:57 +0000 (15:00 -0400)]
[libc++] Split std::unique_ptr out of <memory>

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

3 years ago[libc++] Split the memory-related algorithms out of <memory>
Louis Dionne [Fri, 9 Apr 2021 18:47:46 +0000 (14:47 -0400)]
[libc++] Split the memory-related algorithms out of <memory>

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

3 years ago[libc++] Split std::raw_storage_iterator out of <memory>
Louis Dionne [Fri, 9 Apr 2021 18:45:18 +0000 (14:45 -0400)]
[libc++] Split std::raw_storage_iterator out of <memory>

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

3 years ago[libc++] Split __compressed_pair out of <memory>
Louis Dionne [Fri, 9 Apr 2021 18:43:01 +0000 (14:43 -0400)]
[libc++] Split __compressed_pair out of <memory>

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

3 years agoReland "[lldb] [Process] Watch for fork/vfork notifications" for FreeBSD
Michał Górny [Tue, 13 Apr 2021 10:21:24 +0000 (12:21 +0200)]
Reland "[lldb] [Process] Watch for fork/vfork notifications" for FreeBSD

The original commit was reverted because of the problems it introduced
on Linux.  However, FreeBSD should not be affected, so restore that part
and we will address Linux separately.

While at it, remove the dbreg hack as the underlying issue has been
fixed in the FreeBSD kernel and the problem is unlikely to happen
in real life use anyway.

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

3 years ago[flang][driver] Remove `%flang-new` from the LIT configuration
Andrzej Warzynski [Fri, 9 Apr 2021 10:32:31 +0000 (10:32 +0000)]
[flang][driver] Remove `%flang-new` from the LIT configuration

`%flang-new` was introduced in the early days of the new driver to make
a clear distinction between the tests for the current and the new
driver. We have since introduced `%flang` (compiler driver) and
`%flang_fc1` (frontend driver) as the long term solution. This has allowed
us to share tests between `flang-new` and `f18`. This patch replaces
all uses of `%flang-new` with `%flang` and `%flang_fc1`.

Some tests are reformatted so that all tests look uniform and are easier
to follow. Where possible, `! REQUIRES: new-flang-driver` is deleted so
that more tests can be shared with `f18`. To facilitate this,
`f{no-}implicit-none` are introduced in `f18` with semantics identical
to `flang-new`.

Two tests are deleted rather than updated:
  * flang/test/Frontend/print-preprocess-C-file.f90
  * flang/test/Frontend/print-preprocessed-file.f90
Instead, there is plenty of preprocessor tests in
flang/test/Preprocessing/.

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

3 years agoRequire commas between double square bracket attributes.
Aaron Ballman [Tue, 13 Apr 2021 10:40:42 +0000 (06:40 -0400)]
Require commas between double square bracket attributes.

Clang currently has a bug where it allows you to write [[foo bar]] and
both attributes are silently accepted. This patch corrects the comma
parsing rules for such attributes and handles the test case fallout, as
a few tests were accidentally doing this.

3 years ago[mlir] Canonicalize single-iteration ParallelOp
Butygin [Sat, 10 Apr 2021 16:38:11 +0000 (19:38 +0300)]
[mlir] Canonicalize single-iteration ParallelOp

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

3 years ago[Windows Itanium][PS4] handle dllimport/export w.r.t vtables/rtti
Ben Dunbobbin [Tue, 13 Apr 2021 01:18:12 +0000 (02:18 +0100)]
[Windows Itanium][PS4] handle dllimport/export w.r.t vtables/rtti

The existing Windows Itanium patches for dllimport/export
behaviour w.r.t vtables/rtti can't be adopted for PS4 due to
backwards compatibility reasons (see comments on
https://reviews.llvm.org/D90299).

This commit adds our PS4 scheme for this to Clang.

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

3 years ago[lldb] [gdb-remote server] Refactor handling qSupported
Michał Górny [Thu, 8 Apr 2021 21:15:38 +0000 (23:15 +0200)]
[lldb] [gdb-remote server] Refactor handling qSupported

Refactor handling qSupported to use a virtual HandleFeatures() method.
The client-provided features are split into an array and passed
to the method.  The method returns an array of server features that are
concatenated into the qSupported response to the server.

The base implementation of HandleFeatures()
in GDBRemoteCommunicationServerCommon now includes only flags common
to both platform server and llgs, while llgs-specific flags are inserted
in GDBRemoteCommunicationServerLLGS.

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

3 years ago[flang] Fix a test (use %s instead of $s)
Andrzej Warzynski [Mon, 12 Apr 2021 12:32:57 +0000 (12:32 +0000)]
[flang] Fix a test (use %s instead of $s)

With the typo ($S instead of %s), the driver was expecting
input from stdin. In such cases, it prints:
```
Enter Fortran source
Use EOF character (^D) to end file
```
This was piped to FileCheck. Together with the available `CHECK-NOT`
statement, this was sufficient for the test to pass (incorrectly).

This patch makes sure that the provided input file is used instead of
stdin.

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

3 years ago[AArch64][SVE] Fix dup/dupq intrinsics for C++.
Sander de Smalen [Tue, 13 Apr 2021 08:28:52 +0000 (09:28 +0100)]
[AArch64][SVE] Fix dup/dupq intrinsics for C++.

This patch changes the builtin prototype to use 'b' (boolean) instead
of the default integer element type. That fixes the dup/dupq intrinsics
when compiling with C++.

This patch also fixes one of the defines for __ARM_FEATURE_SVE2_BITPERM.

Reviewed By: kmclaughlin

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

3 years ago[CodeView] Fix the ARM64 CPUType enum
Martin Storsjö [Mon, 12 Apr 2021 11:46:36 +0000 (14:46 +0300)]
[CodeView] Fix the ARM64 CPUType enum

The old, incorrect one seems to have been added in
d41ac895bb810d0b15844773cbecbf394d914010, with a similarly placed
entry added in EnumTables.cpp in
eb4d6142dcd53d79d8f8a86908a035582965fc52.

This matches the value documented at
https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cpu-type-e?view=vs-2019.

This fixes running obj2yaml on an object file generated by MSVC.

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

3 years ago[SimplifyCFG] Allow hoisting terminators only with HoistCommonInsts=false.
Florian Hahn [Tue, 13 Apr 2021 07:24:24 +0000 (08:24 +0100)]
[SimplifyCFG] Allow hoisting terminators only with HoistCommonInsts=false.

As a side-effect of the change to default HoistCommonInsts to false
early in the pipeline, we fail to convert conditional branch & phis to
selects early on, which prevents vectorization for loops that contain
conditional branches that effectively are selects (or if the loop gets
vectorized, it will get vectorized very inefficiently).

This patch updates SimplifyCFG to perform hoisting if the only
instruction in both BBs is an equal branch. In this case, the only
additional instructions are selects for phis, which should be cheap.

Even though we perform hoisting, the benefits of this kind of hoisting
should by far outweigh the negatives.

For example, the loop in the code below will not get vectorized on
AArch64 with the current default, but will with the patch. This is a
fundamental pattern we should definitely vectorize. Besides that, I
think the select variants should be easier to use for reasoning across
other passes as well.

https://clang.godbolt.org/z/sbjd8Wshx

```
double clamp(double v) {
  if (v < 0.0)
    return 0.0;
  if (v > 6.0)
    return 6.0;
  return v;
}

void loop(double* X, double *Y) {
  for (unsigned i = 0; i < 20000; i++) {
    X[i] = clamp(Y[i]);
  }
}
```

Reviewed By: lebedev.ri

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

3 years ago[OpenCL][NFC] Rename isOpenCLVersionContainedInMask
Sven van Haastregt [Tue, 13 Apr 2021 09:27:37 +0000 (10:27 +0100)]
[OpenCL][NFC] Rename isOpenCLVersionContainedInMask

Drop the double occurrence of "is".

3 years agoRevert "Revert "[clangd] Provide a way to disable external index""
Kadir Cetinkaya [Tue, 13 Apr 2021 08:26:03 +0000 (10:26 +0200)]
Revert "Revert "[clangd] Provide a way to disable external index""

This reverts commit c2ad7c23707cece995ee9070283a72c4afc8c0fe while
adding the handling for the new enum value into the switch statement.

3 years ago[lldb] [gdb-remote client] Refactor handling qSupported
Michał Górny [Thu, 8 Apr 2021 22:18:09 +0000 (00:18 +0200)]
[lldb] [gdb-remote client] Refactor handling qSupported

Refactor the qSupported handler to split the reply into an array,
and identify features within the array rather than searching the string
for partial matches.  While at it, use StringRef.split() to process
the compression list instead of reinventing the wheel.

Switch the arguments to MaybeEnableCompression() to use an ArrayRef
of StringRefs to simplify parameter passing from GetRemoteQSupported().

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

3 years ago[mlir][linalg] lower index operations during linalg to loop lowering.
Tobias Gysi [Tue, 13 Apr 2021 08:37:40 +0000 (08:37 +0000)]
[mlir][linalg] lower index operations during linalg to loop lowering.

The patch extends the linalg to loop lowering pass to replace all linalg index operations by the induction variables of the generated loop nests.

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

3 years agoRevert "[lldb] [Process] Watch for fork/vfork notifications" and associated followups
Pavel Labath [Tue, 13 Apr 2021 08:55:56 +0000 (10:55 +0200)]
Revert "[lldb] [Process] Watch for fork/vfork notifications" and associated followups

This commit has caused the following tests to be flaky:
TestThreadSpecificBpPlusCondition.py
TestExitDuringExpression.py

The exact cause is not known yet, but since both tests deal with
threads, my guess is it has something to do with the tracking of
creation of new threads (which the commit touches upon).

This reverts the following commits:
d01bff8cbdc98fb8751f7bf10af19b47ae5c445d,
ba62ebc48e8c424ce3a78ba01acda679d536dd47,
e761b6b4c58d4f7ae1073d925d7cb321d68ee93a,
a345419ee03095c8cdfbe1c2728467c4da8fa0a4.

3 years ago[lldb] Require x86 for unwind no-return test
David Spickett [Fri, 9 Apr 2021 13:23:26 +0000 (13:23 +0000)]
[lldb] Require x86 for unwind no-return test

The core file used is built for i386 so we
need the x86 backend to be able to load it.

Reviewed By: labath

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

3 years ago[lldb][Arm/AArch64] Add basic disassemble tests for Arm/AArch64
David Spickett [Fri, 9 Apr 2021 13:11:31 +0000 (13:11 +0000)]
[lldb][Arm/AArch64] Add basic disassemble tests for Arm/AArch64

Previously the test would fail if you built on Arm/AArch64
but did not have the x86 llvm backend enabled.

Reviewed By: omjavaid

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

3 years ago[lldb] Require x86 backend for a bunch of DWARF tests
David Spickett [Fri, 9 Apr 2021 13:14:31 +0000 (13:14 +0000)]
[lldb] Require x86 backend for a bunch of DWARF tests

By moving them into a folder with a local lit config
requiring x86. All these tests use x86 target triples.

There are two tests that require target-x86_64 because
they run program files (instead of just needing the backend).
Those are moved to the x86 folder also but their REQUIRES are
unchanged.

Reviewed By: JDevlieghere

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

3 years ago[libc++] Fix test synopses and remove unused includes.
Marek Kurdej [Tue, 13 Apr 2021 08:32:16 +0000 (10:32 +0200)]
[libc++] Fix test synopses and remove unused includes.

3 years ago[M68k] Implement AsmParser
Ricky Taylor [Thu, 11 Mar 2021 20:37:57 +0000 (20:37 +0000)]
[M68k] Implement AsmParser

This is a work-in-progress implementation of an assembler for M68k.

Outstanding work:
- Updating existing tests assembly syntax
- Writing new tests for the assembler (and disassembler)

I've left those until there's consensus that this approach is okay (I hope that's okay!).

Questions I'm aware of:
- Should this use Motorola or gas syntax? (At the moment it uses Motorola syntax.)
- The disassembler produces a table at runtime for disassembly generated from the code beads. Is this okay? (This is less than ideal but as I mentioned in my llvm-dev post, it's quite complicated to write a table-gen parser for code beads.)

Depends on D98519

Depends on D98532

Depends on D98534

Depends on D98535

Depends on D98536

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

3 years ago[NFC][SYCL] Drop idle triple component from regression tests.
Alexey Bader [Tue, 13 Apr 2021 05:00:21 +0000 (08:00 +0300)]
[NFC][SYCL] Drop idle triple component from regression tests.

3 years ago[lldb] Replace NativeProcess delegate list with a single delegate
Pavel Labath [Tue, 13 Apr 2021 07:25:37 +0000 (09:25 +0200)]
[lldb] Replace NativeProcess delegate list with a single delegate

In all this time, we've never used more than one delegate. The logic to
support multiple delegates is therefore untested, and becomes
particularly unwieldy once we need to support multiple processes.

Just remove it.

3 years ago[MLIR][LinAlg] Implement detensoring cost-modelling.
KareemErgawy-TomTom [Tue, 13 Apr 2021 06:26:12 +0000 (08:26 +0200)]
[MLIR][LinAlg] Implement detensoring cost-modelling.

This patch introduces the neccessary infrastructure changes to implement
cost-modelling for detensoring. In particular, it introduces the
following changes:
- An extension to the dialect conversion framework to selectively
convert sub-set of non-entry BB arguments.
- An extension to branch conversion pattern to selectively convert
sub-set of a branche's operands.
- An interface for detensoring cost-modelling.
- 2 simple implementations of 2 different cost models.

This sets the stage to explose cost-modelling for detessoring in an
easier way. We still need to come up with better cost models.

Reviewed By: silvas

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

3 years ago[WebAssembly] Test i64x2.abs encoding
Thomas Lively [Tue, 13 Apr 2021 07:06:25 +0000 (00:06 -0700)]
[WebAssembly] Test i64x2.abs encoding

This test was disabled despite the instruction having been implemented for a
long time. This commit just enables the test.

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

3 years ago[RISCV] Rename RISCVISD::SHFLI to RISCVISD::SHFL and don't require the second operand...
Craig Topper [Tue, 13 Apr 2021 06:27:44 +0000 (23:27 -0700)]
[RISCV] Rename RISCVISD::SHFLI to RISCVISD::SHFL and don't require the second operand to be an immediate.

Prep work for adding intrinsics in the future.

Left an assert that the input is constant in ReplaceNodeResults,
as the intrinsic shouldn't go through that path.

3 years ago[compiler-rt][X86] fix build fail after "[X86] Support -march=rocketlake"
Freddy Ye [Tue, 13 Apr 2021 06:33:08 +0000 (14:33 +0800)]
[compiler-rt][X86] fix build fail after "[X86] Support -march=rocketlake"
This copy error will cause a failed builder on sanitizer-x86_64-linux

3 years ago[libcxx][NFC] tweaks `incrementable_traits` per review
Christopher Di Bella [Tue, 13 Apr 2021 05:15:10 +0000 (05:15 +0000)]
[libcxx][NFC] tweaks `incrementable_traits` per review

One suggestion was missed and is being patched now.

3 years ago[libcxx] adds `std::incrementable_traits` to <iterator>
Christopher Di Bella [Tue, 23 Mar 2021 03:55:52 +0000 (03:55 +0000)]
[libcxx] adds `std::incrementable_traits` to <iterator>

Implements parts of:
    - P0896R4 The One Ranges Proposal

Depends on D99041

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

3 years ago[lldb] Fix replaying TestMemoryRead.py from reproducer
Jonas Devlieghere [Tue, 13 Apr 2021 04:09:58 +0000 (21:09 -0700)]
[lldb] Fix replaying TestMemoryRead.py from reproducer

Remap the external file to the one embedded in the reproducer.

3 years agoRevert "Reapply "[DebugInfo] Use variadic debug values to salvage BinOps and GEP...
Amy Huang [Tue, 13 Apr 2021 03:02:41 +0000 (20:02 -0700)]
Revert "Reapply "[DebugInfo] Use variadic debug values to salvage BinOps and GEP instrs with non-const operands""

This change causes an assert / segmentation fault in LTO builds.

This reverts commit f2e4f3eff3c9135d92840016f8ed4540cdd1313b.

3 years ago[GreedyRA ORE] Add debug location for function level report
Serguei Katkov [Fri, 9 Apr 2021 08:39:55 +0000 (15:39 +0700)]
[GreedyRA ORE] Add debug location for function level report

Reviewers: reames, MatzeB, anemet, thegameg
Reviewed By: thegameg
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D100168

3 years ago[PowerPC] stop reverse mem op generation for some cases.
Chen Zheng [Tue, 13 Apr 2021 01:28:31 +0000 (21:28 -0400)]
[PowerPC] stop reverse mem op generation for some cases.

We should consider the feeder user number when we do reverse memory
operation transformation. Otherwise, we may get negative impact.

Reviewed By: nemanjai

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

3 years ago[NARY][NFC] Use hasNUsesOrMore instead of getNumUses since it's more
Evgeniy Brevnov [Tue, 13 Apr 2021 01:22:35 +0000 (08:22 +0700)]
[NARY][NFC] Use hasNUsesOrMore instead of getNumUses since it's more
efficient.

3 years ago[mlir] Async: add automatic reference counting at async.runtime operations level
Eugene Zhulenev [Mon, 12 Apr 2021 17:48:02 +0000 (10:48 -0700)]
[mlir] Async: add automatic reference counting at async.runtime operations level

Depends On D95311

Previous automatic-ref-counting pass worked with high level async operations (e.g. async.execute), however async values reference counting is a runtime implementation detail.

New pass mostly relies on the save liveness analysis to place drop_ref operations, and does better verification of CFG with different liveIn sets in block successors.

This is almost NFC change. No new reference counting ideas, just a cleanup of the previous version.

Reviewed By: mehdi_amini

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

3 years ago[X86] Support -march=rocketlake
Freddy Ye [Tue, 13 Apr 2021 01:24:34 +0000 (09:24 +0800)]
[X86] Support -march=rocketlake

Reviewed By: skan, craig.topper, MaskRay

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

3 years ago[MLIR] Add a switch operation to the standard dialect
Geoffrey Martin-Noble [Tue, 13 Apr 2021 00:01:30 +0000 (17:01 -0700)]
[MLIR] Add a switch operation to the standard dialect

This is similar to the definition of llvm.switch, providing
unstructured branch-based control flow. It differs from the LLVM
operation in that it accepts any signless integer (not only an i32),
takes no branch weights (the same as the Branch and CondBranch ops),
and has a slightly different syntax for the default case that includes
it in the list of cases with an explicit `default` keyword.

Also included are several canonicalizers.

See https://llvm.discourse.group/t/rfc-add-std-switch-and-scf-switch/3090

Reviewed By: rriddle, bondhugula

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

3 years ago[gn build] Port e96df3e531f5
LLVM GN Syncbot [Tue, 13 Apr 2021 01:35:58 +0000 (01:35 +0000)]
[gn build] Port e96df3e531f5

3 years ago[lldb] Disable TestLaunchProcessPosixSpawn.py with reproducers
Jonas Devlieghere [Tue, 13 Apr 2021 01:31:37 +0000 (18:31 -0700)]
[lldb] Disable TestLaunchProcessPosixSpawn.py with reproducers

3 years ago[Passes] Add relative lookup table converter pass
Gulfem Savrun Yeniceri [Tue, 29 Dec 2020 21:32:13 +0000 (21:32 +0000)]
[Passes] Add relative lookup table converter pass

Lookup tables generate non PIC-friendly code, which requires dynamic relocation as described in:
https://bugs.llvm.org/show_bug.cgi?id=45244

This patch adds a new pass that converts lookup tables to relative lookup tables to make them PIC-friendly.

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

3 years ago[mlir] Use MCJIT to fix integration tests
Emilio Cota [Tue, 13 Apr 2021 01:20:02 +0000 (18:20 -0700)]
[mlir] Use MCJIT to fix integration tests

Since c42c67ad ('Re-apply "[lli] Make -jit-kind=orc the default JIT
engine"'), ORC is the default JIT. Unfortunately, ORC seems to
ignore the --entry-function flag, which breaks all tests that
use the flag, namely the AMX and X86Vector integration tests.
This has been reported in PR#49906
(https://bugs.llvm.org/show_bug.cgi?id=49906).

Work around this by explicitly selecting MCJIT.

Reviewed By: aartbik

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

3 years agoRevert "[lldb] [gdb-remote client] Refactor handling qSupported"
Ahmed Bougacha [Tue, 13 Apr 2021 01:03:54 +0000 (18:03 -0700)]
Revert "[lldb] [gdb-remote client] Refactor handling qSupported"

This reverts commit 3842de49f6551f597b4c7c78caa8ba7003755cec.

It fails to build, with errors such as:
  GDBRemoteCommunicationClient.cpp:1005:20:
  error: no viable overloaded '='
          avail_name = compression;

3 years ago[JumpThreading] merge debug info when merging select+br
Nick Desaulniers [Tue, 13 Apr 2021 00:51:16 +0000 (17:51 -0700)]
[JumpThreading] merge debug info when merging select+br

Jump threading can replace select then unconditional branch with
conditional branch, but when doing so loses debug info.

This destructive transform is eventually leading to a failed Verifier
run during full LTO builds of the Linux kernel with CFI and KCOV
enabled, as reported in PR39531.

ModuleSanitizerCoveragePass will insert calls to
__sanitizer_cov_trace_pc, and sometimes split critical edges,
using whatever debug info may or may not exist for the branch for
the added libcall. Since we can inline calls to
__sanitizer_cov_trace_pc due to LTO, this can lead to the error
observed in PR39531 when the debug info isn't propagated to
the libcall, because of prior destructive transforms that failed to
retain debug info.

Reviewed By: dblaikie

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

3 years ago[compiler-rt][aarch64] Add PAC-RET/BTI property to hwasan_interceptors_vfork.S
Pirama Arumuga Nainar [Tue, 13 Apr 2021 00:13:27 +0000 (17:13 -0700)]
[compiler-rt][aarch64] Add PAC-RET/BTI property to hwasan_interceptors_vfork.S

D100143 added similar annotations but missed this file.

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

3 years ago[Evaluator] Look through invariant.group intrinsics
Arthur Eubanks [Thu, 18 Mar 2021 04:26:26 +0000 (21:26 -0700)]
[Evaluator] Look through invariant.group intrinsics

Turning on -fstrict-vtable-pointers in Chrome caused an extra global
initializer. Turns out that a llvm.strip.invariant.group intrinsic was
causing GlobalOpt to fail to step through some simple code.

We can treat *.invariant.group uses as simply their operand.
Value::stripPointerCastsForAliasAnalysis() does exactly this. This
should be safe because the Evaluator does not skip memory accesses due
to invariants or alias analysis.

However, we don't want to leak that we've stripped arbitrary pointer
casts to users of Evaluator, so we bail out if we evaluate a function to
any constant, since we may have looked through *.invariant.group calls
and aliasing pointers cannot be arbitrarily substituted.

Reviewed By: rnk

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

3 years ago[SantizerCoverage] handle missing DBG MD when inserting libcalls
Nick Desaulniers [Mon, 12 Apr 2021 22:55:53 +0000 (15:55 -0700)]
[SantizerCoverage] handle missing DBG MD when inserting libcalls

Instruction::getDebugLoc can return an invalid DebugLoc. For such cases
where metadata was accidentally removed from the libcall insertion
point, simply insert a DILocation with line 0 scoped to the caller. When
we can inline the libcall, such as during LTO, then we won't fail a
Verifier check that all calls to functions with debug metadata
themselves must have debug metadata.

Reviewed By: dblaikie

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

3 years ago[clang-tidy] Add <utility> include to misc-uniqueptr-reset-release
Nathan James [Mon, 12 Apr 2021 22:32:12 +0000 (23:32 +0100)]
[clang-tidy] Add <utility> include to misc-uniqueptr-reset-release

This is the only remaining check that creates `std::move` includes but doesn't add a `<utility>` include.

Reviewed By: aaron.ballman

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

3 years ago[lldb] [gdb-remote client] Refactor handling qSupported
Michał Górny [Thu, 8 Apr 2021 22:18:09 +0000 (00:18 +0200)]
[lldb] [gdb-remote client] Refactor handling qSupported

Refactor the qSupported handler to split the reply into an array,
and identify features within the array rather than searching the string
for partial matches.  While at it, use StringRef.split() to process
the compression list instead of reinventing the wheel.

Switch the arguments to MaybeEnableCompression() to use an ArrayRef
of StringRefs to simplify parameter passing from GetRemoteQSupported().

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

3 years agoReland "Revert "[InstCombine] when calling conventions are compatible, don't convert...
Yuanfang Chen [Mon, 12 Apr 2021 21:16:25 +0000 (14:16 -0700)]
Reland "Revert "[InstCombine] when calling conventions are compatible, don't convert the call to undef idiom""

This reverts commit a3fabc79ae9d7dd76545b2abc2a3bfb66c6d3175 (relands
f4d682d6ce6c5b3a41a0acf297507c82f5c21eef with fix for the compile-time
regression issue).

3 years agoRevert "[clangd] Provide a way to disable external index"
Sterling Augustine [Mon, 12 Apr 2021 21:17:49 +0000 (14:17 -0700)]
Revert "[clangd] Provide a way to disable external index"

This reverts commit 63bc9e443502ab6def2dec0b5ffe64a522f801cc.

This breaks llvm-project/clang-tools-extra/clangd/tool/ClangdMain.cpp:570:11:

with error: enumeration value 'None' not handled in switch [-Werror,-Wswitch]

3 years ago[PhaseOrdering] Add test for SimplifyCFG and LV interaction.
Florian Hahn [Mon, 12 Apr 2021 19:05:39 +0000 (20:05 +0100)]
[PhaseOrdering] Add test for SimplifyCFG and LV interaction.

3 years ago[SimplifyCFG] Add test requiring only hoisting a branch.
Florian Hahn [Mon, 12 Apr 2021 16:58:59 +0000 (17:58 +0100)]
[SimplifyCFG] Add test requiring only hoisting a branch.

3 years ago[ARM] Fix -Wmissing-field-initializers
Fangrui Song [Mon, 12 Apr 2021 21:28:23 +0000 (14:28 -0700)]
[ARM] Fix -Wmissing-field-initializers

3 years ago[mlir][spirv] Fix runtime array stride when emulating bitwidth
Lei Zhang [Mon, 12 Apr 2021 21:08:22 +0000 (17:08 -0400)]
[mlir][spirv] Fix runtime array stride when emulating bitwidth

The stride should be calculated with the converted array element
type, not the original input type.

Reviewed By: mravishankar

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

3 years agoFix up build failures after cfce5b26a888cb979d65252275df1f977dc1e6c8
Jian Cai [Mon, 12 Apr 2021 20:54:13 +0000 (13:54 -0700)]
Fix up build failures after cfce5b26a888cb979d65252275df1f977dc1e6c8

Build log: https://lab.llvm.org/buildbot/#/builders/37/builds/3538

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

3 years ago[mlir][spirv] Allow bitwidth emulation on runtime arrays
Lei Zhang [Mon, 12 Apr 2021 20:50:24 +0000 (16:50 -0400)]
[mlir][spirv] Allow bitwidth emulation on runtime arrays

Runtime arrays are converted from memrefs with unknown
dimensions.

Reviewed By: mravishankar

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

3 years agoRevert "[InstCombine] when calling conventions are compatible, don't convert the...
Nikita Popov [Mon, 12 Apr 2021 20:54:26 +0000 (22:54 +0200)]
Revert "[InstCombine] when calling conventions are compatible, don't convert the call to undef idiom"

This reverts commit f4d682d6ce6c5b3a41a0acf297507c82f5c21eef.

This caused a significant compile-time regression:
https://llvm-compile-time-tracker.com/compare.php?from=4b7bad9eaea2233521a94f6b096aaa88dc584e23&to=f4d682d6ce6c5b3a41a0acf297507c82f5c21eef&stat=instructions

Possibly this is due to overeager parsing of target triples.

3 years ago[mlir] Move memref.subview patterns to MemRef/Transforms/
Lei Zhang [Mon, 12 Apr 2021 20:38:04 +0000 (16:38 -0400)]
[mlir] Move memref.subview patterns to MemRef/Transforms/

These patterns have been used as a prerequisite step for lowering
to SPIR-V. But they don't involve SPIR-V dialect ops; they are
pure memref/vector op transformations. Given now we have a dedicated
MemRef dialect, moving them to Memref/Transforms/, which is a more
suitable place to host them, to allow used by others.

This commit just moves code around and renames patterns/passes
accordingly. CMakeLists.txt for existing MemRef libraries are
also improved along the way.

Reviewed By: mravishankar

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

3 years ago[TSan] Allow test contents to be copied before execution
Julian Lettner [Sat, 10 Apr 2021 01:02:39 +0000 (18:02 -0700)]
[TSan] Allow test contents to be copied before execution

Allow test contents to be copied before execution by using
`%ld_flags_rpath_so`, `%ld_flags_rpath_exe`, and `%dynamiclib`
substitutions.

rdar://76302416

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

3 years ago[InstCombine] fold shift+trunc signbit check
Sanjay Patel [Mon, 12 Apr 2021 20:16:19 +0000 (16:16 -0400)]
[InstCombine] fold shift+trunc signbit check

https://alive2.llvm.org/ce/z/6vQvrP

This solves:
https://llvm.org/PR49866

3 years ago[InstCombine] add tests for shift+trunc signbit check; NFC
Sanjay Patel [Mon, 12 Apr 2021 20:00:50 +0000 (16:00 -0400)]
[InstCombine] add tests for shift+trunc signbit check; NFC

3 years ago[clang-rename] Handle designated initializers.
Daniele Castagna [Mon, 12 Apr 2021 20:15:14 +0000 (13:15 -0700)]
[clang-rename] Handle designated initializers.

clang Tooling, and more specifically Refactoring/Rename, have support
code to extract source locations given a Unified Symbol Resolution set.
This support code is used by clang-rename and other tools that might not
be in the tree.

Currently field designated initializer are not supported.
So, renaming S::a to S::b in this code:

  S s = { .a = 10 };

will not extract the field designated initializer for a (the 'a' after the
dot).

This patch adds support for field designated initialized to
RecursiveSymbolVisitor and RenameLocFinder that is used in
createRenameAtomicChanges.

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

3 years ago[lldb] Disable Shell/Subporcess with reproducers
Jonas Devlieghere [Mon, 12 Apr 2021 18:25:24 +0000 (11:25 -0700)]
[lldb] Disable Shell/Subporcess with reproducers

3 years ago[flang] Correct TypeCode::IsLogical()
peter klausler [Mon, 12 Apr 2021 17:10:38 +0000 (10:10 -0700)]
[flang] Correct TypeCode::IsLogical()

F18 is using the type codes for C's "least" int types to encode
the various kinds of Fortran's LOGICAL intrinsic type; update
the IsLogical() predicate accordingly.  (This member function
isn't yet used anywhere, so this patch is nearly an NFC.)

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

3 years ago[libc++] add `inline` for __open's definition in ifstream and ofstream
jasonliu [Mon, 12 Apr 2021 19:22:12 +0000 (19:22 +0000)]
[libc++] add `inline` for __open's definition in ifstream and ofstream

Summary:

When building with gcc on AIX, it seems that gcc does not like the
`always_inline` without the `inline` keyword.
So adding the inline keywords in for __open in ifstream and ofstream.
That will also make it consistent with __open in basic_filebuf
(it seems we added `inline` there before for gcc build as well).

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

3 years ago[mlir][spirv] Put debug-only variable in LLVM_DEBUG
Lei Zhang [Mon, 12 Apr 2021 19:09:49 +0000 (15:09 -0400)]
[mlir][spirv] Put debug-only variable in LLVM_DEBUG

This avoids paying the cost when building in release.

Reviewed By: hanchung

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

3 years ago[ARM] support symbolic expression as immediate in memory instructions
Jian Cai [Mon, 12 Apr 2021 19:00:01 +0000 (12:00 -0700)]
[ARM] support symbolic expression as immediate in memory instructions

Currently the ARM backend only accpets constant expressions as the
immediate operand in load and store instructions. This allows the
result of symbolic expressions to be used in memory instructions. For
example,

0:
.space 2048
strb r2, [r0, #(.-0b)]

would be assembled into the following instructions.

strb r2, [r0, #2048]

This only adds support to ldr, ldrb, str, and strb in arm mode to
address the build failure of Linux kernel for now, but should facilitate
adding support to similar instructions in the future if the need arises.

Link:
https://github.com/ClangBuiltLinux/linux/issues/1329

Reviewed By: peter.smith, nickdesaulniers

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

3 years ago[PassManager][PhaseOrdering] lower expects before running simplifyCFG
Sanjay Patel [Mon, 12 Apr 2021 18:51:51 +0000 (14:51 -0400)]
[PassManager][PhaseOrdering] lower expects before running simplifyCFG

Retry of 330619a3a623 that includes a clang test update.

Original commit message:

If we run passes before lowering llvm.expect intrinsics to metadata,
then those passes have no way to act on the hints provided by llvm.expect.
SimplifyCFG is the known offender, and we made it smarter about profile
metadata in D98898 <https://reviews.llvm.org/D98898>.

In the motivating example from https://llvm.org/PR49336 , this means we
were ignoring the recommended method for a programmer to tell the compiler
that a compare+branch is expensive. This change appears to solve that case -
the metadata survives to the backend, the compare order is as expected in IR,
and the backend does not do anything to reverse it.

We make the same change to the old pass manager to keep things synchronized.

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

3 years agoEnable creation of large response file on z/OS
Sean Perry [Mon, 12 Apr 2021 19:03:27 +0000 (15:03 -0400)]
Enable creation of large response file on z/OS

Most text processing commands (eg. grep, awk) have a maximum line length limit on z/OS.  The current method of using cc -E & grep fails on z/OS because of this limit.  I'm changing the command to create the long line in the response file to use python.  This avoids the possibility of any tools blocking the generation of the large response file.  This also eliminates the need for the extra file.

Reviewed By: abhina.sreeskantharajan

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

3 years ago[NewPM] Fix -print-changed when a -filter-print-funcs function is removed
Arthur Eubanks [Fri, 9 Apr 2021 21:13:29 +0000 (14:13 -0700)]
[NewPM] Fix -print-changed when a -filter-print-funcs function is removed

-filter-print-funcs -print-changed was crashing after the filter func
was removed by a pass with
  Assertion failed: After.find("*** IR Dump") == 0 && "Unexpected banner format."
We weren't printing the banner because when we have -filter-print-funcs,
we print each function separately, letting the print function filter out
unwanted functions.

Reviewed By: jamieschmeiser

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

3 years ago[AIX] Tweak test XFAIL from D99815
David Tenty [Mon, 12 Apr 2021 18:47:42 +0000 (14:47 -0400)]
[AIX] Tweak test XFAIL from D99815

the test fails on AIX host, not necessarily just the target.

3 years ago[compiler-rt] add SANITIZER_OSX
Emily Shi [Fri, 9 Apr 2021 00:49:22 +0000 (17:49 -0700)]
[compiler-rt] add SANITIZER_OSX

This will allow us to make osx specific changes easier. Because apple silicon macs also run on aarch64, it was easy to confuse it with iOS.

rdar://75302812

Reviewed By: yln

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

3 years ago[mlir][affine] Fix unfolded bounding maps for affine.for
eopXD [Mon, 12 Apr 2021 12:22:58 +0000 (17:52 +0530)]
[mlir][affine] Fix unfolded bounding maps for affine.for

Loop bounds of affine.for didn't perform foldings like affine.load, affine.store.
Bound maps shall be more composed, leaving most affine.apply become dead.

This resolves the bug listed on https://bugs.llvm.org/show_bug.cgi?id=45203

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

3 years agoFix documentation typo.
Richard Smith [Mon, 12 Apr 2021 18:39:08 +0000 (11:39 -0700)]
Fix documentation typo.

3 years ago[libc++] Move checks for newlib to actually work
Mara Sophie Grosch [Mon, 12 Apr 2021 18:19:51 +0000 (14:19 -0400)]
[libc++] Move checks for newlib to actually work

The checks did not work in __config, since no header defining
`_NEWLIB_VERSION` was included before. This patch moves the two
checks for newlib to the headers that actually need it - and after
they already include relevant headers.

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

3 years agoRevert "[PassManager][PhaseOrdering] lower expects before running simplifyCFG"
Sanjay Patel [Mon, 12 Apr 2021 17:58:01 +0000 (13:58 -0400)]
Revert "[PassManager][PhaseOrdering] lower expects before running simplifyCFG"

This reverts commit 330619a3a623d623944c58ebc06cbb83ac0e58af.
There are clang tests that also need to be updated.

3 years ago[Inliner] Propagate SROA analysis through invariant group intrinsics
Arthur Eubanks [Sat, 10 Apr 2021 18:59:04 +0000 (11:59 -0700)]
[Inliner] Propagate SROA analysis through invariant group intrinsics

SROA can handle invariant group intrinsics, let the inliner know that
for better heuristics when the intrinsics are present.

This fixes size issues in a couple files when turning on
-fstrict-vtable-pointers in Chrome.

Reviewed By: rnk, mtrofin

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

3 years agoReplace uses of std::iterator with explicit using
Hamza Sood [Mon, 12 Apr 2021 17:47:14 +0000 (10:47 -0700)]
Replace uses of std::iterator with explicit using

This patch removes all uses of `std::iterator`, which was deprecated in C++17.
While this isn't currently an issue while compiling LLVM, it's useful for those using LLVM as a library.

For some reason there're a few places that were seemingly able to use `std` functions unqualified, which no longer works after this patch. I've updated those places, but I'm not really sure why it worked in the first place.

Reviewed By: MaskRay

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

3 years ago[RISCV] Support vector SET[U]LT and SET[U]GE with splatted immediates
Fraser Cormack [Thu, 8 Apr 2021 10:22:46 +0000 (11:22 +0100)]
[RISCV] Support vector SET[U]LT and SET[U]GE with splatted immediates

This patch adds more optimized codegen for the above SETCC forms,
by matching the '.vi' vector forms when the immediate is a 5-bit signed
immediate plus 1. The immediate can be decremented and the corresponding
SET[U]LE or SET[U]GT forms can be matched.

This work was left as a TODO from D94168.

Reviewed By: craig.topper

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

3 years ago[MLIR] PresburgerSet emptiness check: remove assertions that there are no symbols
Arjun P [Mon, 12 Apr 2021 17:31:15 +0000 (23:01 +0530)]
[MLIR] PresburgerSet emptiness check: remove assertions that there are no symbols

Symbols are now supported in the integer emptiness check. Remove some outdated assertions checking that there are no symbols.

Reviewed By: ftynse

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

3 years ago[mlir] introduce "encoding" attribute to tensor type
Aart Bik [Mon, 12 Apr 2021 16:28:41 +0000 (09:28 -0700)]
[mlir] introduce "encoding" attribute to tensor type

This CL introduces a generic attribute (called "encoding") on tensors.
The attribute currently does not carry any concrete information, but the type
system already correctly determines that tensor<8xi1,123> != tensor<8xi1,321>.
The attribute will be given meaning through an interface in subsequent CLs.

See ongoing discussion on discourse:

[RFC] Introduce a sparse tensor type to core MLIR
https://llvm.discourse.group/t/rfc-introduce-a-sparse-tensor-type-to-core-mlir/2944

A sparse tensor will look something like this:

```
// named alias with all properties we hold dear:
#CSR = {
  // individual named attributes
}

// actual sparse tensor type:
tensor<?x?xf64, #CSR>
```

I see the following rough 5 step plan going forward:

(1) introduce this format attribute in this CL, currently still empty
(2) introduce attribute interface that gives it "meaning", focused on sparse in first phase
(3) rewrite sparse compiler to use new type, remove linalg interface and "glue"
(4) teach passes to deal with new attribute, by rejecting/asserting on non-empty attribute as simplest solution, or doing meaningful rewrite in the longer run
(5) add FE support, document, test, publicize new features, extend "format" meaning to other domains if useful

Reviewed By: stellaraccident, bondhugula

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

3 years ago[mlir] Rename AVX512 dialect to X86Vector
Emilio Cota [Mon, 12 Apr 2021 17:15:35 +0000 (19:15 +0200)]
[mlir] Rename AVX512 dialect to X86Vector

We will soon be adding non-AVX512 operations to MLIR, such as AVX's rsqrt. In https://reviews.llvm.org/D99818 several possibilities were discussed, namely to (1) add non-AVX512 ops to the AVX512 dialect, (2) add more dialects (e.g. AVX dialect for AVX rsqrt), and (3) expand the scope of the AVX512 to include these SIMD x86 ops, thereby renaming the dialect to something more accurate such as X86Vector.

Consensus was reached on option (3), which this patch implements.

Reviewed By: aartbik, ftynse, nicolasvasilache

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

3 years ago[mlir][Linalg] Disable const -> linalg.generic when fused op is illegal.
MaheshRavishankar [Mon, 12 Apr 2021 15:49:45 +0000 (08:49 -0700)]
[mlir][Linalg] Disable const -> linalg.generic when fused op is illegal.

Fusing a constant with a linalg.generic operation can result in the
fused operation being illegal since the loop bound computation
fails. Avoid such fusions.

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