platform/upstream/llvm.git
2 years ago[mlir][NFC] Properly include PassDetail.h for FoldSubViewOpsPass
River Riddle [Tue, 8 Mar 2022 08:03:27 +0000 (00:03 -0800)]
[mlir][NFC] Properly include PassDetail.h for FoldSubViewOpsPass

2 years ago[mlir][NFC] Remove dead forward declaration of FuncOp
River Riddle [Tue, 8 Mar 2022 08:01:41 +0000 (00:01 -0800)]
[mlir][NFC] Remove dead forward declaration of FuncOp

2 years ago[mlir][Bazel] Adjust regarding StandardToLLVM -> FuncToLLVM rename.
Adrian Kuegel [Tue, 8 Mar 2022 07:55:55 +0000 (08:55 +0100)]
[mlir][Bazel] Adjust regarding StandardToLLVM -> FuncToLLVM rename.

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

2 years agoRevert "[CMake][compiler-rt] Make CRT separately buildable"
Petr Hosek [Tue, 8 Mar 2022 07:59:29 +0000 (23:59 -0800)]
Revert "[CMake][compiler-rt] Make CRT separately buildable"

This reverts commit ed28461e2716fda004f4f55654ef33bc8c78f203 since
it broke the VE bot.

2 years ago[NewPM][Inliner] Make inlined calls to functions in same SCC as callee exponentially...
Arthur Eubanks [Mon, 7 Mar 2022 18:17:09 +0000 (10:17 -0800)]
[NewPM][Inliner] Make inlined calls to functions in same SCC as callee exponentially expensive

Introduce a new attribute "function-inline-cost-multiplier" which
multiplies the inline cost of a call site (or all calls to a callee) by
the multiplier.

When processing the list of calls created by inlining, check each call
to see if the new call's callee is in the same SCC as the original
callee. If so, set the "function-inline-cost-multiplier" attribute of
the new call site to double the original call site's attribute value.
This does not happen when the original call site is intra-SCC.

This is an alternative to D120584, which marks the call sites as
noinline.

Hopefully fixes PR45253.

Reviewed By: davidxl

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

2 years ago[MLIR][OpDSL] Silence warning (NFC)
Lorenzo Chelini [Tue, 8 Mar 2022 07:30:20 +0000 (08:30 +0100)]
[MLIR][OpDSL] Silence warning (NFC)

2 years ago[AMDGPU] Set noclobber metadata on loads instead of cast to constant
Stanislav Mekhanoshin [Mon, 7 Mar 2022 23:53:16 +0000 (15:53 -0800)]
[AMDGPU] Set noclobber metadata on loads instead of cast to constant

A load via pointer cast to constant will return true from
pointsToConstantMemory which is not necessarily so.

Fixes: SWDEV-326463

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

2 years ago[CMake][compiler-rt] Make CRT separately buildable
Petr Hosek [Mon, 28 Feb 2022 20:21:11 +0000 (12:21 -0800)]
[CMake][compiler-rt] Make CRT separately buildable

This is useful when building a complete toolchain to ensure that CRT
is built after builtins but before the rest of the compiler-rt.

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

2 years ago[CSKY] Enable TargetAsmStreamer/ELFStreamer and support asm directive of csky_attribute
Zi Xuan Wu [Mon, 7 Mar 2022 10:28:13 +0000 (18:28 +0800)]
[CSKY] Enable TargetAsmStreamer/ELFStreamer and support asm directive of csky_attribute

Add support of parsing .csky_attribute directive and emit related target attributes in .csky.attribute section.
It does not emit attribute directive in assembly code, so only emit target attributes in ELF streamer.
In ELF streamer, it handles the header EFlag and the csky_attribute section which contains some attribute items.
The EFlag and attribute items are calculated from feature bits based on Subtarget.

2 years agoReland "[clang][debug] port clang-cl /JMC flag to ELF"
Yuanfang Chen [Mon, 7 Mar 2022 20:42:09 +0000 (12:42 -0800)]
Reland "[clang][debug] port clang-cl /JMC flag to ELF"

This relands commit 731347431976509823e38329a96fcbc69fe98cd2.

It failed on Windows/Mac because `-fjmc` is only checked for ELF targets.
Check the flag unconditionally instead and issue a warning for non-ELF targets.

2 years ago[flang] Remove unused variable in Allocatable.cpp
Valentin Clement [Tue, 8 Mar 2022 05:51:10 +0000 (06:51 +0100)]
[flang] Remove unused variable in Allocatable.cpp

Fix for buildbot failure: https://lab.llvm.org/buildbot/#/builders/180/builds/3532

2 years ago[OpenMP][FIX] Ensure flag to disable de-globalization works properly
Johannes Doerfert [Fri, 25 Feb 2022 00:50:37 +0000 (18:50 -0600)]
[OpenMP][FIX] Ensure flag to disable de-globalization works properly

If the user disables de-globalization we did not seed the AAHeapToShared
and AAHeapToStack but we still could end up with them through in-flight
lookups. With this patch we disable AAHeapToShared completely if the
user disabled de-globalization. Heap-2-stack is still run though.

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

2 years ago[OpenMP][CUDA] Use one event pool per device
Johannes Doerfert [Fri, 18 Feb 2022 17:49:00 +0000 (11:49 -0600)]
[OpenMP][CUDA] Use one event pool per device

An event pool, similar to the stream pool, needs to be kept per device.
For one, events are associated with cuda contexts which means we cannot
destroy the former after the latter. Also, CUDA documentation states
streams and events need to be associated with the same context, which
we did not ensure at all.

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

2 years ago[OpenMP] Allow to explicitly deinitialize device resources
Johannes Doerfert [Thu, 17 Feb 2022 22:04:12 +0000 (16:04 -0600)]
[OpenMP] Allow to explicitly deinitialize device resources

There are two problems this patch tries to address:
1) We currently free resources in a random order wrt. plugin and
   libomptarget destruction. This patch should ensure the CUDA plugin
   is less fragile if something during the deinitialization goes wrong.
2) We need to support (hard) pause runtime calls eventually. This patch
   allows us to free all associated resources, though we cannot
   reinitialize the device yet.

Follow up patch will associate one event pool per device/context.

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

2 years ago[OpenMP][NFCI] Use RAII lock guards in libomptarget where possible
Johannes Doerfert [Wed, 2 Mar 2022 19:34:24 +0000 (13:34 -0600)]
[OpenMP][NFCI] Use RAII lock guards in libomptarget where possible

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

2 years agoNFC. Improve isInnermostAffineForOp - drop unnecessary check
Uday Bondhugula [Mon, 7 Mar 2022 23:42:54 +0000 (05:12 +0530)]
NFC. Improve isInnermostAffineForOp - drop unnecessary check

Rewrite isInnermostAffineForOp utility to make it more direct/efficient.
Drop unnecessary check. NFC.

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

2 years ago[RISCV] Share PatFprFpr classes for F, D, and Zfh
Shao-Ce SUN [Tue, 8 Mar 2022 04:43:33 +0000 (12:43 +0800)]
[RISCV] Share PatFprFpr classes for F, D, and Zfh

Inspired by D115469

Reviewed By: craig.topper

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

2 years ago[ORC][JITLink] Fix MachO absolute symbol handling, add test case.
Lang Hames [Tue, 8 Mar 2022 04:37:33 +0000 (20:37 -0800)]
[ORC][JITLink] Fix MachO absolute symbol handling, add test case.

This patch removes the unintended resolution of locally scoped absolute symbols
(which was causing unexpected definition errors).

It stops using the JITSymbolFlags::Absolute flag (it isn't set or used elsewhere,
and causes mismatch-flags asserts), and adds JITSymbolFlags::Exported to default
scoped absolute symbols.

Finally, we now set the scope of absolute symbols correctly in
MachOLinkGraphBuilder.

2 years agoAMDGPU: Skip folding REG_SEQUENCE if found unknown regclasses for its users
Christudasan Devadasan [Wed, 2 Mar 2022 06:46:29 +0000 (12:16 +0530)]
AMDGPU: Skip folding REG_SEQUENCE if found unknown regclasses for its users

Use TII::getRegClass to return a valid regclass or a nullptr
if the RC is unknown for a given OpIdx. This fixes a potential
crash occurred while getting the RC from a variadic instruction.

Reviewed By: arsenm

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

2 years ago[X86] Add helper enum for ternary intrinsics
Phoebe Wang [Tue, 8 Mar 2022 03:18:41 +0000 (11:18 +0800)]
[X86] Add helper enum for ternary intrinsics

Reviewed By: RKSimon, LuoYuanke

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

2 years ago[SLP] Extract a helper for buildvector [nfc]
Philip Reames [Tue, 8 Mar 2022 03:11:32 +0000 (19:11 -0800)]
[SLP] Extract a helper for buildvector [nfc]

2 years ago[clang][dataflow] Fix nullptr dereferencing error.
Yitzhak Mandelbaum [Mon, 7 Mar 2022 21:16:28 +0000 (21:16 +0000)]
[clang][dataflow] Fix nullptr dereferencing error.

When pre-initializing fields in the environment, the code assumed that all
fields of a struct would be initialized. However, given limits on value
construction, that assumption is incorrect. This patch changes the code to drop
that assumption and thereby avoid dereferencing a nullptr.

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

2 years ago[RISCV] Add patterns for vector widening floating-point reduction instructions.
jacquesguan [Wed, 23 Feb 2022 07:30:10 +0000 (15:30 +0800)]
[RISCV] Add patterns for vector widening floating-point reduction instructions.

Add patterns for vector widening floating-point reduction instructions.

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

2 years ago[SLP] Fix spelling in a lambda name [NFC]
Philip Reames [Tue, 8 Mar 2022 02:52:51 +0000 (18:52 -0800)]
[SLP] Fix spelling in a lambda name [NFC]

2 years ago[BOLT][CMAKE] Remove CMake 3.13.4 incompatible parameter
Amir Ayupov [Tue, 8 Mar 2022 02:41:12 +0000 (18:41 -0800)]
[BOLT][CMAKE] Remove CMake 3.13.4 incompatible parameter

Remove `TYPE BIN` parameter that is introduced in CMake 3.14 and revert back to
the equivalent compatible form `DESTINATION ${CMAKE_INSTALL_BINDIR}`.

Addresses https://github.com/llvm/llvm-project/issues/54099

Reviewed By: rafauler

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

2 years agoChange "target.save-jit-objects" to "target.save-jit-objects-dir".
Jim Ingham [Tue, 8 Mar 2022 00:38:52 +0000 (16:38 -0800)]
Change "target.save-jit-objects" to "target.save-jit-objects-dir".
The old command wrote to CWD, which doesn't always work, and if it
didn't, there was no workaround (and it crashed on failure).  This
patch changed the setting to provide a directory to save the objects
to.

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

2 years ago[libcxx][AIX] Remove `LIBCXX-AIX-FIXME` in isalwayslockfree check after 86478c7ad8a7
Kai Luo [Tue, 8 Mar 2022 01:23:23 +0000 (01:23 +0000)]
[libcxx][AIX] Remove `LIBCXX-AIX-FIXME` in isalwayslockfree check after 86478c7ad8a7

The workaround has been removed via https://reviews.llvm.org/D119931, checks passed on AIX-32.

Reviewed By: ldionne, daltenty, jsji, #libc

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

2 years ago[flang] Fix module file missing USE for shadowed derived type
Peter Klausler [Fri, 25 Feb 2022 21:54:44 +0000 (13:54 -0800)]
[flang] Fix module file missing USE for shadowed derived type

When a module uses a derived type that is shadowed by a generic
interface, the module file was missing a USE statement for the
name.  Detect and handle this situation.

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

2 years ago[clang] Fix OpenMP critical hint parameter check
Peixin-Qiao [Tue, 8 Mar 2022 01:04:31 +0000 (09:04 +0800)]
[clang] Fix OpenMP critical hint parameter check

The paramemter of hint clause in OpenMP critical hint should be
non-negative. The omp_lock_hint_none is 0 in omp.h.

Reviewed By: Alexey Bataev

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

2 years ago[mlir][sparse][taco] Split the evaluate method into compile and compute.
Bixia Zheng [Mon, 7 Mar 2022 03:34:40 +0000 (19:34 -0800)]
[mlir][sparse][taco] Split the evaluate method into compile and compute.

This is to align with the PyTACO API better.

Modify an existing unit test to test the new routines.

Reviewed By: aartbik

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

2 years agoAdd JSON output option to llvm-remark-size-diff
Jessica Paquette [Mon, 7 Mar 2022 23:33:12 +0000 (15:33 -0800)]
Add JSON output option to llvm-remark-size-diff

This adds JSON output to llvm-remark-size-diff.

The goal here is to make it easy for external tools to consume output from
llvm-remark-size-diff. These tools could be used for automated size analysis.
(E.g. in CI).

To specify JSON output, use `--report_style=json`. JSON output can be
pretty-printed via `--pretty`.

With automation in mind, the schema looks like this:

```
"Files": {
  "A": <filename_a>
  "B": <filename_b>
},

"InBoth": [
   {
    "FunctionName": <function name>,
    "InstCount": [
       <count_in_a>,
       <count_in_b>
     ],
    "StackSize": [
       <count_in_a>,
       <count_in_b>
     ]
   },
   ...
]

"OnlyInA": [
   {
    "FunctionName": <function name>,
    "InstCount": [
       <count_in_a>,
       0
     ],
    "StackSize": [
       <count_in_a>,
       0
     ]
   },
   ...
]

"OnlyInB": [
    {
    "FunctionName": <function name>,
    "InstCount": [
       0,
       <count_in_b>
     ],
    "StackSize": [
       0,
       <count_in_b>
     ]
   },
   ...
]
```

A few notes:

- Filenames are included, because tools may want to combine many outputs
  together in some way (a big JSON file, a big CSV, or something.)

- Counts are represented as [a, b] so that a diff can be calculated via b - a.
  The original counts may be useful for size analysis (e.g. was this function
  extremely large before?) and so both are preserved.

- `OnlyInA` and `OnlyInB` have a 0 for one of the counts always. This is to
  make it easier for tools to share code between `OnlyInA`, `OnlyInB`, and
  `InBoth`.

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

2 years ago[WebAssembly] Add new target feature in support of 'extended-const' proposal
Sam Clegg [Mon, 7 Mar 2022 20:52:23 +0000 (12:52 -0800)]
[WebAssembly] Add new target feature in support of 'extended-const' proposal

We don't yet do anything when this feature is enabled, this change
just lays the ground work by accepting that there is such a feature.

See https://github.com/WebAssembly/extended-const

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

2 years ago[flang] Make uninitialized allocatable components explicitly NULL() in structure...
Peter Klausler [Mon, 28 Feb 2022 18:24:58 +0000 (10:24 -0800)]
[flang] Make uninitialized allocatable components explicitly NULL() in structure constructors

When a structure constructor does not initialize an allocatable component,
ensure that the typed expression representation contains an explicit
NULL() for the component.  Expression semantics already copies default
initialized expressions for nonallocatable components into structure
constructors.  This change is expected to simplify lowering.

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

2 years ago[NFC] Cleanup StandardInstrumentations
Arthur Eubanks [Tue, 8 Mar 2022 00:24:36 +0000 (16:24 -0800)]
[NFC] Cleanup StandardInstrumentations

2 years agoRevert "[libc++] Remove extension to support allocator<const T>"
Louis Dionne [Mon, 7 Mar 2022 22:34:17 +0000 (17:34 -0500)]
Revert "[libc++] Remove extension to support allocator<const T>"

This reverts commit bed3240bf7d196a17cc31f1c5b59b4721017e638.

I will need to add more tests for std::shared_ptr<T const> before
re-landing this.

2 years ago[AMDGPU] Add gfx10 assembler directive to specify shared VGPR count
Jacob Lambert [Fri, 7 Jan 2022 21:29:15 +0000 (13:29 -0800)]
[AMDGPU] Add gfx10 assembler directive to specify shared VGPR count

Reviewed By: rampitec

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

2 years agoRe-land [lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash
Jez Ng [Mon, 7 Mar 2022 21:34:02 +0000 (16:34 -0500)]
Re-land [lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash

Previous attempt was commit 112135e77444e8c8106efa77416af09f4b9a5012 and
reverted in d86d431814c836ec5579fc0b981e86c7fb81f2f2.

2 years ago[flang] Runtime validation of SPREAD(DIM=dim) argument
Peter Klausler [Wed, 23 Feb 2022 22:16:10 +0000 (14:16 -0800)]
[flang] Runtime validation of SPREAD(DIM=dim) argument

Crash when DIM= is not a valid dimension in the result.

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

2 years ago[MLIR][Presburger][NFC] Cleanup PresburgerSet
Groverkss [Mon, 7 Mar 2022 21:31:24 +0000 (03:01 +0530)]
[MLIR][Presburger][NFC] Cleanup PresburgerSet

This patch cleans up the interface to PresburgerSet. At a high level it does
the following changes:

  - Move member functions around to have constructors at top and print/dump
    at end.
  - Move a private function to be a static function instead.
  - Change member functions of type "getAllIntegerPolyhedron" to "getAllPolys"
    instead.
  - Improve documentation for PresburgerSet.

Reviewed By: arjunp

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

2 years ago[flang] Use faster path for default formatted character input
Peter Klausler [Wed, 23 Feb 2022 19:45:21 +0000 (11:45 -0800)]
[flang] Use faster path for default formatted character input

Rather than reading default character variables in formatted
input one byte at a time via NextInField(), skip and read
them via blocks of available buffer data.  This eliminates
a bottleneck that affected reads of large character values.
(It also exposed a problem with sequential reads with RECL=
set on the OPEN statement, so that's fixed too.)

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

2 years ago[OpenMP][libomp] Fix register constraint for tpause and umwait
Jonathan Peyton [Mon, 7 Mar 2022 20:54:07 +0000 (14:54 -0600)]
[OpenMP][libomp] Fix register constraint for tpause and umwait

Register constraint switched to "=q" which means very specifically (from
https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints)

> Any register accessible as rl. In 32-bit mode, a, b, c, and d; in 64-bit
mode, any integer register.

Older gcc versions (8.x and below) were trying to use esi or edi for the
8 bit flag variable, but it wound up displaying this error in the end:

kmp_lock.cpp: In function ‘void __kmp_spin_backoff(kmp_backoff_t*)’:
kmp_lock.cpp:2684:1: error: unsupported size for integer register
Hence the correct restriction is "=q" instead of "=r".

Fixes: https://github.com/llvm/llvm-project/issues/53309
Differential Revision: https://reviews.llvm.org/D120519

2 years ago[mlir][Vector] Add patterns to reorder elementwise ops and broadcast/transpose ops.
Hanhan Wang [Mon, 7 Mar 2022 20:52:03 +0000 (12:52 -0800)]
[mlir][Vector] Add patterns to reorder elementwise ops and broadcast/transpose ops.

In quantized comutation, there are casting ops around computation ops.
Reorder the ops to make reduce-to-contract actually work.

Reviewed By: ThomasRaoux

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

2 years ago[flang] Lower allocate and deallocate statements
Valentin Clement [Mon, 7 Mar 2022 20:22:28 +0000 (21:22 +0100)]
[flang] Lower allocate and deallocate statements

This patch add the lowering for the allocate
and the deallocate statements.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years ago[libc++] Make common_iterator's proxy types into aggregates.
Arthur O'Dwyer [Mon, 7 Mar 2022 16:46:06 +0000 (11:46 -0500)]
[libc++] Make common_iterator's proxy types into aggregates.

Saves one move in each case, which is basically nothing perf-wise;
this is more about simplifying the code.

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

2 years ago[sancov] Don't instrument calls to bitcast funcs: they're not indirect.
Ahmed Bougacha [Mon, 7 Mar 2022 20:43:37 +0000 (12:43 -0800)]
[sancov] Don't instrument calls to bitcast funcs: they're not indirect.

Currently, when instrumenting indirect calls, this uses
CallBase::getCalledFunction to determine whether a given callsite is
eligible.

However, that returns null if:
  this is an indirect function invocation or the function signature
  does not match the call signature.

So, we end up instrumenting direct calls where the callee is a bitcast
ConstantExpr, even though we presumably don't need to.

Use isIndirectCall to ignore those funky direct calls.

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

2 years agoRevert "[clang][debug] port clang-cl /JMC flag to ELF"
Yuanfang Chen [Mon, 7 Mar 2022 20:40:15 +0000 (12:40 -0800)]
Revert "[clang][debug] port clang-cl /JMC flag to ELF"

This reverts commit 731347431976509823e38329a96fcbc69fe98cd2.

Break bots:
http://45.33.8.238/win/54551/step_7.txt
http://45.33.8.238/macm1/29590/step_7.txt

2 years ago[libcxxabi] Fix cmake order dependency wrt dllexporting
Martin Storsjö [Mon, 7 Mar 2022 18:32:52 +0000 (13:32 -0500)]
[libcxxabi] Fix cmake order dependency wrt dllexporting

If LIBCXX_ENABLE_SHARED isn't explicitly set on the cmake command
line, isn't set in the cache, and the libcxxabi project is configured
before libcxx, then LIBCXX_ENABLE_SHARED isn't defined yet. Once
the libcxx cmake project has been parsed, LIBCXX_ENABLE_SHARED would
have been set to its default value of ON.

This makes sure that the symbols are properly dllexported in such
a configuration scenario.

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

2 years ago[libc++] Remove extension to support allocator<const T>
Louis Dionne [Fri, 4 Mar 2022 14:54:29 +0000 (09:54 -0500)]
[libc++] Remove extension to support allocator<const T>

This extension is a portability trap for users, since no other standard
library supports it. Furthermore, the Standard explicitly allows
implementations to reject std::allocator<cv T>, so allowing it is
really going against the current.

This was discovered in D120684: this extension required `const_cast`ing
in `__construct_range_forward`, a fishy bit of code that can be removed
if we don't support the extension anymore.

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

2 years ago[AMDGPU] new gfx940 fp atomics
Stanislav Mekhanoshin [Thu, 3 Mar 2022 21:14:42 +0000 (13:14 -0800)]
[AMDGPU] new gfx940 fp atomics

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

2 years ago[flang] Make per-argument intrinsic error messages more localized
Peter Klausler [Wed, 23 Feb 2022 00:59:48 +0000 (16:59 -0800)]
[flang] Make per-argument intrinsic error messages more localized

A recent patch made it possible to emit more localized error messages
pertaining to actual arguments in non-intrinsic procedure references.
Use these new powers for good and make intrinsic error messages more
precise, too.

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

2 years ago[x86] reduce code duplication for select of X86ISD::CMP; NFC
Sanjay Patel [Mon, 7 Mar 2022 19:42:39 +0000 (14:42 -0500)]
[x86] reduce code duplication for select of X86ISD::CMP; NFC

2 years ago[x86] add tests for mask+cmp; NFC
Sanjay Patel [Mon, 7 Mar 2022 18:39:09 +0000 (13:39 -0500)]
[x86] add tests for mask+cmp; NFC

2 years ago[x86] remove unnecessary decorations in test file; NFC
Sanjay Patel [Mon, 7 Mar 2022 17:26:16 +0000 (12:26 -0500)]
[x86] remove unnecessary decorations in test file; NFC

2 years ago[lldb] Format g_color_tokens as a table (NFC)
Jonas Devlieghere [Mon, 7 Mar 2022 20:12:49 +0000 (12:12 -0800)]
[lldb] Format g_color_tokens as a table (NFC)

This makes editing the table easier and mistakes more obvious.

2 years ago[lldb] Support "bright" ANSI colors
Jonas Devlieghere [Mon, 7 Mar 2022 20:09:22 +0000 (12:09 -0800)]
[lldb] Support "bright" ANSI colors

Support ANSI escape codes for bright colors variants. Most modern
terminals support them. LLDB is not using them in any of its defaults,
but they're useful for people who want to modify their preferred ANSI
prefix/suffix.

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

2 years ago[AMDGPU] Add v_mov_b64 gfx940 opcode
Stanislav Mekhanoshin [Fri, 4 Mar 2022 19:49:34 +0000 (11:49 -0800)]
[AMDGPU] Add v_mov_b64 gfx940 opcode

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

2 years ago[IVDescriptors] Bail out instead of asserting that order is expected.
Florian Hahn [Mon, 7 Mar 2022 19:57:26 +0000 (19:57 +0000)]
[IVDescriptors] Bail out instead of asserting that order is expected.

When dealing with multiple phis that depend on each other, the order
might have been changed and may not match the expectation. If that
happens, bail out, rather than asserting.

Fixes https://github.com/llvm/llvm-project/issues/54218
Fixes https://github.com/llvm/llvm-project/issues/54233
Fixes https://github.com/llvm/llvm-project/issues/54254

2 years ago[Hexagon] Handle v2f16 in build_vector in isel
Krzysztof Parzyszek [Mon, 7 Mar 2022 19:27:41 +0000 (11:27 -0800)]
[Hexagon] Handle v2f16 in build_vector in isel

2 years ago[AMDGPU] gfx940 uses new names for coherency bits
Stanislav Mekhanoshin [Wed, 2 Mar 2022 23:27:25 +0000 (15:27 -0800)]
[AMDGPU] gfx940 uses new names for coherency bits

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

2 years agoFix buildbots after https://reviews.llvm.org/D120755.
Greg Clayton [Mon, 7 Mar 2022 19:31:21 +0000 (11:31 -0800)]
Fix buildbots after https://reviews.llvm.org/D120755.

This improves this test a lot because before when using the "attachCommands" to run the following commands:

(lldb) target create -d /path/to/a.out
(lldb) process launch

This was racy as it wasn't stopping the program at the entry point, and the process might run to completion before we can even debug it. With the recent changes to the "attachCommands" we were waiting for the process to stop, but the process might be exited already, and that _should_ have caused the attach to fail since there was no process to attach to. By adding "--stop-at-entry" to the process launch, we ensure this should be less racy and give us a valid process to attach to.

2 years ago[libc] Align the stack pointer in the start function.
Siva Chandra Reddy [Mon, 7 Mar 2022 09:00:14 +0000 (09:00 +0000)]
[libc] Align the stack pointer in the start function.

The loader TLS test for x86_64, which now passes, has been enabled.
A future change should enable the test for aarch64 as well.

Reviewed By: jeffbailey

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

2 years ago[flang] Avoid crash case in provenance mapping
Peter Klausler [Fri, 18 Feb 2022 19:15:08 +0000 (11:15 -0800)]
[flang] Avoid crash case in provenance mapping

When a contiguous range of a cooked character stream is being
mapped to a range of source provenance, the code was assuming
that the "end()" position of the input range -- being the character
immediately after the range -- would also follow the range's
source provenance.  This isn't always the case.

Modify the code to work with the true last character of the
input range (at end()-1) and to also cope with cases when that
last position truly maps to an earlier provenance, which can happen
when the prescanner has inserted a space into the cooked character
stream.

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

2 years ago[AMDGPU] Fix uninitialized value after 8d0c34fd4f
Austin Kerbow [Mon, 7 Mar 2022 19:31:12 +0000 (11:31 -0800)]
[AMDGPU] Fix uninitialized value after 8d0c34fd4f

2 years ago[AMDGPU] gfx940: support V_FMAMK_F32 and V_FMAAK_F32
Stanislav Mekhanoshin [Tue, 1 Mar 2022 21:39:57 +0000 (13:39 -0800)]
[AMDGPU] gfx940: support V_FMAMK_F32 and V_FMAAK_F32

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

2 years ago[MTE] Add NT_ANDROID_TYPE_MEMTAG
Mitch Phillips [Thu, 3 Mar 2022 18:48:05 +0000 (10:48 -0800)]
[MTE] Add NT_ANDROID_TYPE_MEMTAG

This ELF note is aarch64 and Android-specific. It specifies to the
dynamic loader that specific work should be scheduled to enable MTE
protection of stack and heap regions.

Current synthesis of the ".note.android.memtag" ELF note is done in the
Android build system. We'd like to move that to the compiler, and this
is the first step.

Reviewed By: MaskRay, jhenderson

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

2 years ago[RISCV] Rename 'SplatOperand' to 'ScalarOperand'. NFC
Craig Topper [Mon, 7 Mar 2022 19:12:17 +0000 (11:12 -0800)]
[RISCV] Rename 'SplatOperand' to 'ScalarOperand'. NFC

vslide1up/down have this flag set, but the value isn't a splat.
Rename for clarity.

Reviewed By: khchen

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

2 years ago[LegalizeTypes][ARM][X86] Change ExpandIntRes_ABS to use sra+xor+sub.
Craig Topper [Sat, 5 Mar 2022 02:53:54 +0000 (18:53 -0800)]
[LegalizeTypes][ARM][X86] Change ExpandIntRes_ABS to use sra+xor+sub.

Previously we used sra+add+xor if ADDCARRY is supported. This changes
to sra+xor+sub is SUBCARRY is available.

This is consistent with the recent change to the default expansion
in LegalizeDAG.

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

2 years ago[mlir][NFC] Remove FuncOp overload of NestedPattern::match
River Riddle [Sat, 5 Mar 2022 03:45:00 +0000 (19:45 -0800)]
[mlir][NFC] Remove FuncOp overload of NestedPattern::match

This method is redundant with the Operation* overload, and is an artifact of when
FuncOp wasn't an operation.

2 years ago[mlir][NFC] Drop a few dead forward declarations of FuncOp
River Riddle [Sat, 5 Mar 2022 03:41:15 +0000 (19:41 -0800)]
[mlir][NFC] Drop a few dead forward declarations of FuncOp

2 years ago[mlir][NFC] Rename StandardToLLVM to FuncToLLVM
River Riddle [Tue, 1 Mar 2022 22:53:41 +0000 (14:53 -0800)]
[mlir][NFC] Rename StandardToLLVM to FuncToLLVM

The current StandardToLLVM conversion patterns only really handle
the Func dialect. The pass itself adds patterns for Arithmetic/CFToLLVM, but
those should be/will be split out in a followup. This commit focuses solely
on being an NFC rename.

Aside from the directory change, the pattern and pass creation API have been renamed:
 * populateStdToLLVMFuncOpConversionPattern -> populateFuncToLLVMFuncOpConversionPattern
 * populateStdToLLVMConversionPatterns -> populateFuncToLLVMConversionPatterns
 * createLowerToLLVMPass -> createConvertFuncToLLVMPass

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

2 years ago[pseudo] Strip comments for TokenStream.
Haojian Wu [Mon, 7 Mar 2022 09:47:38 +0000 (10:47 +0100)]
[pseudo] Strip comments for TokenStream.

Add a utility function to strip comments from a "raw" tokenstream. The
derived stream will be fed to the GLR parser (for early testing).

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

2 years ago[OpenMP] libomp: implemented task priorities.
AndreyChurbanov [Mon, 7 Mar 2022 19:24:18 +0000 (22:24 +0300)]
[OpenMP] libomp: implemented task priorities.

Before this patch task priorities were ignored, that was a valid implementation
as the task priority is a hint according to OpenMP specification.

Implemented shared list of sorted (high -> low) task deques one per task
priority value. Tasks execution changed to first check if priority tasks ready
for execution exist, and these tasks executed before others;
otherwise usual tasks execution mechanics work.

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

2 years ago[libc++][AIX][test] Enable put_double/long_double locale tests
Jinsong Ji [Mon, 7 Mar 2022 19:08:57 +0000 (14:08 -0500)]
[libc++][AIX][test] Enable put_double/long_double locale tests

AIX print -0.0 , inf, nan differently, which are causing the test
failures. We are OK for most other tests.

This patch remove the tests related these limitations conditionally on AIX,
so that we can enable the other tests to avoid losing test coverage.

The general direction is:

```
if strings don't differ between environments, keep the string literal "INF" and the padding, instead of folding them into variables.
```

Reviewed By: ldionne, #libc, Mordante

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

2 years ago[pseudo] empty parameter-declaration should be allowed in lambda declarator.
Haojian Wu [Mon, 7 Mar 2022 09:13:12 +0000 (10:13 +0100)]
[pseudo] empty parameter-declaration should be allowed in lambda declarator.

This was an oversight, as we did a avoild-nullable modication to
parameter-declaration-clause.

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

2 years ago[flang] Add lowering for host association
Valentin Clement [Mon, 7 Mar 2022 18:55:48 +0000 (19:55 +0100)]
[flang] Add lowering for host association

This patches adds the code to handle host association for
inner subroutines and functions.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years agoRevert "[lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash"
Nico Weber [Mon, 7 Mar 2022 18:50:38 +0000 (13:50 -0500)]
Revert "[lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash"

This reverts commit 112135e77444e8c8106efa77416af09f4b9a5012.
Breaks lld/test/MachO/{icf.s,cfstring-dedup.s,invalid/cfstring.s}

2 years ago[flang] Accommodate arrays with a zero-extent dimension in location folding
Peter Klausler [Fri, 18 Feb 2022 22:08:57 +0000 (14:08 -0800)]
[flang] Accommodate arrays with a zero-extent dimension in location folding

The index incrementation code used for FINDLOC, MAXLOC, and MINLOC folding
would crash if the array had a zero extent on the dimension selected with
a DIM= argument since the subscript passed to IncrementSubscripts would
have a value less than the lower bound.  Fix, and add tests.

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

2 years agoRevert "[gn build] (manually) port 0c2b43ab8cb1 (X86MCTests)"
Nico Weber [Mon, 7 Mar 2022 18:43:29 +0000 (13:43 -0500)]
Revert "[gn build] (manually) port 0c2b43ab8cb1 (X86MCTests)"

This reverts commit 336e3677eac3f0ab7af212505723ef5041bacb6c.
0c2b43ab8cb1 was reverted in cf9b3ef941d4b4.

2 years agoRevert "[X86] Fix MCSymbolizer interface for X86Disassembler"
Maksim Panchenko [Mon, 7 Mar 2022 18:40:48 +0000 (10:40 -0800)]
Revert "[X86] Fix MCSymbolizer interface for X86Disassembler"

This reverts commit 0c2b43ab8cb1067dd1c7899094b824890803a7d2.

2 years ago[gn build] (manually) port 0c2b43ab8cb1 (X86MCTests)
Nico Weber [Mon, 7 Mar 2022 18:36:44 +0000 (13:36 -0500)]
[gn build] (manually) port 0c2b43ab8cb1 (X86MCTests)

2 years ago[libc++] [ranges] Fix `decltype(auto) ranges::iter_move`.
Arthur O'Dwyer [Wed, 2 Mar 2022 22:22:55 +0000 (17:22 -0500)]
[libc++] [ranges] Fix `decltype(auto) ranges::iter_move`.

See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92894#c3
https://reviews.llvm.org/D119589#inline-1151299

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

2 years ago[clang-format] Fix namespace end comments in ObjC++ files too
Nico Weber [Mon, 7 Mar 2022 14:42:35 +0000 (09:42 -0500)]
[clang-format] Fix namespace end comments in ObjC++ files too

See also d96ae867351ec.

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

2 years ago[libc++] Overhaul std::quoted; fix its relationship to character traits.
Arthur O'Dwyer [Fri, 4 Mar 2022 23:24:18 +0000 (18:24 -0500)]
[libc++] Overhaul std::quoted; fix its relationship to character traits.

Move `__quoted_output_proxy` into the one file that uses it.

A `const char*` has no associated traits class, so `std::quoted("literal")`
should be printable into any basic_ostream regardless of traits.

Use hidden-friend `operator<<` and `operator>>`, since we're permitted to.
(The exact signature is unspecified because the class itself is unspecified.)

We shouldn't support `std::quoted("literal")` in C++03 or C++11 mode.
(We do need `std::__quoted(s)` and `std::__quoted(cs)` in C++11 mode,
because they're used by `std::__fs::filesystem::path`.)

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

2 years ago[X86] Fix MCSymbolizer interface for X86Disassembler
Maksim Panchenko [Mon, 7 Mar 2022 18:27:28 +0000 (10:27 -0800)]
[X86] Fix MCSymbolizer interface for X86Disassembler

Fix a number of issues with MCSymbolizer::tryAddingSymbolicOperand()
in X86Disassembler:

  * Pass instruction size instead of immediate size.
  * Correctly adjust the value of PC-relative operands.
  * Set operand offset to zero when the operand is specified
    implicitly.

Reviewed By: Amir, skan

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

2 years agoSimplify OpenMP Lambda use
David Blaikie [Mon, 7 Mar 2022 17:56:51 +0000 (17:56 +0000)]
Simplify OpenMP Lambda use

* Use default ref capture for non-escaping lambdas (this makes
  maintenance easier by allowing new uses, removing uses, having
  conditional uses (such as in assertions) not require updates to an
  explicit capture list)
* Simplify addPrivate API not to take a lambda, since it calls it
  unconditionally/immediately anyway - most callers are simply passing
  in a named value or short expression anyway and the lambda syntax just
  adds noise/overhead

Reviewed By: ABataev

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

2 years ago[clang][debug] port clang-cl /JMC flag to ELF
Yuanfang Chen [Mon, 7 Mar 2022 18:15:37 +0000 (10:15 -0800)]
[clang][debug] port clang-cl /JMC flag to ELF

The motivation is to enable the MSVC-style JMC instrumentation usable by a ELF-based
debugger. Since there is no prior experience implementing JMC feature for ELF-based
debugger, it might be better to just reuse existing MSVC-style JMC instrumentation.
For debuggers that support both ELF&COFF (like lldb), the JMC implementation might
be shared between ELF&COFF. If this is found to inadequate, it is pretty low-cost
switching to alternatives.

Implementation:
- The '-fjmc' is already a driver and cc1 flag. Wire it up for ELF in the driver.
- Refactor the JMC instrumentation pass a little bit.
- The ELF handling is different from MSVC in two places:
  * the flag section name is ".just.my.code" instead of ".msvcjmc"
  * the way default function is provided: MSVC uses /alternatename; ELF uses weak function.

Based on D118428.

Reviewed By: rnk

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

2 years ago[mlir][sparse][taco] Add more unit tests.
Bixia Zheng [Fri, 4 Mar 2022 21:25:10 +0000 (13:25 -0800)]
[mlir][sparse][taco] Add more unit tests.

These unit tests resides in an internal repository. Porting the tests to the
public repository.

Reviewed By: aartbik

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

2 years agoRevert "Add CMake option not to build BOLT tests"
Yi Kong [Mon, 7 Mar 2022 18:01:15 +0000 (02:01 +0800)]
Revert "Add CMake option not to build BOLT tests"

This reverts commit d8f4d54664171bac46e6c8446df04850b40cc4f7.

Merged by accident.

2 years agoFix the comment for EnableNoundefAttrs, NFC
Yi Kong [Mon, 7 Mar 2022 17:59:06 +0000 (01:59 +0800)]
Fix the comment for EnableNoundefAttrs, NFC

2 years agoAdd CMake option not to build BOLT tests
Yi Kong [Wed, 2 Mar 2022 16:43:24 +0000 (00:43 +0800)]
Add CMake option not to build BOLT tests

2 years ago[mlir][Vector] Improve default lowering of vector transpose operations
Diego Caballero [Mon, 7 Mar 2022 17:40:21 +0000 (17:40 +0000)]
[mlir][Vector] Improve default lowering of vector transpose operations

The default lowering of vector transpose operations generates a large sequence of
scalar extract/insert operations, one pair for each scalar element in the input tensor.
In other words, the vector transpose is scalarized. However, there are transpose
patterns where one or more adjacent high-order dimensions are not transposed (for
example, in the transpose pattern [1, 0, 2, 3], dimensions 2 and 3 are not transposed).
This patch improves the lowering of those cases by not scalarizing them and extracting/
inserting a full n-D vector, where 'n' is the number of adjacent high-order dimensions
not being transposed. By doing so, we prevent the scalarization of the code and generate a
more performant vector version.

Paradoxically, this patch shouldn't improve the performance of transpose operations if
we are using LLVM. The LLVM pipeline is able to optimize away some of the extract/insert
operations and the SLP vectorizer is converting the scalar operations back to its vector
form. However, scalarizing a vector version of the code in MLIR and relying on the SLP
vectorizer to reconstruct the vector code again is highly undesirable for several reasons.

Reviewed By: nicolasvasilache, ThomasRaoux

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

2 years ago[clang][dataflow] Extend flow conditions from block terminators
Stanislav Gatev [Fri, 4 Mar 2022 11:03:29 +0000 (11:03 +0000)]
[clang][dataflow] Extend flow conditions from block terminators

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D120984

2 years ago[lld-macho][nfc] Reduce size of icfEqClass hash
Jez Ng [Mon, 7 Mar 2022 17:35:49 +0000 (12:35 -0500)]
[lld-macho][nfc] Reduce size of icfEqClass hash

... from a `uint64_t` to a `uint32_t`. (LLD-ELF uses a `uint32_t` too.)

About a 1.7% reduction in peak RSS when linking chromium_framework on my
3.2 GHz 16-Core Intel Xeon W Mac Pro, and no stat sig change in wall
time.

           </Users/jezng/test2.sh ["before"]>  </Users/jezng/test2.sh ["after"]>  difference (95% CI)
  RSS      1003036672.000 ± 9891065.259        985539505.231 ± 10272748.749       [  -2.3% ..   -1.2%]
  samples  27                                  26

             base           diff           difference (95% CI)
  sys_time   1.277 ± 0.023  1.277 ± 0.024  [  -0.9% ..   +0.9%]
  user_time  6.682 ± 0.046  6.598 ± 0.043  [  -1.6% ..   -0.9%]
  wall_time  5.904 ± 0.062  5.895 ± 0.063  [  -0.7% ..   +0.4%]
  samples    46             28

No appreciable change (~0.01%) in number of `equals` comparisons either:

Before:

  ld64.lld: ICF needed 8 iterations
  ld64.lld: equalsConstant() called 701643 times
  ld64.lld: equalsVariable() called 3438526 times

After:

  ld64.lld: ICF needed 8 iterations
  ld64.lld: equalsConstant() called 701729 times
  ld64.lld: equalsVariable() called 3438526 times

Reviewed By: #lld-macho, MaskRay, thakis

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

2 years ago[lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash
Jez Ng [Mon, 7 Mar 2022 08:02:40 +0000 (03:02 -0500)]
[lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash

The existing hashing of stubsHelperIndex has mostly been a no-op* for
some time now (ever since we made ICF run before dylib symbols get their
stubs indices assigned). I guess we could consider hashing the name +
filename of the DylibSymbol instead, but I'm not sure the overhead's
worth it... moreover, LLD/ELF only hashes their Defined symbols as well.

*: Technically it does change the hash value since stubsHelperIndex is
initialized to `UINT32_MAX` by default. But since all stubsHelperIndex
values are the same at when ICF runs, they don't add any useful
information to the hash.

2 years ago[lld-macho][nfc] Rename isec -> referentIsec to avoid shadowing
Jez Ng [Mon, 7 Mar 2022 04:27:35 +0000 (23:27 -0500)]
[lld-macho][nfc] Rename isec -> referentIsec to avoid shadowing

I found the shadowing a bit confusing

2 years ago[lld-macho][nfc] Track # of ICF calls to `equals*` methods
Jez Ng [Mon, 7 Mar 2022 17:35:15 +0000 (12:35 -0500)]
[lld-macho][nfc] Track # of ICF calls to `equals*` methods

This is debug code that is disabled by default. It'll provide a easy way
to figure out the impact (if any) of tweaking ICF's hashing algorithm
(since a poor quality hash will result in many more `equals*` calls).

Reviewed By: #lld-macho, oontvoo

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

2 years ago[lld-macho][nfc] Use llvm::function_ref instead of std::function
Jez Ng [Sat, 5 Mar 2022 01:22:40 +0000 (20:22 -0500)]
[lld-macho][nfc] Use llvm::function_ref instead of std::function

2 years ago[lld-macho][nfc] Remove file statics from ICF.cpp
Jez Ng [Mon, 7 Mar 2022 17:35:12 +0000 (12:35 -0500)]
[lld-macho][nfc] Remove file statics from ICF.cpp

This gets us closer to the [LLD-as-a-library goal][1].

[1]: https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html

Reviewed By: #lld-macho, thakis

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

2 years agoUpdateTestChecks: fix handling of UTC with spaces
Roman Lebedev [Mon, 7 Mar 2022 17:25:09 +0000 (20:25 +0300)]
UpdateTestChecks: fix handling of UTC with spaces

We can't just split by space, that's not going to give us the same
argv we'd have gotten from the shell, it could be in a string,
we must actually parse that as argv.

2 years ago[AArch64] Perform first active true vector combine
zhongyunde [Mon, 7 Mar 2022 16:31:07 +0000 (00:31 +0800)]
[AArch64] Perform first active true vector combine

Materialize : i1 = extract_vector_elt t37, Constant:i64<0>
   ... into: "ptrue p, all" + PTEST
Test bit of lane 0 can use P register directly, and the instruction “pture all”
is loop invariant, which will beneficial to SVE after hoisting out the loop.

Reviewed By: david-arm, paulwalker-arm

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