Michał Górny [Fri, 19 Aug 2022 08:07:37 +0000 (10:07 +0200)]
[lldb] [test] Remove test_step_multiprocess, it's unreliable
Sponsored by: The FreeBSD Foundation
Max Kazantsev [Fri, 19 Aug 2022 07:48:39 +0000 (14:48 +0700)]
[Test] Regenerate tests using update_tests.py
Michał Górny [Fri, 19 Aug 2022 07:39:56 +0000 (09:39 +0200)]
[lldb] [test] Skip step packet test on non-amd64
Sponsored by: The FreeBSD Foundation
Siva Chandra Reddy [Fri, 19 Aug 2022 07:15:08 +0000 (07:15 +0000)]
[libc] Add more headers to the linux x86_64 and aarch64 configs.
Siva Chandra Reddy [Fri, 19 Aug 2022 07:01:47 +0000 (07:01 +0000)]
[libc][NFC] Change the libc fullbuild target name to "libc".
Chuanqi Xu [Fri, 19 Aug 2022 07:02:54 +0000 (15:02 +0800)]
[NFC] Add tests for MemorySSA shouldn't contain debug instructions
Extracted from D130153
Michał Górny [Fri, 12 Aug 2022 10:37:18 +0000 (12:37 +0200)]
[lldb] [gdb-remote] Include PID in vCont packets if multiprocess
Try to always send vCont packets and include the PID in them if running
multiprocess. This is necessary to ensure that with the upcoming full
multiprocess support always resumes the correct process without having
to resort to the legacy Hc packets.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D131758
Joey Watts [Fri, 19 Aug 2022 06:57:12 +0000 (07:57 +0100)]
[clang-tidy] Improve modernize-use-emplace check
This patch improves the modernize-use-emplace check by adding support for
detecting inefficient invocations of the `push` and `push_front` methods on
STL-style containers and replacing them with their `emplace`-style equivalent.
Fixes #56996.
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D131623
Xiang Li [Thu, 18 Aug 2022 06:40:13 +0000 (23:40 -0700)]
[DirectX] Fix crash on ShuffleVectorInst in DXILBitcodeWriter
Use onstantDataSequential::getElementType to allow vector type.
Use getShuffleMaskForBitcode to get ShuffleMask.
Use old format for alloca Align.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D132102
Chuanqi Xu [Fri, 19 Aug 2022 06:41:25 +0000 (14:41 +0800)]
[NFC] Add [[maybe_unused]] to avoid warning in gcc9
GCC9 may issue warning for the 'unused' parameters in if constexpr.
This commit try to fix it by adding the [[maybe_unused]] attribute.
Valentin Clement [Fri, 19 Aug 2022 06:40:09 +0000 (08:40 +0200)]
[flang] Shift argument attributes when result operand is inserted
The TargetRewrite pass convert the signature of the function.
In some cases it adds operands to the function to hanlde the result of it.
This patch makes sure the argument attributes present before the conversion
are replaced with the correct arguments after the conversion is performed.
Depends D132113
Reviewed By: vdonaldson
Differential Revision: https://reviews.llvm.org/D132114
Max Kazantsev [Fri, 19 Aug 2022 06:24:35 +0000 (13:24 +0700)]
[Test] Remove addrspace1 ptr to not confuse alive2
addrspace here is not import for the test itself.
Timm Bäder [Thu, 11 Aug 2022 09:22:00 +0000 (11:22 +0200)]
[clang] Improve diagnostics for uninitialized constexpr variables
Instead of complaining about default initialization, tell users that
constexpr variables need to be initialized by a constant expression.
Differential Revision: https://reviews.llvm.org/D131662
Fabian Parzefall [Fri, 19 Aug 2022 04:51:51 +0000 (21:51 -0700)]
[BOLT] Insert EH trampolines for multiple fragments
This patch adds exception handling trampolines when a function is split
into more than two fragments. Trampolines are tracked per-fragment, such
that they can be removed if splitting is reversed.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132048
Fabian Parzefall [Fri, 19 Aug 2022 04:51:22 +0000 (21:51 -0700)]
[BOLT] Update buildCallGraph to check for split blocks
Use isSplit() instead of isCold() when building the call graph and
update parameter names to reflect this.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132047
Fabian Parzefall [Fri, 19 Aug 2022 04:51:01 +0000 (21:51 -0700)]
[BOLT] Add randomN split strategy
This adds a strategy to split functions into a random number of
fragments at randomly chosen split points.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D130647
Fabian Parzefall [Fri, 19 Aug 2022 04:50:35 +0000 (21:50 -0700)]
[BOLT] Add split all blocks strategy
This adds a function splitting strategy that splits each outlineable
basic block into its own fragment. This is exposed through a new command
line option `--split-strategy`.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D129827
Fabian Parzefall [Fri, 19 Aug 2022 04:48:19 +0000 (21:48 -0700)]
[BOLT] Generate sections for multiple fragments
This patch adds support to generate any number of sections that are
assigned to fragments of functions that are split more than two-way.
With this, a function's *nth* split fragment goes into section
`.text.cold.n`.
This also changes `FunctionLayout::erase` to make sure, that there are
no empty fragments at the end of the function. This sometimes happens
when blocks are erased from the function. To avoid creating symbols
pointing to these fragments, they need to be removed.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D130521
Fabian Parzefall [Fri, 19 Aug 2022 04:40:00 +0000 (21:40 -0700)]
[BOLT] Make exception handling fragment aware
This adds basic fragment awareness in the exception handling passes and
generates the necessary symbols for fragments.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D130520
Fabian Parzefall [Fri, 19 Aug 2022 04:26:18 +0000 (21:26 -0700)]
[BOLT] Support passing fragments to code emission
This changes code emission such that it can emit specific function
fragments instead of scanning all basic blocks of a function and just
emitting those that are hot or cold.
To implement this, `FunctionLayout` explicitly distinguishes the "main"
fragment (i.e. the one that contains the entry block and is associated
with the original symbol) from "split" fragments. Additionally,
`BinaryFunction` receives support for multiple cold symbols - one for
each split fragment.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D130052
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.
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.
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
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
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
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.
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
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
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
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
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.
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
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
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
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
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
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.
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
LLVM GN Syncbot [Thu, 18 Aug 2022 22:43:34 +0000 (22:43 +0000)]
[gn build] Port
ad8eb85545c5
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
LLVM GN Syncbot [Thu, 18 Aug 2022 21:18:53 +0000 (21:18 +0000)]
[gn build] Port
0ac597f3cacf
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
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.
Sanjay Patel [Thu, 18 Aug 2022 17:58:17 +0000 (13:58 -0400)]
[InstCombine] add tests for or-xor-not patterns; NFC
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
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
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
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.
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=
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
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
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
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
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
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
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
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
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
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
Nico Weber [Thu, 18 Aug 2022 19:48:22 +0000 (15:48 -0400)]
[gn build] port
f7a33090a910
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
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
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.
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.
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.
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
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
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
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
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
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
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
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]
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
Philip Reames [Thu, 18 Aug 2022 17:31:43 +0000 (10:31 -0700)]
[LV] Use early continue to simplify code [nfc]
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
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.
Vitaly Buka [Thu, 18 Aug 2022 16:57:56 +0000 (09:57 -0700)]
[NFC][libc] Detect HWASAN support macro
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
Jeff Niu [Thu, 18 Aug 2022 17:09:12 +0000 (13:09 -0400)]
[mlir][LLVMIR] Fix syntax in integration tests (NFC)
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
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
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
Kadir Cetinkaya [Thu, 18 Aug 2022 16:34:21 +0000 (18:34 +0200)]
[clangd] Fix a tsan failure in PreambleThrottle tests
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
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