Commit Graph

433574 Commits

Author SHA1 Message Date
Mike Rice 89167e3c5b [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
2022-08-18 17:13:30 -07:00
Karl Meakin 71f0ec242f [AArch64] Add `foldCSELOfCSEL` combine.
This time more conservative.

Differential review: https://reviews.llvm.org/D125504
2022-08-19 01:04:29 +01:00
Fangrui Song c2a3888793 [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
2022-08-18 16:28:55 -07:00
Craig Topper 37c47b2cac [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
2022-08-18 16:22:25 -07:00
Shoaib Meenai d7a4ff9986 [compiler-rt] Clean up explicit -std=c++17 addition
This was superseded by 5737f6a527. Clean
it up as suggested by Mike Hommey in https://reviews.llvm.org/D131937.
2022-08-18 15:53:47 -07:00
Peter Klausler 514b759a96 [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
2022-08-18 15:51:11 -07:00
LLVM GN Syncbot aaccb2370f [gn build] Port ad8eb85545 2022-08-18 22:43:34 +00:00
Peter Klausler c7fe5e83db [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
2022-08-18 15:36:32 -07:00
Peter Klausler cc180f4c8c [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
2022-08-18 15:35:47 -07:00
Eric Wang ad8eb85545 [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
2022-08-18 15:33:48 -07:00
Peter Klausler 148116ab83 [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
2022-08-18 15:24:10 -07:00
Peter Klausler 07f2cd6d04 [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
2022-08-18 15:17:52 -07:00
Peter Klausler 2b5cd3778c [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
2022-08-18 15:11:34 -07:00
Peter Klausler dcbfabbeb5 [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
2022-08-18 15:05:05 -07:00
Peter Klausler c1a77839cc [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
2022-08-18 14:58:16 -07:00
Peter Klausler 75f9b18988 [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
2022-08-18 14:52:38 -07:00
Peter Klausler fde42ac5b9 [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
2022-08-18 14:51:04 -07:00
Adrian Vogelsgesang f1974f039f [libc++] Implement `operator<=>` for `filesystem::directory_entry`
Implements part of P1614R2 "The Mothership has Landed"

Differential Revision: https://reviews.llvm.org/D130860
2022-08-18 14:46:13 -07:00
Peter Klausler 3838245dc4 [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
2022-08-18 14:41:19 -07:00
Peter Klausler 2c39975d99 [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
2022-08-18 14:32:39 -07:00
Peter Klausler cd117fa04b [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
2022-08-18 14:26:26 -07:00
Peter Klausler 92afe80213 [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
2022-08-18 14:24:38 -07:00
LLVM GN Syncbot 6fed13f502 [gn build] Port 0ac597f3ca 2022-08-18 21:18:53 +00:00
Peter Klausler 6d279f4051 [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
2022-08-18 14:16:58 -07:00
Sanjay Patel b066195b3f [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.
2022-08-18 17:14:41 -04:00
Sanjay Patel 0e9fada711 [InstCombine] add tests for or-xor-not patterns; NFC 2022-08-18 17:14:41 -04:00
Adrian Vogelsgesang b3ab3bece0 [libc++] Implement `operator<=>` for `filesystem::path`
Implements part of P1614R2 "The Mothership has Landed"

Differential Revision: https://reviews.llvm.org/D130859
2022-08-18 14:13:48 -07:00
Joe Loser f3a55a1ddf
[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
2022-08-18 15:11:25 -06:00
Peter Klausler 341c7c05df [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
2022-08-18 14:10:45 -07:00
Chris Bieneman 0ac597f3ca [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.
2022-08-18 16:06:41 -05:00
Alex Brachet c175d80be2 [clang][test] Recognize leading unscore for macos
Additionally mark this test unsupported for ps5 in addition
to ps4, niether support -fuse-ld=
2022-08-18 21:03:28 +00:00
Krzysztof Parzyszek 252cea037b [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
2022-08-18 14:00:41 -07:00
Louis Dionne b8cb1dc9ea [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
2022-08-18 16:59:58 -04:00
Peter Klausler f5884fd9de [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
2022-08-18 13:59:13 -07:00
Michael Maitland f29401fcdf [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
2022-08-18 13:44:05 -07:00
Ellis Hoag 18f6b05e0a Revert "[compiler-rt] Fix check for cross-compiling"
This reverts commit ee80903a2c.

This seems to have broke builds

Differential Revision: https://reviews.llvm.org/D132174
2022-08-18 13:43:21 -07:00
Nikolas Klauser 8fc23c9b45 [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
2022-08-18 22:41:27 +02:00
Ellis Hoag ee80903a2c [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
2022-08-18 13:30:46 -07:00
Jacques Pienaar 18e616c3f0 [mlir][shape] add value_of op
Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D131976
2022-08-18 13:27:04 -07:00
Alex Brachet 377dddf4a0 [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
2022-08-18 20:12:23 +00:00
Philip Reames 4d87591028 [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
2022-08-18 13:10:03 -07:00
Nico Weber d3a1dbc490 [gn build] port f7a33090a9 2022-08-18 15:48:22 -04:00
Prabhdeep Singh Soni bce94ea551 [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
2022-08-18 15:43:08 -04:00
John Ericson f7a33090a9 [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
2022-08-18 15:33:35 -04:00
Michele Scuttari 8a10ee7590
[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.
2022-08-18 21:30:20 +02:00
Emil Kieri 4b12b256d7 [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.
2022-08-18 21:03:48 +02:00
Joseph Huber ca6d70b32e [LinkerWrapper][NFC] Clean-up error handling
Summary:
We should return and propagate these errors instead of reporting them
immediately. Also use llvm::copy instead.
2022-08-18 15:01:01 -04:00
Xiang Li 140b0bf899 [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
2022-08-18 11:57:36 -07:00
Wolfgang Pieb 8564e2fea5 [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
2022-08-18 11:56:24 -07:00
Jeff Niu a48ff68888 [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
2022-08-18 14:43:06 -04:00