platform/upstream/llvm.git
22 months agoRevert "[tsan] Keep thread/stack for closed FD"
David Blaikie [Fri, 19 Aug 2022 04:01:42 +0000 (04:01 +0000)]
Revert "[tsan] Keep thread/stack for closed FD"

Test is flaky.

This reverts commit e9c5bde88ea2e35fadb15c5e5a1d2cb583fd0772.

22 months agoSimplify RAV isSameMethod with constexpr if
David Blaikie [Fri, 19 Aug 2022 03:33:01 +0000 (03:33 +0000)]
Simplify RAV isSameMethod with constexpr if

Owing to the large number of instantiations of this function, this small
change has a small but meaningful difference on the total size of
(especially a debug) build of clang at -O0:
```
    FILE SIZE        VM SIZE
 --------------  --------------
  +0.9% +96.9Ki  +0.9% +96.9Ki    .data.rel.ro
  +0.7% +96.7Ki  +0.7% +96.7Ki    .rela.dyn
  +0.0% +18.3Ki  +0.0% +18.3Ki    .rodata
  +0.0%    +324  [ = ]       0    [2 Others]
  -0.2%    -392  -0.2%    -392    .gnu.version
  -0.0%    -441  [ = ]       0    .debug_abbrev
  -0.1%    -980  -0.1%    -980    .gnu.hash
  -0.2% -1.53Ki  -0.2% -1.53Ki    .hash
  -0.2% -4.59Ki  -0.2% -4.59Ki    .dynsym
  -0.1% -10.5Ki  [ = ]       0    .debug_rnglists
  -0.6% -59.0Ki  -0.6% -59.0Ki    .dynstr
  -0.2%  -191Ki  [ = ]       0    .debug_str_offsets
  -3.0%  -233Ki  -3.0%  -233Ki    .eh_frame_hdr
  -0.7%  -244Ki  [ = ]       0    .debug_addr
  -2.9%  -699Ki  [ = ]       0    .symtab
  -0.6%  -884Ki  [ = ]       0    .debug_line
  -3.0%  -932Ki  -3.0%  -932Ki    .eh_frame
  -1.0% -1.48Mi  -1.0% -1.48Mi    .text
  -0.6% -2.75Mi  [ = ]       0    .debug_info
  -7.3% -8.61Mi  [ = ]       0    .strtab
  -7.3% -17.2Mi  [ = ]       0    .debug_str
  -2.4% -33.0Mi  -0.9% -2.47Mi    TOTAL
```

If anyone's got other ideas for how to reduce this further - it's not
especially important, I just came across it while investigating a debug
info size regression, but thought it was interesting enough to poke
around at.

22 months ago[RISCV] Copy SDNodeFlags in lowerToScalableOp.
Craig Topper [Fri, 19 Aug 2022 03:42:59 +0000 (20:42 -0700)]
[RISCV] Copy SDNodeFlags in lowerToScalableOp.

Reviewed By: arcbbb

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

22 months ago[RISCV] Copy SDNodeFlags in doPeepholeMaskedRVV and doPeepholeMergeVVMFold
Craig Topper [Fri, 19 Aug 2022 03:42:45 +0000 (20:42 -0700)]
[RISCV] Copy SDNodeFlags in doPeepholeMaskedRVV and doPeepholeMergeVVMFold

Especially the NoFPExcept flag for FP.

Reviewed By: fakepaper56

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

22 months ago[MLIR][normalize-memrefs] Non-normalizable operations with identity map layouts do...
Tung D. Le [Fri, 19 Aug 2022 02:57:20 +0000 (08:27 +0530)]
[MLIR][normalize-memrefs] Non-normalizable operations with identity map layouts do not block normalization of the entire function

The current approach is convervative in which whenever there is a
non-normalizable operations in a function will the function be labelled
as non-normalizable. It means it requires that all operations must have
MemRefsNormalizable trait.

This patch relaxes the requirement that if the memref map layouts of a
non-normalizable operation are identity, this operation does not block
the normalization of the other operations in the same function.

Reviewed By: bondhugula

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

22 months agoRevert "[cmake] Use `CMAKE_INSTALL_LIBDIR` too"
John Ericson [Fri, 19 Aug 2022 02:44:46 +0000 (22:44 -0400)]
Revert "[cmake] Use `CMAKE_INSTALL_LIBDIR` too"

This reverts commit f7a33090a91015836497c75f173775392ab0304d.

Unfortunately this causes a number of failures that didn't show up in my
local build.

22 months ago[Clang][BPF] Support record argument with direct values
Yonghong Song [Thu, 18 Aug 2022 15:01:45 +0000 (08:01 -0700)]
[Clang][BPF] Support record argument with direct values

Currently, record arguments are always passed by reference by allocating
space for record values in the caller. This is less efficient for
small records which may take one or two registers. For example,
for x86_64 and aarch64, for a record size up to 16 bytes, the record
values can be passed by values directly on the registers.

This patch added BPF support of record argument with direct values
for up to 16 byte record size. If record size is 0, that record
will not take any register, which is the same behavior for x86_64
and aarch64. If the record size is greater than 16 bytes, the
record argument will be passed by reference.

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

22 months ago[DAGCombiner] Add use check for VSCALE in visitSUB.
wanglian [Thu, 18 Aug 2022 09:50:44 +0000 (17:50 +0800)]
[DAGCombiner] Add use check for VSCALE in visitSUB.

Reviewed By: david-arm

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

22 months ago[mlir][affine] Option to unroll cleanup loop if smaller trip count.
lewuathe [Thu, 18 Aug 2022 05:28:38 +0000 (14:28 +0900)]
[mlir][affine] Option to unroll cleanup loop if smaller trip count.

Add an option (cleanUpUnroll) to unroll cleanup loop even if the trip count is smaller the unroll factor.

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

22 months ago[AArch64] Enable AdrpAdd fusion for neoverse-n1
Alexander Shaposhnikov [Fri, 19 Aug 2022 00:13:32 +0000 (00:13 +0000)]
[AArch64] Enable AdrpAdd fusion for neoverse-n1

AdrpAdd fusion is already enabled for "generic" and it helps
the linker apply relocation relaxations for more adrp+add pairs.
This patch enables it for -mtune=neoverse-n1.

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

22 months agoRevert "[BOLT][NFC] Simplify addRelocation"
Amir Ayupov [Fri, 19 Aug 2022 00:26:26 +0000 (17:26 -0700)]
Revert "[BOLT][NFC] Simplify addRelocation"

This reverts commit 29f23013226097a18ce90c48c9435f324956779b.

This change breaks one of the internal tests.

22 months ago[mlir][linalg] Fix tiling interface implementation offset calculation
Thomas Raoux [Thu, 18 Aug 2022 22:39:29 +0000 (22:39 +0000)]
[mlir][linalg] Fix tiling interface implementation offset calculation

The tiling interface implementation was making assumption on the code
generated by makeTiledShape which were wrong. The ExtractSliceOp create
may be combined with other ExtractSliceOp. To solve that we compute
directly the offset using the new utilities.

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

22 months ago[OpenMP][NFC] Refactor code for interop parts of 'init' and 'append_args' clauses
Mike Rice [Thu, 18 Aug 2022 18:54:52 +0000 (11:54 -0700)]
[OpenMP][NFC] Refactor code for interop parts of 'init' and 'append_args' clauses

The 'init' clause allows an interop-modifier of prefer_type(list) and
and interop-types 'target' and 'targetsync'.

The 'append_args' clause uses an append-op that also includes
interop-types ('target' and 'targetsync') and will allow
a prefer_type list in the next OpenMP version.

This change adds a helper struct OMPInteropInfo and uses it in the parsing
of both the 'init' and 'append_args' clauses.

One OMPInteropInfo object represents the info in a single 'init' clause.
Since 'append_args' allows a variable number of interop items it will
require an array of OMPInteropInfo objects once that is supported.

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

22 months ago[AArch64] Add `foldCSELOfCSEL` combine.
Karl Meakin [Fri, 19 Aug 2022 00:02:59 +0000 (01:02 +0100)]
[AArch64] Add `foldCSELOfCSEL` combine.

This time more conservative.

Differential review: https://reviews.llvm.org/D125504

22 months ago[IR] Use Min behavior for module flag "PIC Level"
Fangrui Song [Thu, 18 Aug 2022 23:28:55 +0000 (16:28 -0700)]
[IR] Use Min behavior for module flag "PIC Level"

Using Max for both "PIC Level" and "PIE Level" is inconsistent. PIC imposes less
restriction while PIE imposes more restriction. The result generally
picks the more restrictive behavior: Min for PIC.

This choice matches `ld -r`: a non-pic object and a pic object merge into a
result which should be treated as non-pic.

To allow linking "PIC Level" using Error/Max from old bitcode files, upgrade
Error/Max to Min.

Reviewed By: tejohnson

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

22 months ago[RISCV] Change how mtune aliases are implemented.
Craig Topper [Thu, 18 Aug 2022 21:39:37 +0000 (14:39 -0700)]
[RISCV] Change how mtune aliases are implemented.

The previous implementation translated from names like sifive-7-series
to sifive-7-rv32 or sifive-7-rv64. This also required sifive-7-rv32
and sifive-7-rv64 to be valid CPU names. As those are not real
CPUs it doesn't make sense to accept them in -mcpu.

This patch does away with the translation and adds sifive-7-series
directly to RISCV.td. Removing sifive-7-rv32 and sifive-7-rv64.
sifive-7-series is only allowed in -mtune.

I've also added "rocket" to RISCV.td but have not removed rocket-rv32
or rocket-rv64.

To prevent -mcpu=sifive-7-series or -mcpu=rocket being used with llc,
I've added a Feature32Bit to all rv32 CPUs. And made it an error to
have an rv32 triple without Feature32Bit. sifive-7-series and rocket
do not have Feature32Bit or Feature64Bit set so the user would need
to provide -mattr=+32bit or -mattr=+64bit along with the -mcpu to
avoid the error.

SiFive no longer names their newer products with 3, 5, or 7 series.
Instead we have p200 series, x200 series, p500 series, and p600 series.
Following the previous behavior would require a sifive-p500-rv32 and
sifive-p500-rv64 in order to support -mtune=sifive-p500-series. There
is currently no p500 product, but it could start getting confusing if
there was in the future.

I'm open to hearing alternatives for how to achieve my main goal
of removing sifive-7-rv32/rv64 as a CPU name.

Reviewed By: reames

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

22 months ago[compiler-rt] Clean up explicit -std=c++17 addition
Shoaib Meenai [Thu, 18 Aug 2022 22:51:14 +0000 (15:51 -0700)]
[compiler-rt] Clean up explicit -std=c++17 addition

This was superseded by 5737f6a527d782e6577e5cc1e0c743df2c98546a. Clean
it up as suggested by Mike Hommey in https://reviews.llvm.org/D131937.

22 months ago[flang][runtime] Catch input error case of missing integer value
Peter Klausler [Sun, 14 Aug 2022 17:29:21 +0000 (10:29 -0700)]
[flang][runtime] Catch input error case of missing integer value

Formatted input allows for an empty numeric input field, which
signifies a zero value, but list-directed and NAMELIST input does
not -- apart from the special case of a NAMELIST array.

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

22 months ago[gn build] Port ad8eb85545c5
LLVM GN Syncbot [Thu, 18 Aug 2022 22:43:34 +0000 (22:43 +0000)]
[gn build] Port ad8eb85545c5

22 months ago[flang][runtime] Handle endian-swapped record headers & footers on input
Peter Klausler [Thu, 18 Aug 2022 16:52:17 +0000 (09:52 -0700)]
[flang][runtime] Handle endian-swapped record headers & footers on input

The runtime I/O library correctly handles endianness conversions on payload
data I/O and on the output of sequential record headers and footers, but
does not swap endianness when required when reading sequential record headers
and footers back in for READ and BACKSPACE statements.  Mea culpa.  Fix.

Fixes https://github.com/llvm/llvm-project/issues/57126

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

22 months ago[flang] Support for character array formats
Peter Klausler [Thu, 18 Aug 2022 17:52:59 +0000 (10:52 -0700)]
[flang] Support for character array formats

A character array can be used as a format in an I/O data transfer
statement, with the interpretation that its elements are concatenated
in element order to constitute the format.

Support in the runtime with an extra optional descriptor argument
to six I/O API calls; support in semantics by removing an earlier
check for a simply contiguous array presented as a format.

Some work needs to be done in lowering to pass a character array
descriptor to the I/O runtime API when present

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

22 months ago[NFC][MLGO] ML Regalloc Priority Advisor
Eric Wang [Thu, 18 Aug 2022 22:27:38 +0000 (15:27 -0700)]
[NFC][MLGO] ML Regalloc Priority Advisor

This patch introduces the priority analysis and the priority advisor,
the default implementation, and the scaffolding for introducing the
other implementations of the advisor.

Reviewed By: mtrofin

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

22 months ago[flang] Accept a null pointer as a NULL(MOLD=...) actual argument
Peter Klausler [Thu, 18 Aug 2022 17:50:53 +0000 (10:50 -0700)]
[flang] Accept a null pointer as a NULL(MOLD=...) actual argument

The MOLD= argument to NULL() is allowed to be a null pointer itself --
for example, NULL(MOLD=NULL(MOLD=...)) should not raise spurious semantic
errors.

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

22 months ago[flang] Improve error message for attempted assignment to a procedure
Peter Klausler [Wed, 17 Aug 2022 19:17:41 +0000 (12:17 -0700)]
[flang] Improve error message for attempted assignment to a procedure

Emit a "Assignment to procedure 'foo' is not allowed" error message
for more cases of 'foo' than just declaraed subprograms, rather than
assuming that those additional cases were named constants.

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

22 months ago[flang] Use naive algorithm for folding complex division when it doesn't over/underflow
Peter Klausler [Wed, 17 Aug 2022 18:34:20 +0000 (11:34 -0700)]
[flang] Use naive algorithm for folding complex division when it doesn't over/underflow

f18 unconditionally uses a scaling algorithm for complex/complex division
that avoids needless overflows and underflows when computing the sum of
the squares of the components of the denominator -- but testing has shown
some 1 ULP differences relative to the naive calculation due to the
extra operations and roundings.  So use the scaling algorithm only when
the naive calculation actually would overflow or underflow.

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

22 months ago[flang] Be more persistent in search for non-intrinsic module file
Peter Klausler [Tue, 16 Aug 2022 21:16:29 +0000 (14:16 -0700)]
[flang] Be more persistent in search for non-intrinsic module file

When a particular module name has been brought into a compilation
as an intrinsic module via USE,INTRINSIC, perhaps indirectly via
an enclosing USE statement, f18 will resolve later USE statements
to it unless they are USE,NON_INTRINSIC.  This is not entirely
correct -- a bare USE statement for a module name that happens to
match that of an intrinsic module should still search the search
paths for a non-intrinsic module file of the same name.

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

22 months ago[flang] Avoid spurious error message in function result compatibility
Peter Klausler [Thu, 18 Aug 2022 17:44:50 +0000 (10:44 -0700)]
[flang] Avoid spurious error message in function result compatibility

When checking function interface compatibility for procedure pointer
assignment/initialization or actual/dummy procedure association, don't
emit a diagnositic about function result shape incompatibility unless
the interfaces differ in rank or have distinct constant extents on a
dimension.  Function results whose dimensions are determined by dummy
arguments or host-associated variables are not necessarily incompatible.

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

22 months ago[flang] Compile-time checks for shape conformance on assignments
Peter Klausler [Mon, 15 Aug 2022 20:24:46 +0000 (13:24 -0700)]
[flang] Compile-time checks for shape conformance on assignments

Assignment statements need to check for array shape conformance
errors that are discernable at compilation time.

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

22 months ago[flang][runtime] Don't raise internal error in user error recovery situation
Peter Klausler [Sun, 14 Aug 2022 17:49:19 +0000 (10:49 -0700)]
[flang][runtime] Don't raise internal error in user error recovery situation

In the case of a data transfer I/O statement with an illegal unit number and
error recovery, ensure that data transfer API calls don't raise internal
errors due to the I/O statement representation unexpectedly being something
other than a data transfer statement.

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

22 months ago[libc++] Implement `operator<=>` for `filesystem::directory_entry`
Adrian Vogelsgesang [Sun, 31 Jul 2022 22:57:10 +0000 (15:57 -0700)]
[libc++] Implement `operator<=>` for `filesystem::directory_entry`

Implements part of P1614R2 "The Mothership has Landed"

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

22 months ago[flang][runtime] Fix error message
Peter Klausler [Sun, 14 Aug 2022 17:02:30 +0000 (10:02 -0700)]
[flang][runtime] Fix error message

A literal % character in an error message needs to be doubled
so that it appears in the output of snprintf().

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

22 months ago[flang][runtime] Catch input error on missing NAMELIST scalar
Peter Klausler [Sun, 14 Aug 2022 16:56:31 +0000 (09:56 -0700)]
[flang][runtime] Catch input error on missing NAMELIST scalar

While a NAMELIST input group item for an array can have fewer
values than expected, or none, an input group item for a scalar
must have a value.

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

22 months ago[flang][runtime] Fix return value for MINVAL/MAXVAL for CHARACTER(kind > 1)
Peter Klausler [Thu, 18 Aug 2022 17:31:13 +0000 (10:31 -0700)]
[flang][runtime] Fix return value for MINVAL/MAXVAL for CHARACTER(kind > 1)

CharacterExtremumAccumulator::GetResult() needs to use byte counts, not wide
character counts, when calling memcpy() & memset().

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

22 months ago[flang] Fold SPACING() correctly when result is subnormal
Peter Klausler [Fri, 12 Aug 2022 20:20:08 +0000 (13:20 -0700)]
[flang] Fold SPACING() correctly when result is subnormal

The intrinsic function SPACING() was being folded to the smallest
normal number (TINY(x)) rather than to a smaller subnormal result
when that result really was subnormal.

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

22 months ago[gn build] Port 0ac597f3cacf
LLVM GN Syncbot [Thu, 18 Aug 2022 21:18:53 +0000 (21:18 +0000)]
[gn build] Port 0ac597f3cacf

22 months ago[flang] Legacy extension intrinsic functions IMAG, IZEXT, JZEXT
Peter Klausler [Fri, 12 Aug 2022 19:28:44 +0000 (12:28 -0700)]
[flang] Legacy extension intrinsic functions IMAG, IZEXT, JZEXT

Support these legacy extension intrinsic functions with unambiguous
semantics in those existing compilers that support them by means
of recognizing them as aliases for standard intrinsics (IMAG) or
with simple rewrites (IZEXT, JZEXT).  Note that ZEXT has different
semantics in different existing compilers, so we will not support it
due to lack of a broad unambiguous precedent.

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

22 months ago[InstCombine] fold bitwise logic or+or+xor+not
Sanjay Patel [Thu, 18 Aug 2022 19:26:32 +0000 (15:26 -0400)]
[InstCombine] fold bitwise logic or+or+xor+not

(~A | C) | (A ^ B) --> ~(A & B) | C
https://alive2.llvm.org/ce/z/Qw3aiJ

This extends the existing fold (just above the new match)
to peek through another 'or' instruction.

This should let the motivating case from issue #57174
simplify completely.

22 months ago[InstCombine] add tests for or-xor-not patterns; NFC
Sanjay Patel [Thu, 18 Aug 2022 17:58:17 +0000 (13:58 -0400)]
[InstCombine] add tests for or-xor-not patterns; NFC

22 months ago[libc++] Implement `operator<=>` for `filesystem::path`
Adrian Vogelsgesang [Sun, 31 Jul 2022 22:21:01 +0000 (15:21 -0700)]
[libc++] Implement `operator<=>` for `filesystem::path`

Implements part of P1614R2 "The Mothership has Landed"

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

22 months ago[llvm] Remove std::clamp equivalent in `Transforms/Utils/MisExpect.cpp`
Joe Loser [Mon, 15 Aug 2022 03:14:18 +0000 (21:14 -0600)]
[llvm] Remove std::clamp equivalent in `Transforms/Utils/MisExpect.cpp`

Use `std::clamp` directly from the standard library now that LLVM is built with
C++17 standards mode.

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

22 months ago[flang][runtime] Improve Fortran I/O behavior when main program is C/C++
Peter Klausler [Fri, 12 Aug 2022 00:16:10 +0000 (17:16 -0700)]
[flang][runtime] Improve Fortran I/O behavior when main program is C/C++

Ensure that I/O buffers are flushed at the end of the program,
and properly detect ttys for predefined units so that Fortran
output is interspersed with output from non-Fortran code.

Fixes https://github.com/llvm/llvm-project/issues/56944

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

Update: fix typo in comment

22 months ago[NFC] Move DXC driver tests
Chris Bieneman [Thu, 18 Aug 2022 20:22:04 +0000 (15:22 -0500)]
[NFC] Move DXC driver tests

The DXC driver tests don't really belong mixed in with the toolchain
tests. This pulls them out to their own file and moves the
SimpleDiagnosticConsumer into a header so it can be used by both DXC and
toolchain tests.

fast-forwarded.

22 months ago[clang][test] Recognize leading unscore for macos
Alex Brachet [Thu, 18 Aug 2022 21:02:35 +0000 (21:02 +0000)]
[clang][test] Recognize leading unscore for macos

Additionally mark this test unsupported for ps5 in addition
to ps4, niether support -fuse-ld=

22 months ago[Hexagon] Add defaulted operator= to classes with defaulted copy ctor
Krzysztof Parzyszek [Thu, 18 Aug 2022 20:50:20 +0000 (13:50 -0700)]
[Hexagon] Add defaulted operator= to classes with defaulted copy ctor

This avoids deprecation warning:
```
warning: definition of implicit copy assignment operator for 'AddrInfo'
is deprecated because it has a user-declared copy constructor
[-Wdeprecated-copy]
```

This fixes https://github.com/llvm/llvm-project/issues/57229

22 months ago[libc++] Make <ranges> non-experimental
Louis Dionne [Thu, 18 Aug 2022 18:06:40 +0000 (14:06 -0400)]
[libc++] Make <ranges> non-experimental

When we ship LLVM 16, <ranges> won't be considered experimental anymore.
We might as well do this sooner rather than later.

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

22 months ago[flang][runtime] Improve error message for incompatible MATMUL arguments
Peter Klausler [Fri, 12 Aug 2022 16:17:09 +0000 (09:17 -0700)]
[flang][runtime] Improve error message for incompatible MATMUL arguments

Print the full shapes of both argument when the dimensions that must
match do not do so.

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

22 months ago[LoopVectorize][LoopAccessAnalysis] add newline to debug message
Michael Maitland [Thu, 18 Aug 2022 20:43:28 +0000 (13:43 -0700)]
[LoopVectorize][LoopAccessAnalysis] add newline to debug message

A debug message in `LoopAccessAnalysis` did not have a newline in it, causing printed debug messages to be formatted incorrectly.

Reviewed By: craig.topper

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

22 months agoRevert "[compiler-rt] Fix check for cross-compiling"
Ellis Hoag [Thu, 18 Aug 2022 20:41:46 +0000 (13:41 -0700)]
Revert "[compiler-rt] Fix check for cross-compiling"

This reverts commit ee80903a2ceb03f4617550eba55881f7b80ebb8e.

This seems to have broke builds

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

22 months ago[libc++] Mark everything inside vector as _LIBCPP_HIDE_FROM_ABI
Nikolas Klauser [Wed, 17 Aug 2022 09:17:34 +0000 (11:17 +0200)]
[libc++] Mark everything inside vector as _LIBCPP_HIDE_FROM_ABI

Reviewed By: ldionne, huixie90, #libc

Spies: libcxx-commits

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

22 months ago[compiler-rt] Fix check for cross-compiling
Ellis Hoag [Thu, 18 Aug 2022 12:58:56 +0000 (05:58 -0700)]
[compiler-rt] Fix check for cross-compiling

When checking if we are cross-compiling, use `CMAKE_HOST_SYSTEM_NAME`
rather than `CMAKE_HOST_SYSTEM` which seems to have the full version
number attached.

Reviewed By: smeenai

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

22 months ago[mlir][shape] add value_of op
Jacques Pienaar [Thu, 18 Aug 2022 18:27:00 +0000 (11:27 -0700)]
[mlir][shape] add value_of op

Reviewed By: jpienaar

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

22 months ago[clang][Driver] Pass correct reproduce flag to lld-link
Alex Brachet [Thu, 18 Aug 2022 20:11:22 +0000 (20:11 +0000)]
[clang][Driver] Pass correct reproduce flag to lld-link

Additionally, the explicit linux target has been removed from the test.

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

22 months ago[RISCV] Use VScaleForTuning in costing of operations whose cost depends on VL
Philip Reames [Thu, 18 Aug 2022 19:56:54 +0000 (12:56 -0700)]
[RISCV] Use VScaleForTuning in costing of operations whose cost depends on VL

On known hardware, reductions, gather, and scatter operations have execution latencies which correlated with the vector length (VL) of the operation. Most other operations (e.g. simply arithmetic) don't correlated in this way, and instead essentially fixed cost as VL varies.

When I'd implemented initial scalable cost model support for reductions, gather, and scatter operations, I had used an upper bound on the statically unknown VL. The argument at the time was that this prevented falsely low costs, and biased the vectorizer away from generating bad (on some hardware) code. Unfortunately, practical experience shows we were a bit too effective at that goal, and the high costs defacto prevents vectorization using these constructs at all.

This patch reverses course, and ties the returned cost not to the maximum possible VL, but the VL which would correspond to VScaleForTuning. This parameter is the same one the vectorizer uses when normalizing loop costs, so the term effectively cancels out. The result is that the vectorizer now sees these constructs as comparable in cost to their fixed length variants.

This does introduce the possibility of the cost for these operations being a significant under estimate on platforms where actual VLEN is far from that implied by VScaleForTuning. On such platforms, we might make poor heuristic choices. Probably not in LV itself (due to the cancellation mentioned above), but possibly during e.g. lowering. I'm not currently aware of any concrete examples of this, but this patch does open a concern which did not previously exist.

Previously, we had the problem of overestimating costs causing the same problem on machines much closer to default values for vscale for tuning. With this patch, we still have that problem potentially if vscale for tuning is set high (manually), and then the code is run on a narrow VLEN machine.

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

22 months ago[gn build] port f7a33090a910
Nico Weber [Thu, 18 Aug 2022 19:48:22 +0000 (15:48 -0400)]
[gn build] port f7a33090a910

22 months ago[OMPIRBuilder] Add support for safelen clause
Prabhdeep Singh Soni [Thu, 18 Aug 2022 19:43:08 +0000 (15:43 -0400)]
[OMPIRBuilder] Add support for safelen clause

This patch adds OMPIRBuilder support for the safelen clause for the
simd directive.

Reviewed By: shraiysh, Meinersbur

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

22 months ago[cmake] Use `CMAKE_INSTALL_LIBDIR` too
John Ericson [Sun, 4 Apr 2021 17:13:19 +0000 (13:13 -0400)]
[cmake] Use `CMAKE_INSTALL_LIBDIR` too

We held off on this before as `LLVM_LIBDIR_SUFFIX` conflicted with it.
Now we return this.

`LLVM_LIBDIR_SUFFIX` is kept as a deprecated way to set
`CMAKE_INSTALL_LIBDIR`. The other `*_LIBDIR_SUFFIX` are just removed
entirely.

I imagine this is too potentially-breaking to make LLVM 15. That's fine.
I have a more minimal version of this in the disto (NixOS) patches for
LLVM 15 (like previous versions). This more expansive version I will
test harder after the release is cut.

Reviewed By: sebastian-ne, ldionne, #libc, #libc_abi

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

22 months ago[MLIR] DynamicMemRefType: iteration and access by indices
Michele Scuttari [Thu, 18 Aug 2022 19:29:42 +0000 (21:29 +0200)]
[MLIR] DynamicMemRefType: iteration and access by indices

The methods to perform such operations have been implemented for the DynamicMemRefType in a way that is similar to the implementation for StridedMemRefType. Up until here one could pass an unranked memref to the library, and thus obtain a “dynamic” memref descriptor, but then there would have been no possibility to operate on its content.

22 months ago[flang][nfc] Update expected warning message in test
Emil Kieri [Thu, 18 Aug 2022 19:01:58 +0000 (21:01 +0200)]
[flang][nfc] Update expected warning message in test

to match the emitted warning, which has changed. I push this without
review as it is a one-line NFC. I have discussed it in D130386, which
altered the warning in question.

22 months ago[LinkerWrapper][NFC] Clean-up error handling
Joseph Huber [Thu, 18 Aug 2022 18:59:34 +0000 (14:59 -0400)]
[LinkerWrapper][NFC] Clean-up error handling

Summary:
We should return and propagate these errors instead of reporting them
immediately. Also use llvm::copy instead.

22 months ago[HLSL] Set main as default entry.
Xiang Li [Sat, 6 Aug 2022 08:17:09 +0000 (01:17 -0700)]
[HLSL] Set main as default entry.

When there's no -E option, use main as entry function.

Reviewed By: beanz

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

22 months ago[Inlining] Add a clang option to limit inlining of functions
Wolfgang Pieb [Tue, 5 Jul 2022 16:15:33 +0000 (09:15 -0700)]
[Inlining] Add a clang option to limit inlining of functions

Add the clang option -finline-max-stacksize=<N> to suppress inlining
of functions whose stack size exceeds the given value.

Reviewed By: aeubanks

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

22 months ago[mlir][LLVMIR] "Modernize" LLVM insert/extract element operations
Jeff Niu [Tue, 16 Aug 2022 15:30:55 +0000 (11:30 -0400)]
[mlir][LLVMIR] "Modernize" LLVM insert/extract element operations

This patch "modernizes" the implementation of these operations by
switching them to assembly formats and type inference traits.

Reviewed By: rriddle

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

22 months ago[mlir][memref] Remove extra brackets in doc
Peiming Liu [Thu, 18 Aug 2022 18:03:40 +0000 (18:03 +0000)]
[mlir][memref] Remove extra brackets in doc

There is an (probably) unintended bracket in the documentation for `memref.subview`. See https://mlir.llvm.org/docs/Dialects/MemRef/#memrefsubview-mlirmemrefsubviewop below Example 5.

Reviewed By: aartbik

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

22 months ago[flang] Make sure dynamic extents and length are rounded to 0 if negative
Valentin Clement [Thu, 18 Aug 2022 18:23:09 +0000 (20:23 +0200)]
[flang] Make sure dynamic extents and length are rounded to 0 if negative

Function returning CHARACTER with adjustable length or dynamic arrays
can have negative length or extents passed to them. This patch makes sure
any negative inputs is rounded to 0.

Reviewed By: vdonaldson

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

22 months ago[flang] Set attribute at the correct position
Valentin Clement [Thu, 18 Aug 2022 18:21:21 +0000 (20:21 +0200)]
[flang] Set attribute at the correct position

The TargetRewrite pass can change the number of argument of a function.
An extra llvm.nest attribute is added and was not set at the correct position
if an extra argument was inserted before.

Reviewed By: PeteSteinfeld

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

22 months ago[LV] Support fixed order recurrences.
Florian Hahn [Thu, 18 Aug 2022 18:15:51 +0000 (19:15 +0100)]
[LV] Support fixed order recurrences.

If the incoming previous value of a fixed-order recurrence is a phi in
the header, go through incoming values from the latch until we find a
non-phi value. Use this as the new Previous, all uses in the header
will be dominated by the original phi, but need to be moved after
the non-phi previous value.

At the moment, fixed-order recurrences are modeled as a chain of
first-order recurrences.

Reviewed By: Ayal

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

22 months ago[LV-L] Add const and move method body out of line [nfc]
Philip Reames [Thu, 18 Aug 2022 18:10:11 +0000 (11:10 -0700)]
[LV-L] Add const and move method body out of line [nfc]

22 months ago[libc++] Replace _LIBCPP_INLINE_VISIBILITY and mark all functions _LIBCPP_HIDE_FROM_A...
Nikolas Klauser [Wed, 17 Aug 2022 14:35:57 +0000 (16:35 +0200)]
[libc++] Replace _LIBCPP_INLINE_VISIBILITY and mark all functions _LIBCPP_HIDE_FROM_ABI in __split_buffer

Reviewed By: ldionne, huixie90, #libc

Spies: libcxx-commits

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

22 months ago[LV] Use early continue to simplify code [nfc]
Philip Reames [Thu, 18 Aug 2022 17:31:43 +0000 (10:31 -0700)]
[LV] Use early continue to simplify code [nfc]

22 months ago[test][mlir] Disable tests with HWASAN
Vitaly Buka [Thu, 18 Aug 2022 17:15:41 +0000 (10:15 -0700)]
[test][mlir] Disable tests with HWASAN

Re-enable after fixing https://github.com/llvm/llvm-project/issues/57231

22 months ago[test] Disable DynamicLibrary with HWASAN
Vitaly Buka [Thu, 18 Aug 2022 16:59:46 +0000 (09:59 -0700)]
[test] Disable DynamicLibrary with HWASAN

Re-enabled when https://github.com/llvm/llvm-project/issues/57206 fixed.

22 months ago[NFC][libc] Detect HWASAN support macro
Vitaly Buka [Thu, 18 Aug 2022 16:57:56 +0000 (09:57 -0700)]
[NFC][libc] Detect HWASAN support macro

22 months ago[flang][test] Fix semantics tests with respect to warnings
Emil Kieri [Wed, 17 Aug 2022 17:56:03 +0000 (19:56 +0200)]
[flang][test] Fix semantics tests with respect to warnings

Make tests expect the (correctly) emitted warnings using the WARNING
directive. This directive is non-functional now, but will be recognised
by test_errors.py when D125804 is landed. This patch is a preparation
for D125804.

For most tests, we add missing WARNING directives for emitted warnings,
but there are exceptions:

 - for int-literals.f90 and resolve31.f90 we pass -pedantic to the
   frontend driver, so that the expected warnings are actually emitted.

 - for block-data01.f90 and resolve42.f90 we change the tests so that
   warnings, which appear unintentional, are not emitted. While testing
   the warning in question (padding added for alignment in common block)
   would be desired, that is beyond the scope of this patch. This
   warning is target-dependent.

Reviewed By: PeteSteinfeld

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

22 months ago[mlir][LLVMIR] Fix syntax in integration tests (NFC)
Jeff Niu [Thu, 18 Aug 2022 17:09:12 +0000 (13:09 -0400)]
[mlir][LLVMIR] Fix syntax in integration tests (NFC)

22 months ago[SVE] Extend findMoreOptimalIndexType so BUILD_VECTORs do not force 64bit indices.
Paul Walker [Sun, 24 Jul 2022 12:30:56 +0000 (13:30 +0100)]
[SVE] Extend findMoreOptimalIndexType so BUILD_VECTORs do not force 64bit indices.

Extends findMoreOptimalIndexType to allow ISD::BUILD_VECTOR based
indices to be truncated when such truncation is lossless. This can
enable the use of 32bit gather/scatter indices thus making it less
likely to have to split a gather/scatter in two.

Depends on D125194

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

22 months ago[CostModel][X86] Add explicit int/fp arithmetic test coverage for avx512/slm/glm...
Simon Pilgrim [Thu, 18 Aug 2022 16:46:45 +0000 (17:46 +0100)]
[CostModel][X86] Add explicit int/fp arithmetic test coverage for avx512/slm/glm targets

22 months ago[mlir][LLVMIR] Change ShuffleVectorOp to use assembly format
Jeff Niu [Wed, 17 Aug 2022 16:22:20 +0000 (12:22 -0400)]
[mlir][LLVMIR] Change ShuffleVectorOp to use assembly format

This patch moves `LLVM::ShuffleVectorOp` to assembly format and in the
process drops the extra type that can be inferred (both operand types
are required to be the same) and switches to a dense integer array.

The syntax change:

```
// Before
%0 = llvm.shufflevector %0, %1 [0 : i32, 0 : i32, 0 : i32, 0 : i32] : vector<4xf32>, vector<4xf32>
// After
%0 = llvm.shufflevector %0, %1 [0, 0, 0, 0] : vector<4xf32>
```

Reviewed By: dcaballe

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

22 months ago[clangd] Fix a tsan failure in PreambleThrottle tests
Kadir Cetinkaya [Thu, 18 Aug 2022 16:34:21 +0000 (18:34 +0200)]
[clangd] Fix a tsan failure in PreambleThrottle tests

22 months agoUse a SmallPtrSet rather than a SmallVector in ClusterManager.
Jim Ingham [Tue, 16 Aug 2022 21:07:28 +0000 (14:07 -0700)]
Use a SmallPtrSet rather than a SmallVector in ClusterManager.

The m_objects store in this class is only used to check whether
this ClusterManager already owns this pointer.  With a SmallVector
the is_contained call was non-linear in number of children, and for
instance printing all the elements of a 16M element std::vector
didn't complete in the time I was willing to wait for it (hours).

Since we are only doing insert & contains, some kind of set is a
better data structure.  In this patch I used SmallPtrSet.  With
that, the same array prints out in 30 seconds.  I also tried a
std::unordered_set but that was slightly slower and used a fair bit
more memory.

Other than performance, this is NFC.

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

22 months agoRevert "[FindGRPC.cmake] Use `llvm_add_library()` for the custom proto target instead...
Argyrios Kyrtzidis [Thu, 18 Aug 2022 15:17:45 +0000 (08:17 -0700)]
Revert "[FindGRPC.cmake] Use `llvm_add_library()` for the custom proto target instead of `add_llvm_library()`"

Breaks configuring `clangd` with `-DCLANGD_ENABLE_REMOTE=On` (https://github.com/llvm/llvm-project/issues/57213)

This reverts commit ba688024077c3e51c6a0949246b2a1b76284e681.

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

22 months ago[CostModel][X86] Add explicit cmp/select test coverage for slm/glm targets
Simon Pilgrim [Thu, 18 Aug 2022 16:05:30 +0000 (17:05 +0100)]
[CostModel][X86] Add explicit cmp/select test coverage for slm/glm targets

22 months ago[CostModel][X86] Adjust SLM select costs to match poor throughput of pblendvb/blendvp...
Simon Pilgrim [Thu, 18 Aug 2022 15:53:17 +0000 (16:53 +0100)]
[CostModel][X86] Adjust SLM select costs to match poor throughput of pblendvb/blendvpd/blendvps

22 months ago[AMDGPU] Update comment on shrinking dpp. NFC
Joe Nash [Thu, 18 Aug 2022 14:58:54 +0000 (10:58 -0400)]
[AMDGPU] Update comment on shrinking dpp. NFC

22 months ago[flang] Enable SimplifyIntrinsics pass in driver.
Slava Zakharin [Wed, 17 Aug 2022 20:00:57 +0000 (13:00 -0700)]
[flang] Enable SimplifyIntrinsics pass in driver.

The pass is enabled for O1/O2/O3 optlevels now.

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

22 months ago[NFC][libc++] Fixes a typo.
Mark de Wever [Thu, 18 Aug 2022 15:27:43 +0000 (17:27 +0200)]
[NFC][libc++] Fixes a typo.

Discovered by phosek in D126971.

23 months ago[BOLT][AArch64] Ignore functions with islandsInfo during VeneerEliminarion and ICF
Denis Revunov [Fri, 29 Jul 2022 13:01:00 +0000 (09:01 -0400)]
[BOLT][AArch64] Ignore functions with islandsInfo during VeneerEliminarion and ICF

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

Reviewed By: yota9

23 months ago[InstCombine] Fix freeze instruction getting inserted before landingpad
Danila Malyutin [Thu, 18 Aug 2022 06:51:06 +0000 (09:51 +0300)]
[InstCombine] Fix freeze instruction getting inserted before landingpad

The code would use first non-phi instruction as an insertion point, however
this could lead to freeze getting inserted between phi and landingpad
causing a verifier assert.

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

23 months ago[Flang][OpenMP] Provide an error when the minus operator is used in a reduction
Kiran Chandramohan [Thu, 18 Aug 2022 14:34:45 +0000 (14:34 +0000)]
[Flang][OpenMP] Provide an error when the minus operator is used in a reduction

OpenMP 5.2 standard has deprecated the usage of the minus operation in
reductions. The minus operation also is an unpleasant feature with
varied interpretations.

The patch also changes the usage of the minus operator in some existing testcases.

Discussed in https://discourse.llvm.org/t/openmp-runtime-problem-with-subtraction-reduction/64404

Reviewed By: peixin

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

23 months ago[CostModel][X86] Add cost kinds test coverage for integer comparisons
Simon Pilgrim [Thu, 18 Aug 2022 14:25:27 +0000 (15:25 +0100)]
[CostModel][X86] Add cost kinds test coverage for integer comparisons

23 months ago[libc++][NFC] Add a short description for __split_buffer
Nikolas Klauser [Wed, 17 Aug 2022 15:01:02 +0000 (17:01 +0200)]
[libc++][NFC] Add a short description for __split_buffer

Reviewed By: Mordante, huixie90, #libc

Spies: libcxx-commits

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

23 months ago[LV] Restructure isPredicatedInst and isScalarWithPredication (w/a fix for uniform...
Philip Reames [Thu, 18 Aug 2022 14:08:39 +0000 (07:08 -0700)]
[LV] Restructure isPredicatedInst and isScalarWithPredication (w/a fix for uniform mem ops)

This change reorganizes the code and comments to make the expected semantics of these routines more clear. However, this is *not* an NFC change. The functional change is having isScalarWithPredication return false if the instruction does not need predicated. Specifically, for the case of a uniform memory operation we were previously considering it *not* to be a predicated instruction, but *were* considering it to be scalable with predication.

As can be seen with the test changes, this causes uniform memory ops which should have been lowered as uniform-per-parts values to instead be lowering via naive scalarization or if scalarization is infeasible (i.e. scalable vectors) aborted entirely. I also don't trust the code to bail out correctly 100% of the time, so it's possible we had a crash or miscompile from trying to scalarize something which isn't scalaralizable. I haven't found a concrete example here, but I am suspicious.

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

23 months ago[clangd] Use the "macro" semantic token for pre-defined identifiers
Christian Kandeler [Thu, 18 Aug 2022 14:12:50 +0000 (16:12 +0200)]
[clangd] Use the "macro" semantic token for pre-defined identifiers

This matches user expectations.

Reviewed By: sammccall

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

23 months ago[Flang] Mark 128 float MODULO intrinsic calls as "TODO"
Peter Steinfeld [Wed, 17 Aug 2022 23:54:34 +0000 (16:54 -0700)]
[Flang] Mark 128 float MODULO intrinsic calls as "TODO"

The code generated for this version of the intrinsic is broken.  I'm
marking it as a "TODO" for now so that people don't get unannounce bad
results.

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

23 months ago[CostModel][X86] getArithmeticInstrCost - use MUL/DIV/REM expansions for all cost...
Simon Pilgrim [Thu, 18 Aug 2022 13:18:54 +0000 (14:18 +0100)]
[CostModel][X86] getArithmeticInstrCost - use MUL/DIV/REM expansions for all cost kinds

The costs tables still assume throughput, but the general expansion patterns should be good for any cost kind

23 months ago[CostModel][X86] Add cost kinds test coverage for integer division/remainder operators
Simon Pilgrim [Thu, 18 Aug 2022 12:48:42 +0000 (13:48 +0100)]
[CostModel][X86] Add cost kinds test coverage for integer division/remainder operators

23 months ago[clang-tidy] Rename a local cmake variables to match the new tool name. NFC.
Martin Storsjö [Thu, 28 Jul 2022 10:54:43 +0000 (13:54 +0300)]
[clang-tidy] Rename a local cmake variables to match the new tool name. NFC.

This shouldn't have any externally visible effect.

This matches the new name from 18b4a8bcf3553174f770f09528c9bd01c8cebfe7.

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

23 months ago[CostModel] Replace getUserCost with getInstructionCost
Simon Pilgrim [Thu, 18 Aug 2022 10:55:23 +0000 (11:55 +0100)]
[CostModel] Replace getUserCost with getInstructionCost
* Replace getUserCost with getInstructionCost, covering all cost kinds.
* Remove getInstructionLatency, it's not implemented by any backends, and we should fold the functionality into getUserCost (now getInstructionCost) to make it easier for targets to handle the cost kinds with their existing cost callbacks.

Original Patch by @samparker (Sam Parker)

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

23 months ago[Clang] Propagate const context info when emitting compound literal
Ties Stuij [Thu, 18 Aug 2022 10:25:07 +0000 (11:25 +0100)]
[Clang] Propagate const context info when emitting compound literal

This patch fixes a crash when trying to emit a constant compound literal.

For C++ Clang evaluates either casts or binary operations at translation time,
but doesn't pass on the InConstantContext information that was inferred when
parsing the statement.  Because of this, strict FP evaluation (-ftrapping-math)
which shouldn't be in effect yet, then causes checkFloatingpointResult to return
false, which in tryEmitGlobalCompoundLiteral will trigger an assert that the
compound literal wasn't constant.

The discussion here around 'manifestly constant evaluated contexts' was very
helpful to me when trying to understand what LLVM's position is on what
evaluation context should be in effect, together with the explanatory text in
that patch itself:
https://reviews.llvm.org/D87528

Reviewed By: rjmccall, DavidSpickett

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

23 months agoPrecommit tests for D132115
wanglian [Thu, 18 Aug 2022 09:06:11 +0000 (17:06 +0800)]
Precommit tests for D132115

Reviewed By: david-arm

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

23 months ago[AMDGPU][MC][GFX11][NFC] Add missing tests for DS opcodes
Dmitry Preobrazhensky [Thu, 18 Aug 2022 09:50:29 +0000 (12:50 +0300)]
[AMDGPU][MC][GFX11][NFC] Add missing tests for DS opcodes

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